Created
September 6, 2018 20:18
-
-
Save KaineLabs/868731c98eadeaa5651733a86d9a4adb to your computer and use it in GitHub Desktop.
Allow editors to send a messages to all users.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Allow editors to send a message to all users. | |
function yzc_allow_editors_to_send_notices( $retval ) { | |
// Get Current User Data. | |
$user = get_userdata( bp_displayed_user_id() ); | |
// Get Roles. | |
$roles = (array) $user->roles; | |
if ( bp_is_messages_component() && in_array( 'author', $roles ) ) { | |
return true; | |
} | |
return $retval; | |
} | |
add_filter( 'bp_current_user_can', 'yzc_allow_editors_to_send_notices' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment