Function Reference: geodir_change_payment_method_status

Summary

This function has not been documented yet.

Source Code

function geodir_change_payment_method_status()
{
		global $wpdb;
		
		if(current_user_can( 'manage_options' )){
		
		if($_GET['status']!='' && $_GET['id']!='' && isset($_REQUEST['_wpnonce']))
		{
			
			if ( !wp_verify_nonce( $_REQUEST['_wpnonce'], 'payment_options_status_update_'.$_GET['id'] ) )
			return;
			
			$paymentupdsql = $wpdb->prepare("select option_value from $wpdb->options where option_id=%d",array($_GET['id']));
			
			$paymentupdinfo = $wpdb->get_results($paymentupdsql);
			
			if($paymentupdinfo)
			{
				foreach($paymentupdinfo as $paymentupdinfoObj)
				{
					$option_value = unserialize($paymentupdinfoObj->option_value);
					
					$option_value['isactive'] = $_GET['status'];
					
					$option_value_str = serialize($option_value);
					
				}
			}
			
			$updatestatus = $wpdb->prepare("update $wpdb->options set option_value= %s where option_id=%d",array($option_value_str,$_GET['id']));
			
			$wpdb->query($updatestatus);
		}
		
		$msg = 'Payment Method Status Updated Successfully.';
		$msg = urlencode($msg);
		wp_redirect(admin_url()."admin.php?page=geodirectory&tab=paymentmanager_fields&subtab=geodir_payment_options&success_msg=".$msg);
		
		exit;
		
		}else{
		
		wp_redirect(geodir_login_url());
		exit();
	
	}
}