Help Desk

use additional fields in community add-on to make event private

  • Posts: 34 Topics: 20
    | Permalink

    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?

    Posts: 18146 Topics: 17 Answers: 973
    | Permalink

    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 🙂

    Posts: 34 Topics: 20
    | Permalink

    Thanks for the guidance. Do you offer a paid support option to get more specifics ?

    Posts: 18146 Topics: 17 Answers: 973
    | Permalink

    I’m afraid we do not, but we’d be happy to provide you with a list of independent developers/freelancers who might be able to assist if you email us at pro (at) tri (dot) be.

    Thanks!