Using Author to filter calendar and in event list

WordPress Event Management, Calendars & Registration Forums Frontend Submissions Using Author to filter calendar and in event list

This topic contains 3 replies, has 2 voices, and was last updated by  Stephen Harris 7 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #26893

    This is likely a pretty straightforward question, but one I’ve been unable to piece together in reading through this support forum. I am using FES and would like to …
    1.) Display the full event calendar using [eo_fullcalendar] showing only events submitted by the currently logged-in user (i.e. author) … or alternatively provide ‘author’ (who is also the organiser) as a drop-down filter above the calendar
    2.) Display a list of events (using [eo_events]) with the ‘author’ (who is also the organiser) as a placeholder … e.g. [eo_events %event_title% %event_venue% %author%]

    If the solution requires editing of templates, php files, etc,, please advise as to where these are located and best approach for doing this.

    Thank you. Great plugin .. love the flexibility!

    Mark Welsh
    #26898

    Hi Mark,

    You can provide a calendar showing events by a specific author, via

     [eo_fullcalendar author=123]
    

    where 123 is the IDof the author. If you want to have that dynamically set (to the ID of the current user), then you will need to register your own shortcode: https://wp-event-organiser.com/blog/tutorial/creating-your-own-shortcodes/

    E.g.

    add_shortcode( 'current_users_calendar', function( $atts, $content = null ){
       if ( is_user_logged_in() ) {
          return do_shortcode( sprintf( '[eo_fullcalendar author=%d]', get_current_user_id() ) );
       }
    });
    

    And then [current_users_calendar] (obvisously it doesn’t accept any attributes like [eo_fullcalendar] you can pass them on – they’ll be in the $atts array – or you can hard-code them.

    For (2) you will need to edit the event list shortcode (or widget) template. These can be found in the templates/ directory (copy it to your theme first).

    To get the author’s name:

    $author_id = get_the_author_meta( 'ID' );
    $user = get_user_by( 'ID', $author_id ); //WP_User object
    

    or to get their display name:

     $display_name = get_the_author();
    
    Stephen Harris
    #26901

    Thanks Stephen … That is extremely helpful. Just about ready launch a new feature leveraging Event Organiser, but have one more question …

    Can I use one Event Submission Form for logged-in users to create an Event and another (different) Event Submission Form for the same user to edit their Event?

    I need to do some steps in the Admin Panel to customize each Event after first submitted so I want to have the ‘Event Status” set to “Require admin approval”, but then allow subsequent updates by the user to be “Publish automatically”.

    Thanks Stephen!

    Mark Welsh
    #26904

    No you can’t, but edited events retain their original status – they don’t require admin approval each time.

    Stephen Harris
Viewing 4 posts - 1 through 4 (of 4 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.