• Resolved cocacooler

    (@cocacooler)


    I have written the following in my functions.php however i am unable to make it work..only the e-mail feild is getting validated..

    <?php function em_validate($result, $EM_Event){
    if ($_REQUEST['em_tickets'] > 1 && $_REQUEST['booking_comment'] == ''){
    $EM_Event->add_error('fill more names');
    $result = false;
    }
    return $result;
    }
    add_filter('em_event_validate','em_validate', 1, 2);
    ?>

    https://ww.wp.xz.cn/plugins/events-manager/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    hmm, can I know what are the other fields that you’ve wanted to validate?

    Thread Starter cocacooler

    (@cocacooler)

    i want to validate

    if em_tickets more than 1
    and there is should be something in booking_comment

    currrently only email gets validated.

    Have you tried checking for the strlen of $_REQUEST[‘booking_comment’] ?

    http://php.net/manual/en/function.strlen.php

    Thread Starter cocacooler

    (@cocacooler)

    please see my above function

    thats what i am trying to do

    if ($_REQUEST['em_tickets'] > 1 && $_REQUEST['booking_comment'] == ''){

    but the above function is not trigging at all

    function em_validate($result, $EM_Event){
    if ($_REQUEST['em_tickets'] > 1 && $_REQUEST['booking_comment'] == ''){
    $EM_Event->add_error('fill more names');
    $result = false;
    }
    return $result;
    }
    add_filter('em_event_validate','em_validate', 1, 2);

    Thread Starter cocacooler

    (@cocacooler)

    I have almost created the validating part, however i am not able to get the number of tickets reserved.. can someone point out an solution ?

    this part is not working : $_REQUEST[’em_tickets’] > 1

    This is my code:

    function em_validate($result, $EM_Event){
        if ($_REQUEST['em_tickets'] > 1 && $_REQUEST['booking_comment'] == ''){
      $EM_Event->add_error('Fill out the comments');
        $result = false;
    
     }
     return $result;
    }
    add_filter('em_booking_validate','em_validate', 1, 2);
    Plugin Support angelo_nwl

    (@angelo_nwl)

    try to use $EM_Event->get_bookings()->get_booked_spaces() instead of $_REQUEST['em_tickets']

    eg. under classes/em-bookings.php

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

The topic ‘scripting question’ is closed to new replies.