WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Events Manager] Form always gives true is email is correct.

[Resolved] [Plugin: Events Manager] Form always gives true is email is correct.

  • Hello.

    I’ve added my own fields in booking-fields.php, later validated in the hook em_booking_add. The code looks like:
    Booking-fields.php, The new field

    <p>
        <label for='city'>City *</label>
        <input type="text" name="city" id="city" class="input" <?php if(!empty($_REQUEST['city'])) echo "value='{$_REQUEST['city']}'"; ?> />
    </p>

    Functions.php, The hook

    global $EM_Notices;
    if( ! empty( $_REQUEST['city'] ) ){
        $EM_Booking->booking_meta['registration']['city'] = wp_kses( $_REQUEST['city'], array() );
    	} else {
        $registration = false;
        $EM_Notices->add_error( '<strong>ERROR</strong>: City.' );
    }

    If the email is failing, this error also comes up (if the field is empty), but nothing happends if the email is correct.

    Also doesnt give a “Succes” message.

    What’s wrong?

    http://wordpress.org/extend/plugins/events-manager/

    [ Please do not bump, that’s not permitted here. ]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Is there any way to set $post_validation to false without writing code in plugin? This way im able to only allow my own validation.

    Hi,

    can you provide a sample link to test?

    Do I have to use $post_validation to validation instead of
    $registration = false;
    $EM_Notices->add_error( ‘ERROR‘ );

    How to I use $post_validation and how to I make my fields required?

    Plugin Author Marcus

    @netweblogic

    Is there any way to set $post_validation to false without writing code in plugin? This way im able to only allow my own validation.

    yes, hook into the em_booking_validate or em_booking_get_post filters and change the argument from true to false (and add your errors).

    Sorry for bringing this up again, but im very close.

    Hooking into em_booking_validate:

    add_filter( 'em_booking_validate', 'dm_booking_validate' );
    function dm_booking_validate ( $result, $EM_Booking ) {

    My errors and succes works great. And it also registers the signup. Only problem is that I do not get my booking_meta with me.

    Im trying to do it like this:

    if( ! empty( $_REQUEST['city'] ) ) {
    	$EM_Booking->booking_meta['registration']['city'] = wp_kses( $_REQUEST['city'], array() );
    }

    Only thing im getting is the user_email.

    returning $result

    What im I doing wrong?

    The fix was to make EM_Booking global

    global $EM_Notices, $EM_Booking;

    Now saves all my metadata together with the booking

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] [Plugin: Events Manager] Form always gives true is email is correct.’ is closed to new replies.