Home › Forums › Calendar Products › Community Events › Event Status Determined by Role?
- This topic has 8 replies, 2 voices, and was last updated 6 years, 4 months ago by Antar Howarth.
-
AuthorPosts
-
November 30, 2017 at 1:45 am #1395556Antar HowarthParticipant
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
December 1, 2017 at 8:46 am #1396713AndrasKeymasterHey 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,
AndrasDecember 6, 2017 at 12:16 am #1399188AndrasKeymasterHello 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,
AndrasDecember 6, 2017 at 12:38 am #1399193Antar HowarthParticipantHi, 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
December 6, 2017 at 1:02 am #1399201AndrasKeymasterHi 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,
AndrasDecember 6, 2017 at 1:12 am #1399204Antar HowarthParticipantAndras –
Brilliant. Thank you!
:0)
Antar
December 6, 2017 at 2:43 pm #1399858AndrasKeymasterLet me know if it works, and if we can close this thread. Thanks!
A.
December 28, 2017 at 8:35 am #1413970Support DroidKeymasterHey 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 -
AuthorPosts
- The topic ‘Event Status Determined by Role?’ is closed to new replies.