WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
Problem booking someone programmaticly. (3 posts)

  1. glennbennett
    Member
    Posted 2 years ago #

    I now get a ticketing error. (missing field ticket_booking_spaces) I had to change the validate routine to use the real field name and not the "true" field name (see code below. I'm not sure what that is. Should I be setting ticket_booking_spaces or spaces?

    I'm also getting a RSVP error "You cannot manage this Booking". I'm looking into that now.

    Here is how I'll reserving a spot for someone"

    $rsvp->booking_status = $rsvp_status;
    $rsvp->booking_spaces = $_POST['guests']+1;
    $rsvp->booking_comment = htmlentities($_POST['rsvp_comment']);
    $rsvp->event_id = $event->id();
    $rsvp->person_id = $hap_user->id();
    $tickets = $rsvp->get_tickets();

    $tb = new EM_Ticket_Booking();
    $tb->booking_id = $rsvp->booking_id;
    $tb->ticket_id = $tickets->tickets[0]->ticket_id;
    $tb->ticket_booking_price = $tickets->tickets[0]->ticket_price;
    $tb->ticket_booking_spaces = strval($_POST['guests']+1);
    $tb->save();

    $rsvp->save();

    --------------------------------------------------------------------

    class EM_Ticket_Booking

    Original

    function validate(){
    $missing_fields = Array ();
    foreach ( $this->required_fields as $field ) {
    $true_field = $this->fields[$field]['name'];
    if ( $this->$true_field == "") {
    $missing_fields[] = $field;
    }
    }
    if ( count($missing_fields) > 0){
    // TODO Create friendly equivelant names for missing fields notice in validation
    $this->errors[] = __ ( 'Missing fields: ' ) . implode ( ", ", $missing_fields ) . ". ";
    }
    return apply_filters('em_event_validate', count($this->errors) == 0, $this );
    }

    modified

    function validate(){
    $missing_fields = Array ();
    foreach ( $this->required_fields as $field ) {
    $true_field = $this->fields[$field]['name'];
    if ( $this->$field == "") {
    $missing_fields[] = $field;
    }
    }
    if ( count($missing_fields) > 0){
    // TODO Create friendly equivelant names for missing fields notice in validation
    $this->errors[] = __ ( 'Missing fields: ' ) . implode ( ", ", $missing_fields ) . ". ";
    }
    return apply_filters('em_event_validate', count($this->errors) == 0, $this );
    }

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

  2. Shonu
    Member
    Posted 2 years ago #

    In case you mean, that you would like to book users with an account to events you know they will attend (e.g. info by mouth or by email), then I am interested how to add this feature conveniently to an event.
    I am always having the issue, that people tell me, the come, but never bother to book their seat....

    thanks for any code I can re-use if you solved it.

  3. glennbennett
    Member
    Posted 2 years ago #

    Shonu,

    That's not exactly what I'm doing, but I think it either possible view the admin or you could use the "Admin Login As Different User" plugin and book a ticket for them.

    http://wordpress.org/extend/plugins/admin-login-as-different-user/

    The thing that's got me kinda baffled about this events plugin is that it's not clear if I need tickets or not. I don't think I actually do so maybe I can just never use ticket and my problems would be solved.

    Actually I looking at using a different plugin all together. The events plus plugin looks to be simpler and solve many of my problems including very fast and easy event registration.

    http://premium.wpmudev.org/project/events-plus/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic