Event Status Determined by Role?

Home Forums Calendar Products Community Events Event Status Determined by Role?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1395556
    Antar Howarth
    Participant

    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

    #1396713
    Andras
    Keymaster

    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

    #1399188
    Andras
    Keymaster

    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

    #1399193
    Antar Howarth
    Participant

    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

    #1399201
    Andras
    Keymaster

    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.

    https://gist.github.com/andrasguseo/dc41114506ad261001b3eaf980ba580e

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

    Let me know how that works out.

    Cheers,
    Andras

    #1399204
    Antar Howarth
    Participant

    Andras –

    Brilliant. Thank you!

    :0)

    Antar

    #1399858
    Andras
    Keymaster

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

    A.

    #1413970
    Support Droid
    Keymaster

    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

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Event Status Determined by Role?’ is closed to new replies.