use additional fields in community add-on to make event private
-
I’m using the community add-on and have it configured to allow anonymous submissions.
I need to provide a way for my users to submit events and make them either public or private automatically based on their “add an event” form submission. This means I need it to work without having to have a wordpress account to do so, and without having to have an admin moderate events submissions before they go live on the site.
To do this, I created an additional field with a radio button for users to define if they want their event to be public or private. I’d like to use this info to set the event post itself to private or published.
What’s the best way to connect these together?Hi – great question!
You could listen out for the creation of events (or even for them being updated) by using WordPress’s save_post_{post_type} hook, in this case that would look like:
save_post_tribe_events
From there you would need some logic to test and see if the user’s intent was to make it private or not – possibly by inspecting the $_POST superglobal (you may also want to add some other safety checks into the mix) and then update the post status accordingly.
It’s a bit beyond the scope of support here on the forum to go much further with a customization like this one but hopefully that outlines the basic mechanics – from here we’ll need to leave the rest to you 🙂
The topic ‘use additional fields in community add-on to make event private’ is closed to new replies.