Function Reference: geodir_payment_method_update

Summary

This function has not been documented yet.

Source Code

function geodir_payment_method_update()
{
	global $wpdb;
	
	if(current_user_can( 'manage_options' )){
	
		if($_REQUEST['payaction'] == 'trouble_shoot' && $_REQUEST['pay_method'] != '' && isset($_REQUEST['nonce']))
		{
			
			if ( !wp_verify_nonce( $_REQUEST['nonce'], 'payment_trouble_shoot'.$_REQUEST['pay_method'] ) )
				return;
			
			
			$pay_method = str_replace('payment_method_', '', $_REQUEST['pay_method']);
			
			$paymenthodinfo = array();
			
			if($pay_method != '')
				$paymenthodinfo = geodir_get_additional_pay_options($pay_method);
			
			
			if(is_array($paymenthodinfo) && !empty($paymenthodinfo)){
			
				$paymentsql = $wpdb->prepare("select * from $wpdb->options where option_name like %s order by option_id asc", array('payment_method_'.$pay_method));
			
				$paymentinfo = $wpdb->get_row($paymentsql);
				
				if($paymentinfo->option_id){
				
					$wpdb->query($wpdb->prepare("update $wpdb->options set option_value=%s where option_id=%d",array(serialize($paymenthodinfo),$paymentinfo->option_id)));
					
				}
			
			}
			
			$msg = __('Price method updated successfully.', 'geodir_payments');
			$msg = urlencode($msg);
			$location = admin_url()."admin.php?page=geodirectory&tab=paymentmanager_fields&subtab=geodir_payment_options&success_msg=".$msg;
			wp_redirect($location);
			exit;
			
		}
	}else{
		
		wp_redirect(geodir_login_url());
		exit();
	
	}

}