List events for current user

This topic contains 1 reply, has 2 voices, and was last updated by  Stephen Harris 1 year, 12 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #41122

    Hi.

    Is there a shortcode that can list the events that the current user created?

    I am looking to integrate into a front end panel to list events and provide an edit link for each of them.

    If there is a quick way to achieve this without a shortcode, that would be great as I can integrate it myself.

    Thanks for the great product

    Tim Lomas
    #41145

    Hi Tim, you can list events for a given user with the following:

    [eo_events author=123]
    

    You can leverage that by creating a shortcode which invokes the above above, injecting the current user ID.

    This isn’t properly testing (and you might want to handle the case when the user is not logged-in), but here’s an example:

    <?php
    
    add_shortcode( 'current_user_event', function(){
        return do_shortcode(sprintf("[eo_events author=%d]", get_current_user_id()));
    } );
    
    Stephen Harris
Viewing 2 posts - 1 through 2 (of 2 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.