what is stored in $args on form submit?
-
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 168which 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.
- The topic ‘what is stored in $args on form submit?’ is closed to new replies.