Option – This is a notice to all users
is it possible to grant the permission send a notice to all users for a new role called “trainer”: http://fs5.directupload.net/images/160217/qv6i4jy3.jpg
As I found out its just possible for an admin.
I use the plugin “members” to manage roles. Is there a special Capability?
Any way to do so? Any hacks or workarounds?
Many thanks in advance!
Create a template overload of this file:
Adjust the conditional that shows the checkbox so that the ‘trainer’ role is allowed.
i changed “bp_moderate” to “create_users” at line 29 in compose.php
as I set this for the trainer role too:
<?php if ( bp_current_user_can( 'create_users' ) ) : ?> <p><label for="send-notice"><input type="checkbox" id="send-notice" name="send-notice" value="1" /> <?php _e( "This is a notice to all users.", "buddypress" ); ?></label></p> <?php endif; ?>
The changes works and the option field “send a notice to all users” displays also for trainers with capability “create_users”.
BUT they can’t send notices at all/ still miss the capability and also don’t have the “notices” menu in the buddypress profil.
An Error Message appears when they try to send message as site wide notice: “Notice was not created. Please try again.”
What else do I have to change? I looked at other php files around there but didn’t find a solution. Can you help me out? Thx!
The function that sends notices
has a hard-coded check for bp_moderate:
bp_current_user_can( 'bp_moderate' )
By default, ‘bp_moderate’ is only assigned to site admins.
Did you try giving the
bp_moderatecapability to trainers?
create_usersis a very powerful capability, perhaps unsuitable for a role other than site admin.
Hi thx for your fast reply.
Ok I would like to try it the other way round.
I use the plugin Members to set capabilities and create new roles e.g. “trainer”. I tried to to add “bp_moderate” as a custom capability – buddypress capabilities are not listed there – but it didn’t work. Is the name wrong? Or is there no option to add this capability? As I read after some search here that buddypress have no connections to normal wp roles or capabilities.
Or what did you mean?
bp_moderateis obviously added in the list (in the plugin members) and granted to trainers but it doesn’t affect the site wide notices (still disabled).
The only thing who seems to affect it is the capability
manage_optionsbut I wouldn’t like to grant them to trainers.
// Only users that can 'manage_options' on this site can 'bp_moderate'
So try adding that cap to trainers.
You could also write a function that also uses the
map_meta_caphook, but with a larger number re priority so that it runs after the function noted above.
Yes, when I grant the Trainer role the
manage_optionscapability it works – but I won’t like to use this option.
I can’t override bp-core-caps.php and change
'manage_options' to e.g. 'create_users'right?
You could also write a function that also uses the map_meta_cap hook, but with a larger number re priority so that it runs after the function noted above.
– sorry I didn’t get this. My knowledge of coding is near zero
@shanebp: any ideas?
Can not be that no one previously had that problem :DD
Nobody who use this feature for roles besides admin?
Any other ideas how can I solve my request?
I wouldn’t prefere to install another plugin for site wide notices, because I really like this option from buddypress combining popup/ widget and notices in the message inbox 🙂
It’s only that admins can use it right now.
- You must be logged in to reply to this topic.