Download an Event's Booking List from FrontEnd?

WordPress Event Management, Calendars & Registration Forums General Question Download an Event's Booking List from FrontEnd?

This topic contains 7 replies, has 2 voices, and was last updated by  Aaron Robb 9 years, 10 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #15770

    Is there a way to let admins download the event list csv from the front end?

    Is that possible?

    Aaron Robb
    #15781

    Yes you could, edit the event page to include a link:

    $url = add_query_arg(
        array(
            'eo-action'     => 'export-bookings',
            'event_id'      => get_the_ID(),
        ),
        admin_url( 'admin-post.php' )
    );
    
    printf( '<a href="%s">Download bookings</a>', $url );
    
    Stephen Harris
    #15813

    Using that code gives a blank page so far…what would the full url be normally for downloading?

    This function gives this url:

    mywebsite.com/wp-admin/admin-post.php?eo-action=export-bookings&event_id=234

    This is the link I think it should be, but not sure how to generate it:

    mywebsite.com/wp-admin/edit.php?post_type=event&page=bookings&event_id=234&eo-action=export-bookings

    Does it make sense to use that?

    Aaron Robb
    #15820

    If you type that url in the address bar then it will take you to a white page, but it’ll trigger the download of the CSV file. If you click the link, it’ll just download the CSV file.

    But you can replace

    admin_url( 'admin-post.php' )
    

    with

    admin_url( 'edit.php?post_type=event&page=bookings' )
    

    if you prefer.

    Stephen Harris
    #15936

    Great, that works, thanks!

    Aaron Robb
    #16484

    Stephen,

    I’ve found an issue with our solution here that maybe you can help me with.

    This works great for admins, but I have another user level, “Event Creator”, that I want to allow to download bookings this way. Problem is when they click the link, it goes to their profile page instead of downloading. I’m assuming its a permission thing, but I have all ‘event’ related permissions checked off for them (using a role editor).
    Is there another thing we need to give them permission for to download bookings?

    Aaron Robb
    #16534

    Hi Aaron,

    Generally they would need to be able to manage bookings for the event – you can select the user’s Privleges in Settings > Event Organiser > Permissions.

    Stephen Harris
    #16573

    ok, those permissions were set up already. It must be something stopping that level of user from accessing the “admin-post.php” area. There are other permission/rules i have set up, so it must be that. Just eliminating possible factors.

    Thanks for the help!

    Aaron Robb
Viewing 8 posts - 1 through 8 (of 8 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.