Hi,
Depending on the theme you use (regular WordPress theme, BP Default or a child of it, or a standalone BuddyPress theme), you can override some templates to achieve your goal.
Have a look at the codex starting with this page : https://codex.buddypress.org/themes/theme-compatibility-1-7/a-quick-look-at-1-7-theme-compatibility/
If it’s a regular WordPress theme, then you can can add a buddypress
folder in it and copy these templates into it respecting the ‘tree’ :
– bp-templates/bp-legacy/buddypress/activity/index.php
– bp-templates/bp-legacy/buddypress/members/single/activity.php
Once done, you should have :
– yourthemefolder/buddypress/activity/index.php
– yourthemefolder/buddypress/members/single/activity.php
Then into these two files search for bp_get_template_part( 'activity/post-form' );
and you should see a line above an if statement containing is_user_logged_in()...
. Replace is_user_logged_in()
by bp_current_user_can( 'theminimumcapability' )
where theminimumcapability is the the role capability you’re targeting. See the WordPress codex to define it : https://codex.wordpress.org/Roles_and_Capabilities
Thanks for the reply.
Can this also be done with multiple user roles? Say if I have 4 types of user roles that can use the Activities page and I code it like [bp_current_user_can( ‘Role1’, ‘Role2’, ‘Role3’, ‘Role3’, ‘Role4’) ], Will that work? Or do I only need the minimum role level inserted?
Thanks again for the helpful tip
No. You’ll need to add a common capability to the roles you are targeting, see
https://codex.wordpress.org/Function_Reference/add_cap
Thanks for the help. It works perfectly.
I did misunderstood it at first. But also didn’t read it properly.
Thanks again.