Skip to:
Content
Pages
Categories
Search
Top
Bottom

update group activities just for admins


  • meisinotti
    Participant

    @meisinotti

    Hi!

    I want my members to become BuddyPress group members. That’s no problem so far.
    But I do not want them to update activities (send group posts). This should only be allowed for admins.

    How can I realize this?

Viewing 5 replies - 1 through 5 (of 5 total)

  • Nahum
    Participant

    @nahummadrid

    @meisinotti you can restrict the post form to admins depending on what template pack you use… you could set something like,

    with nouveau, /buddypress/activity/post.form.php, overload it child theme

    /*
     * Template tag to prepare the activity post form checks capability and enqueue needed scripts.
     */
    
    if(bp_is_group_activity() && current_user_can('administrator')) {
    
    bp_nouveau_before_activity_post_form();
    ?>
    
    <h2 class="bp-screen-reader-text"><?php echo esc_html_x( 'Post Update', 'heading', 'buddypress' ); ?></h2>
    
    <div id="bp-nouveau-activity-form" class="activity-update-form"></div>
    
    <?php
    /*
     * Template tag to load the Javascript templates of the Post form UI.
     */
    bp_nouveau_after_activity_post_form();
    }
    

    assuming you don’t allow users to create their own groups, if you want to allow them to post updates on their own created groups then you’d need to check for that.


    Nahum
    Participant

    @nahummadrid

    Edit timed out on me up there and didn’t get to revise my reply in time!

    /buddypress/activity/post.form.php, overload it child theme

    /*
     * Template tag to prepare the activity post form checks capability and enqueue needed scripts.
     */
    
    if( bp_is_group() && !current_user_can('administrator') ) {
    
    } else {
    
    bp_nouveau_before_activity_post_form();
    ?>
    
    <h2 class="bp-screen-reader-text"><?php echo esc_html_x( 'Post Update', 'heading', 'buddypress' ); ?></h2>
    
    <div id="bp-nouveau-activity-form" class="activity-update-form"></div>
    
    <?php
    /*
     * Template tag to load the Javascript templates of the Post form UI.
     */
    bp_nouveau_after_activity_post_form();
    
    }
    
    

    meisinotti
    Participant

    @meisinotti

    Thank you! I will give it a try.


    meisinotti
    Participant

    @meisinotti

    Thank you, it works great. But it turns out that I’d need an exception for a single group. Only in this one all members be allowed to post updates. Any ideas?


    wpwebdevil
    Participant

    @wpwebdevil

    Hi, I have the same issue.
    I want only Admin to be able to post new updates.
    Subscribers can only post comments.
    I am not using groups.
    I have tried your solutions above, but you’re not clear on exactly where to upload the file to.
    Btw – I can only find /wp-content/plugins/buddypress/bp-activity/actions/post.php

    Then I’m not sure if I should rebuild the folder structure in the child theme, or just put it in the root folder.
    Or if I should add your code at the bottom or overwrite the existing code.
    Your help will be invaluable.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar