Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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?

    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)

    So would it be more ideal to stick with my wpdb prepared statments?

    Why are the requests to eo_get_venue_by not automatically getting prepared and sterilized?

    I guess this is when I feature request that things like that automatically get sterilized an that the eo get venue by function could have address and geo locations requests?

    Also, in the naming of the venue is it going to be smarter for me to add an associated meta-key in the venumeta table like I did or would it be more practical to link to the name stored on the separate wp table?

    Thread Starter pryme8

    (@pryme8)

    I assume I can use that to search by name like I was looking for, and also address? So I could restructure my code with something like:

    if ( isset( $args['venue-name'] ) && eo_get_venue_by('name',$args['venue-name'] ) ){
    	$venueName = $args["venue-name"];
    $ultimatemember->form->add_error("venue-name",'This Venue Name '.$venueName.', is already Taken!','ultimatemember');
    }

    I would much rather use your API, the link you just sent me is pretty legit thank you!

    Thread Starter pryme8

    (@pryme8)

    whoops, my bad your right I dont know why I posted that here… The question for you guys was more on how to interact with the eo_venuemeta but I figured that out.

    The problem was the structure of the wpdb->sql statement was a little different then what I am used to doing with sqli procedural.

    The question I would still have for you then, if I am manually adding the venues with my own database requests, am I going to have to insert into multiple tables or just the data in the eo_venuemeta table that was created when I made a test venue through your UI?

    I ended up adding a _venue-name row, because I was not able to find the location that stores the venues name, is it stored as a post?

    Thread Starter pryme8

    (@pryme8)

    I figured it out, but now I need some help with the form Validation…

    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

    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.

Viewing 6 replies - 1 through 6 (of 6 total)