function subscriptions_ui_get_permission_to_handle in Subscriptions 5.2
Same name and namespace in other branches
- 6 subscriptions_ui.module \subscriptions_ui_get_permission_to_handle()
- 7 subscriptions_ui.module \subscriptions_ui_get_permission_to_handle()
- 2.0.x subscriptions_ui/subscriptions_ui.module \subscriptions_ui_get_permission_to_handle()
Ask for permission to display the subscriptions interface for the given node.
This should be used as follows: if (module_invoke('subscriptions_ui', 'get_permission_to_handle', $nid, 'mymodule') !== FALSE) { my_module_display_interface($nid); } and mymodule needs to implement hook_subscriptions_ui(), see below.
File
- ./
subscriptions_ui.module, line 358 - Provides a user interface for Subscriptions.
Code
function subscriptions_ui_get_permission_to_handle($nid, $module) {
if (subscriptions_node_is_blocked($nid) || !user_access('subscribe to content')) {
return FALSE;
}
static $permissions = array();
if (empty($permissions[$nid])) {
foreach (module_implements('subscriptions_ui') as $m) {
$perm = module_invoke($m, 'subscriptions_ui', $nid);
if (empty($permissions[$nid]) || $permissions[$nid]['priority'] < $perm['priority']) {
$permissions[$nid] = $perm;
}
}
}
return $permissions[$nid]['module'] == $module;
}