%s', \esc_url( $post->guid ), \esc_html__( 'Open original page', 'event-bridge-for-activitypub' ) ); return $actions; } /** * Modify the user capabilities so that nobody can edit external events. * * @param array $caps Concerned user's capabilities. * @param array $cap Required primitive capabilities for the requested capability. * @param array $user_id The WordPress user ID. * @param array $args Additional args. * * @return array */ public static function disable_editing_for_external_events( $caps, $cap, $user_id, $args ) { if ( 'edit_post' === $cap && isset( $args[0] ) ) { $post_id = $args[0]; $post = get_post( $post_id ); if ( $post && Event_Sources::is_cached_external_event_post( $post ) ) { // Deny editing by returning 'do_not_allow'. return array( 'do_not_allow' ); } } return $caps; } }