function _pm_block_user_access in Privatemsg 7
Same name and namespace in other branches
- 6.2 pm_block_user/pm_block_user.module \_pm_block_user_access()
- 6 pm_block_user/pm_block_user.module \_pm_block_user_access()
- 7.2 pm_block_user/pm_block_user.module \_pm_block_user_access()
Provides access argument for blocking user menu item.
Parameters
$account: User object representing the account the menu item will block private messages from.
Return value
TRUE if the user is allowed to block $account, or FALSE if not.
1 string reference to '_pm_block_user_access'
- pm_block_user_menu in pm_block_user/
pm_block_user.module - Implements hook_menu().
File
- pm_block_user/
pm_block_user.module, line 179 - Allows users to block other users from sending them any messages
Code
function _pm_block_user_access($account) {
global $user;
if (!privatemsg_user_access('read privatemsg', $user)) {
return FALSE;
}
// Allow to unblock users that are already blocked but the user is now not
// allowed to block anymore.
if (_pm_block_user_rule_exists($account, $user, PM_BLOCK_USER_DISALLOW_BLOCKING) && !pm_block_user_has_blocked($account, $user)) {
return FALSE;
}
return TRUE;
}