Help Desk

Event Status Determined by Role?

  • Posts: 4 Topics: 5
    | Permalink

    Is it possible to set the initial status of a submitted event by the user’s role?

    I am using the Community Events plugin on a real community website which has lots of users. Most users have the “Subscriber” role – but regular contributors are “Editors”. I want submissions from Editors to be published immediately – whilst anything posted by a Subscriber would be a draft.

    It seems a simple proposal. Is it possible?

    Antar

    Posts: 6966 Topics: 2
    | Permalink

    Hey Antar,

    Thanks for reaching out! Great question!!!

    I believe it should be possible. Please note we are limited in providing and supporting customizations as per our support policy. I will still check with the team if anyone has an idea about this. Might take a couple of days.

    Thanks for your patience!

    Cheers,
    Andras

    Posts: 6966 Topics: 2
    | Permalink

    Hello Antar,

    Thanks for your patience!

    I colleague of mine shared the following idea / snippet:

    function tribe_community_set_event_status ( $event_id ) {
        // post status to set the event to
        $post_status = 'draft';
        $args = array(
            'ID' => $event_id,
            'post_status' => $post_status,
        );
        wp_update_post( $args );
    }
    add_action( 'tribe_community_event_created', 'tribe_community_set_event_status' );

    This should get them started. It sets the status of a community submitted event to draft, when it’s submitted. It will still need the necessary conditionals to check for the user role / capabilities and to set the status accordingly.

    Let me know how this works out.

    Cheers,
    Andras

    Posts: 4 Topics: 5
    | Permalink

    Hi, Andras –

    Thank you for your support. Unfortunately, I do not know how (or if) this helps with my original question! If you recall, I want events from “Editors” to be published immediately – but events from “Subscribers” saved as drafts.

    How do I use your code to achieve this?

    :0/

    Antar

    Posts: 6966 Topics: 2
    | Permalink

    Hi Antar,

    Doing customizations like this is way beyond the scope of our support that we provide.

    However, I had couple minutes do I cooked this up for you.

    Please note, that it hasn’t been tested, but it should do the trick.

    Let me know how that works out.

    Cheers,
    Andras

    Posts: 4 Topics: 5
    | Permalink

    Andras –

    Brilliant. Thank you!

    :0)

    Antar

    Posts: 6966 Topics: 2
    | Permalink

    Let me know if it works, and if we can close this thread. Thanks!

    A.

    Posts: 65
    | Permalink

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

    | Permalink

The topic ‘Event Status Determined by Role?’ is closed to new replies.