Event Admin view show events that are feeds ?

WordPress Event Management, Calendars & Registration Forums iCal Extension Event Admin view show events that are feeds ?

This topic contains 1 reply, has 2 voices, and was last updated by  Stephen Harris 1 day, 14 hours ago.

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

    In the admin area for events ,when viewing ‘All events’ , is there a way to show what events are from a feed and what events have been created locally ?

    andytc
    #36354

    Hi Andy,

    Events imported by a feed have the _eventorganiser_feed meta data.

    So you could, for example, disable editing of those events as shown:

    add_filter( 'map_meta_cap', function($primaryCaps, $cap, $userId, $args){
    
        if( 'edit_event' !== $cap ) {
            return $primaryCaps;
        }
    
        if(get_post_meta($args[0], '_eventorganiser_feed', true)){
            $primaryCaps[] = 'do_not_allow';
        }
    
        return $primaryCaps;
    
    
    }, 999, 4 );
    

    Or add something to the title:

    add_filter('the_title', function($title, $id){
    
       if( 'event' !== get_post_type($id) || !is_admin()) {
         return $title;
       }
    
       $current_screen = get_current_screen();
    
       if( $current_screen->id === "edit-event" && get_post_meta($id, '_eventorganiser_feed', true) ) {
          $title = $title. ' (imported)';
       }
    
       return $title;
    }, 10, 2);
    
    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.