• what variables are actually passed to:

    add_action('um_submit_form_errors_hook', 'validate_venue', 99,1);
    function validate_venue( $args ){}

    the $args array?

    I am trying to have a single validation check multiple conditions and then post the correct errors on the inputs.

    I have it working for venue name, but now verifying its a unique address is making me struggle…

    global $ultimatemember;
    	global $wpdb;
    
    		if ( isset( $args['venue-name'] ) ){
    			$venueName = $args["venue-name"];
    			$venueAddress = $args["street-address"];
    			$venueCity = $args["city"];
    
    			$return_name = $wpdb->get_col($wpdb->prepare("
    				SELECT meta_key
    				FROM {$wpdb->eo_venuemeta}
    				WHERE meta_key = '_venue-name'
    				AND meta_value = %s
    				", $venueName ));
    
    			$return_address = $wpdb->get_col($wpdb->prepare("
    				SELECT meta_key
    				FROM {$wpdb->eo_venuemeta}
    				WHERE (meta_key = '_address' AND meta_value='%s')
    				", $venueAddress));
    
    			$return_city = $wpdb->get_col($wpdb->prepare("
    				SELECT meta_key
    				FROM {$wpdb->eo_venuemeta}
    				WHERE (meta_key = '_city' AND meta_value='%s')
    				", $venueCity));
    
    		if($return_name) {
    			$ultimatemember->form->add_error("venue-name",'This Venue Name '.$venueName.', is already Taken!','ultimatemember');
    		}
    
    		if($return_address && $return_city) {
    
    			if($return_address){
    				$return_address->form->add_error("street-address",'This Venue Address '.$venueAddress.', is already Taken!','ultimatemember');
    			}
    
    			if($return_city){
    				$return_address->form->add_error("city", $venueAddress.'in'.$venueCity.', is already Taken!','ultimatemember');
    			}
    		}

    returns an error of
    Fatal error: Call to a member function add_error() on a non-object in /home/prymeadmin/public_html/wp-content/themes/bizmo/functions.php on line 168

    which I know is associated with: “$return_address->form->add_error(“street-address”

    Any ideas?

    I split up the returns to make sure I can variably flag whats wrong…

    I know I could prolly do it with

    WHERE (meta_key = ‘_address’ AND meta_value=’%s’)
    AND (meta_key = ‘_city’ AND meta_value=’%s’)

    which would be more ideal, but I need to make sure that the errors propagate the correct info first… and that I am actually gathering the correct values from the inputs.

    hence the question about the structure of the $args array.

    https://wordpress.org/plugins/ultimate-member/

Viewing 4 replies - 1 through 4 (of 4 total)
  • I have taken a quick look and the $args represent $_POST

    Thread Starter pryme8

    (@pryme8)

    Ok, so why would I be dropping that error? Do I have to add the custom validation to each of the inputs? Right now in the form builder I only have the venue name calling that validation action, and I really don’t want to have to write up separate actions for each input which I’m sure I can use as a work around for this error, but the way I understand is that it if is the posts then asking for “street-address” as the object should not drop an error as it should of been sent with the posts of the form… Or is it because I do t have the custom validation attached in my form builder possibly they are none existent as objects as far as the plugins concerned?

    Thread Starter pryme8

    (@pryme8)

    I am about to buy the full version of this plugin for one of my other clients (parinfinity.net). But I want to get this problem hashed out on my current project in order to feel more comfortable dedicating fully to this member tracking plugin. I like it’s structure but need to understand more about the validations. I am extremely competent in procedural programing but wp seems to be way more object oriented and I’m sorry if it seems I’m asking amateurish questions, it’s just hard going from making custom data management systems to wrapping my mind around the monster that is wordpress. As I deploy this plugin on more of my projects I’m sure I’ll have a bunch more questions for y’all.

    Is there a link to documentation that is more procedural style instead of object oriented for this plugin? Or am I going to have to bite the bullet and and shift my logic?

    Plugin Author Ultimate Member

    (@ultimatemember)

    Hi,

    Can you please submit a support ticket via our website so one of our developers can answer your questions. You can submit a ticket on this page: https://ultimatemember.com/support/

    This doc provides instructions on how to submit a ticket:

    http://docs.ultimatemember.com/article/179-how-to-create-a-support-ticket

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘what is stored in $args on form submit?’ is closed to new replies.