Organization Groups
The RedHen Organic Groups module provides
User Interface: path
Configuration: path
Set up a Views 3x block that displays Organic Group Node name on OG group content pages
I wanted to be able to display the group's name on their respective group content pages so the anonymous visitor would know where they were. I used Views 3x so the relationships and contextual filters may look different.
- Set up new View at admin/structure/views and create a Block display of Format Fields and leave the default at Content: Title
- Under Relationships add:
- OG membership: OG membership from Node (no need to require relationship)
- OG membership: Group Node from OG membership and select OG membership from node (no need to require this relationship)
- Under Contextual Fiters add:
- OG membership: Group ID - select OG membership from node for relationship
- When filter is not available - Provide default value () and select Current OG group from context
- OG membership: Group ID - select OG membership from node for relationship
- Under Fields select the Content:Title field
- Select Group node from OG membership
- Save your view and go to your blocks page and place the block where you would like it to display on the OG group content pages.
Using hooks to alter the groups audience field and user permissions
By default OG only allows group members with correct permissions to post and/or edit content associated with a group. It is, however, possible to change that behavior relatively easily using a couple of hooks:
Read moreOG Tasks Documentation
OG Tasks provides a mechanism to create tasks to be run for a group, either automatically on creation, or optionally once the group has been created.
Tasks are defined by way of a hook function, hook_og_tasks_info(). This function takes two parameters: $entity_type and $entity. Both of these parameters refer to the OG entity. The type is often "node" or "taxonomy_term", and the entity itself as an object is passed into the second param. They can be used to set up different tasks for different types of OG objects, for example.
The hook_og_tasks_info() function should return an array of og_tasks objects.
A typical hook_og_tasks_info function will look something like this:
<?php
/**
* Implements hook_og_tasks_info().
*/
function my_module_og_tasks_info($entity_type, $entity) {
$tasks = array();
$path = drupal_get_path('module', 'my_module');
// Navigation menu.
$tasks['menu'] = new og_task(array(
'title' => t('Create Navigation'),
'description' => t('Creating a menu that is associated to the site that will drive the navigation.'),
'required' => TRUE,
'callback' => 'my_module_og_task_create_menu',
'file' => $path . '/includes/menu.inc',
'completed' => my_module_has_menu($entity),
));
return $tasks;
}
?>OG role visibility documentation
Dependancies
This module is dependant of the organic goups module
Installation
To install just activate the og role visibility in the admin/modules page
Configuration
Advanced use cases
Flag Integration with the Message Module
This guide will show you how to get started on a system that allows users enable or disable messaging for their account. This is an intermediate to advanced guide, so I'll go as far as outlining the steps involved and go into detail on querying the database for users that have enabled a flag on their profile.
The dependencies for this to work are:
Flag
Message
Message Notify
Read the documentation to learn how to set up each of these modules.
The basic idea is as follows:
- Create User Flags (Messaging Enabled/Disabled, and Digest Mode Enabled/Disabled)
- In your message processing module/feature, query the database for enabled flags
- Act on the results of that query and send notifications with message notify