function og_subgroups_mask_group in Subgroups for Organic groups 6
Mask a group title based on og privacy and node status
If the group is unpublished, and the current user can't view it, the title will be changed to <Hidden>.
If the group is private, and the current user is not a member, the title will be changed to <Private>
If $member is TRUE, and the current user is not a member, regardless of privacy options, the title will be changed to <Private>
Parameters
&$group: The group object
$member: If TRUE, the user must be a member of the group in order to not have it masked, otherwise the user only has to be a member if the group is private
Return value
TRUE if the group title was masked, otherwise FALSE
7 calls to og_subgroups_mask_group()
- og_subgroups_group_select_options in includes/
form.inc - Create form select options for the subgroup selector
- og_subgroups_hs_hierarchical_select_children in modules/
og_subgroups_hs/ og_subgroups_hs.module - Implementation of hook_hierarchical_select_children().
- og_subgroups_hs_hierarchical_select_root_level in modules/
og_subgroups_hs/ og_subgroups_hs.module - Implementation of hook_hierarchical_select_root_level().
- og_subgroups_prop_propagate_content in modules/
og_subgroups_prop/ og_subgroups_prop.module - Propagates content along the subgroups tree.
- theme_og_subgroups_menu_tree_link in includes/
theme.inc - Theme callback to output a link for a group tree
File
- ./
og_subgroups.module, line 393 - Maintains a hierarchy of groups created by the orgainc groups module.
Code
function og_subgroups_mask_group(&$group, $member = FALSE) {
$title = '';
// If the user can administer nodes, no access checking needed
if (!user_access('administer nodes')) {
// If the group is unpublished, or the user can't view content, hide it
if (!$group->status || !user_access('access content')) {
$title = '<' . t('Hidden') . '>';
}
else {
if ($group->og_private || $member) {
// If the user is not a member, hide it
if (!og_is_group_member($group->nid)) {
$title = '<' . t('Private') . '>';
}
}
}
}
// See if we've specified a new title
if ($title) {
$group->title = $title;
return TRUE;
}
return FALSE;
}