• Resolved tammo59

    (@tammo59)


    We need to give people with a custom role the permission to edit earlier published events.

    So they still need to have their events published by the editor, but after that they should be able to change the event.

    We have a community of many people that develop events. After publishing sometimes (quite often actually) details may change and we want this to be done without going through the publish-loop.

    Using Capablity Manager enhanced it is possible to change this into the needed behaviour for Posts and Pages, but not for Events, Recurring Events and Locations.

    Is there a workaround for that?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi Tammo,
    EM has its own user capabilities in the settings.

    “edit_other_events” is what you want to assign, but not “publish_events”. Then they can edit, but not create new ones.

    You see, sometimes third-party plugins are even not necessary with EM ?? LOL.

    Thread Starter tammo59

    (@tammo59)

    Hi Patrick, thank you for looking into this, what you said is also what I hoped, but in my installation this does not work.

    With “edit_other_events” contributors can edit all events, but when saved they fall back to the publishing status: “pending review”. And that is what I wanted to avoid, because then an editor has to publish again.

    • This reply was modified 5 years, 10 months ago by tammo59.
    • This reply was modified 5 years, 10 months ago by tammo59.
    Plugin Support angelo_nwl

    (@angelo_nwl)

    you can try to enable ‘publish_events’ user capabilities.

    Thread Starter tammo59

    (@tammo59)

    Hi Angelo, I would like to do that, but then these people can publish new events. I only want them to be able to edit already published events, without an editor having to review this.

    Hello,

    “edit_other_events” is what you needed, Permission to “Edit” and “Publish” is two different permissions with WP. It would default to “Pending Review” if you haven’t enabled the “publish_events” Capability. There is no Capability for WordPress that would only allow them to edit certain events.

    That’s what I said as well, already, @timrv

    @tammo59,
    You could do some custom coding using the post_updated action hook.
    (See: https://codex.www.ads-software.com/Plugin_API/Action_Reference/post_updated)

    I have not tested this for you yet, but something like this should work:

    function keep_events_published($post_id, $post_after, $post_before) {
    	if( $post_before->post_type === 'event' && $post_after->post_status === 'pending' && $post_before->post_status === 'publish' ) {
    		$EM_Event = em_get_event($post_id, 'post_id');
    		$EM_Event->_force_status = 'publish';
    		$EM_Event->save();
    	}
    	return;
    }
    add_action('post_updated', 'keep_events_published', 10, 3);

    You might want to build-in some extra conditions, because this will keep any event ever going from “publish” to “pending”. So, once published, stays published (unless trashed, of course. Haha).

    Thread Starter tammo59

    (@tammo59)

    Thank you all, this helps. Even with some code. Great.

    Tammo

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Permission to edit already published events’ is closed to new replies.