View bookings on the front-end

This topic contains 6 replies, has 2 voices, and was last updated by  Willow 9 years, 4 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #18375

    I’ve got this mini plugin that lists user’s events via a shortcode: http://pastebin.com/UJJei4Va

    This is the output on user’s account page:

    User events

    In the Action column, I’d like to add “View bookings”.
    Can this be done?

    Thank you!

    Willow
    #18376

    Yes, the url for the bookings page for an event is:

    $base_url = admin_url( 'edit.php?post_type=event&page=bookings' );
    $bookings_url = add_query_arg( 'event_id', get_the_ID(), $base_url );
    

    but only users with the ability to manage bookings will be able to acnes it.

    Also, you should add wp reset postdata() after the while loop (see the codex for details)

    Stephen Harris
    #18384

    wp_reset_postdata added.

    What do I do with the above link code? Sorry, need hand-holding on this one.
    Added it to the plugin, pretty sure it’s in the right spot (tried a few, actually), but get an error:

    Fatal error: Call to undefined function bookings_url()

    Thank you!

    P.S. Do you ever sleep??

    Willow
    #18386

    He he, bit of a night owl 🙂

    If you place the above lines just after $user_posts->the_post();

    Then try the following for the action column:

    <td>
        <a href="'.get_permalink().'edit-event/"><span style="color: green;">'. __( 'Edit', 'lup' ).'</span></a>
        <a href="'.esc_url($bookings_url).'"><span style="color: green;">'. __( 'view bookings', 'lup' ).'</span></a>
    </td>
    

    It sounds like you were using $bookings_url as a function – but its a variable.

    Stephen Harris
    #18387

    Put it in the right place originally, but wasn’t creating the link correctly. It works now, thanks.

    Surprised to see that it takes the organiser to the back-end though. Two more questions then:

    1) Is there any way to modify the language, i.e. what things are called on the back-end in a way that won’t be over-written when plugin is updated?
    Specifically, change Bookings to Registrations; Bookees to Attendees.

    2) Is there a way to hide payment gateway from Download options?

    Neither of these are critical, but in case they’re easy fixes, would be great to know.

    Thank you!

    Willow
    #18388

    There’s no frontend view for bookings (unless you are using the booking history shortcode to show the current user’s booking history).

    It’s possible to add code to your theme which uses the plug-ins’ API to display such data on the front end. E.g. in a page template / shortcode callback you could use eo_get_bookings() (see codex for details) to retrieve bookings. But this would be quite an involved effort.

    1) Yes, in languages/ you’ll find a .pot file, this contains all the text used by the plug-in. You can use this as a basis of .po file – which allows for a translation of that text. Typically this intended for translating to another language but you can also use it do modify the text.

    To do this create .po and .mo for the language your site is in. You can edit your .po and create the .mo using something like poedit. Then place the file in wp-content/languages/event-organiser-pro/ (you’ll need to create it). It’ll survive updates to the plugin.

    Note that it’s the .mo file that is really required, but you need to generate that from the .po file.

    2) Unless I’ve misunderstood you, you have to explicitly include the gateway field when you download bookings?

    Stephen Harris
    #18389

    Re: 1) Happy to hear there’s a solution for correcting the terminology, yay.

    Re: 2) When clicking “Download bookings”, “Payment gateway” showed up in the dropdown along with my custom fields, like this:

    Download bookings checklist

    It self-corrected when I removed the title from the “Payment Gateway” field in the form designer.
    It no longer shows up in the custom fields list.

    Moving along 🙂

    Thank you again!!

    Willow
Viewing 7 posts - 1 through 7 (of 7 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.