Community Events Publish Permissions by Role

Home Forums Calendar Products Community Events Community Events Publish Permissions by Role

  • This topic has 9 replies, 2 voices, and was last updated 7 years ago by Marianne.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1254606
    Marianne
    Participant

    My calendar is public and I want anyone to be able to submit an event to add. BUT I want the default to be pending EXCEPT for my premium users.

    Can I define user permissions based on role to enable my premium users to be able to publish directly to the calendar while all other users submissions will need approval?

    I have been looking through past discussions for a few days and will continue to search. Thank you.

    #1255050
    Andras
    Keymaster

    Hello Marianne,

    Thanks for using our plugins and welcome to the forums!

    A great question you have there. Unfortunately that is not possible out of the box with our plugins.

    It most probably can be done with some custom development, but it would take knowledge in php and html to do it.

    I am able to answer some questions to help you get started on a customization, but for the most part that is beyond the support we can provide.

    I can also share with you a list of developers who could help you with this. They are well known in the community and are not affiliated with us:

    list of freelancers

    Let me know if you have any follow up questions.

    Thanks and cheers,
    Andras

    #1255057
    Marianne
    Participant

    AndrĂ s, thank you for your reply. Hmmm, though. Not thrilled about that…

    Let me spitball something for you and tell me if you think it could work, ok?

    What if I create a duplicate of the Community Events plugin/addon and call it/register it as something like “Community Events Premium” so as not to directly conflict with the original. Then I could set it up with publish permissions and make my premium users redirect to that page.

    I know it sounds a little sloppy but could that work?

    Otherwise, could you outline how I might start to achieve this? Help me get started on customization, etc.

    #1255092
    Andras
    Keymaster

    Hello again,

    Had some discussions with the team on this. Generally that approach is not recommended. I believe you would need to do major modifications to the plugins (at least replacing class names and so) and you would need to do that with every plugin update.

    So this is what I rather got for you:

    “she’d be far better off to do some (much smaller) custom dev work that modifies the default post status according to whether the user is ‘premium’ or not. […] a simple usage of the tribe_get_single_option filter hook would get them on track here”

    There is “an option that they configure that makes it work in one of those two methods.” (Events > Settings > Community tab > Allow anonymous submissions)

    “at which point, she could filter that option and have it return a different value for premium users.”

    Does this help, Marianne?

    Andras

    #1255110
    Marianne
    Participant

    Thank you for kicking around the idea. It sounds like it could work for me. If/when I am successful should I share that info here?

    I will look into this now and get back to you soon.

    #1256012
    Andras
    Keymaster

    Yes, please share the idea here, this would be useful for other users as well. Much appreciated!

    I’ll leave the thread open. (It is automatically closed after 3 or 4 weeks of inactivity.)

    Thanks and cheers,
    Andras

    #1256996
    Marianne
    Participant

    I am having some issues yet. I feel like I am close-ish but am pretty sure I’m not.

    I wasn’t able to find much documentation or samples of the filter hook ‘tribe_get_single_option’, but ‘tribe_get_option’ is a thing… not that I was really able to get anywhere with that method.

    Anyway, I configured the logic within the theme itself to detect user role. And I am able to configure a call to return the default value (see below), but I do not know how to overwrite it. When I look through the file where it is defined, all of the definitions are ‘protected’.

    echo tribe( 'community.main' )->getOption( 'defaultStatus' );

    Any further insight here? Thanks.

    #1258027
    Andras
    Keymaster

    Hi Marianne,

    I teammate of mine dropped this outline, which might help

    function ce_modify_default_status_per_user( $value, $name ) {
    // Only interfere if the 'defaultStatus' is being requested
    if ( 'defaultStatus' !== $name ) {
    return $value;
    }
    
    // Only modify if the user has a certain status: fix this check to
    // whatever makes sense in your case
    if ( current_user_can( 'do_premium_things' ) ) {
    $value = 'publish';
    }
    
    return $value;
    }
    
    add_filter( 'tribe_get_single_option', 'ce_modify_default_status_per_user', 10, 2 );

    Obviously this is a very rough outline, which you will need to adjust to your needs.

    I can try to answer some more questions, but have little else beyond what we have already provided.

    Cheers,
    Andras

    #1269526
    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 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Community Events Publish Permissions by Role’ is closed to new replies.