Drupal Organic Groups
close

on 10th August 2015 / by jimmy.sebastian
In one of my Drupal project, we had a requirement to set a 2 level arrangement for users group. That means, we want to add more than one group for a user, in one of our Drupal site. Our experts find a solution for this by implementing Organic Group with user's account by some custom codes. Do you have a requirement like this? Connect with us. Organic Group(OG) is a powerful and useful module in Drupal. We can create groups using OG and also assign users to them. OG module saves the custom additions to the users object into the database. OG membership entity that links users and content/entity to their associated group also. If you want to assign a user to different groups, then you can use the following codes. //Sample group definition. $groups = array("Group A", "Group B", "Group C",...); global $user; $uid = $user->uid; $account = user_load($uid); foreach($groups as $group_id) { og_group('node', $group_id, array( "entity type" => "user", "entity" => $account, "membership type" => OG_MEMBERSHIP_TYPE_DEFAULT, )); }The 'og_get_groups_by_user' function can be used for getting user's group. We get all the groups that a user belongs to by passing the user membership object. This can be executed by using the following codes. function module_name_get_user_groups() { global $user; $uid = $user->uid; $account = user_load($uid); $group_ids = og_get_groups_by_user($account); }Note that, select Organic Groups field settings in OG administration page for adding the special Organic Groups fields. Have fun, lets read OG related articles from here. Do you have any more queries like this? Just type over here. Drupal 7 Drupal Organic Groups Leave a reply Your email address will not be published. Required fields are marker *
close

on 30th July 2015 / by vinod
Organic Groups module is a powerful and useful module in Drupal. This module is used to create groups, add members to it, and to share content and comments. OG also has advanced access management through permissions and roles. The Organic Groups module for Drupal 7 is entirely different from Drupal 6. The following documentation is intended for Organic Groups Version 7.x-2.x. Get more details on resolved issues related to Drupal module configurations here. In order to install OG, we need to install and enable the following modules. Organic Groups modules Entity API Entity reference CTools Views Bulk Operations Creating a Group Type After installing the above modules, the next step is to create a group type. For creating a group type Navigate to Structure > Content Types > Add Content Types Add the name for group type and other data. Select the Group checkbox under Organic Groups tab Click Save Content Type Navigate to Configuration > Organic Groups > Organic groups field settings for adding extra fields for the created group type. (Optional) By navigating to Configure > OG Groups > OG roles overview, we can manage the roles of the created group type. In Configure > OG Groups > OG permissions overview, we can manage the permissions for the group type. Creating a Group Content Type After creating a Group Type, a content type needs to be designated as group content. This can be done either by editing the existing content types like article or by creating a new content type as follows. Navigate to Structure > Content Types > Add Content Types Add the name for group content type and other data. Select the Group content check-box under Organic Groups tab. Click Save Content Type Creating a Group. Creating a group is same as creating a node. Navigate to Content > Add Content > 'Group Name' Enter necessary data and click save. In the result view, we can see a Group tab where we can modify permissions, add members and manage members. Creating a Group Content. Once a group is created, we have to add contents to that group. For adding contents to a group Navigate to Content > Add Content > 'Group Content Name'. Enter the title for the content Select the group audiences. (The group to which this content belongs to). Enter the body. Click Save. Please feel free to share your thoughts and queries regarding this here. Drupal Organic Groups Drupal 7 Drupal Planet Leave a reply Your email address will not be published. Required fields are marker *
close

on 18th March 2015 / by sarika.k
Organic groups module (og module) enables users to create their own groups and manage these groups. The Organic Groups module, provides user the ability to create, manage, and delete their own 'groups' on a site. Each group can have members, and maintains a group home page which individual group members may post into.Group membership can be open, closed or moderated. A group entity is the parent for all the things that belong to a group. Users and content are the two kinds of entities that can belong to a group. Each piece of content and each user is connected to the group with an additional entity. The entity is a special OG membership entity that links users and content to their associated group.It is simply a record in a table that tracks which entities belong to which groups. Modules required Organic Groups modules CTools Entity API Entity reference Views Bulk Operations Configuration Install Drupal organic groups module and follow the steps click to set up organic group. To add the special Organic Groups fields, we need to go to the Organic Groups administration section. Home » Administration » Configuration » Organic groups » Organic Groups field settings. To add the special Organic Groups fields, we need to go to the Organic Groups administration section. Home » Administration » Configuration » Organic groups » Organic Groups field settings. Select an entity/bundle and then choose the fields that need to be added to it . The available fields are sub-divided by group and group content, to indicate which fields can be added to the group entity and which belong on the group content entities. To add a field to a content type select the content type in the top and the field in the bottom and click on Add field. Group Audience :Group Audience field will keep track of which groups a user belongs to. Group Visibility :If we want to have the possibility of private groups, we can add the Group Visibility field to the group. Group roles and permissions : If we want to have per-group permissions that override the global roles and permissions we can add the Group roles and permissions field to the group entity type. The group content entities get different fields. They need a Group audience field and perhaps a Group visibility field (to let authors choose if the content is publicly visible). Users entity gets the same Group audience field that group content gets. This is the field that will keep track of which groups a user belongs to. When the fields are all set up, you can select an entity and see which fields have been assigned to it. Drupal Drupal Organic Groups Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 19th January 2015 / by emily.mathew
There are situations where we need organic groups membership entity ID. Some of situations are : we use the function og_membership_delete() when we want to remove programmatically a user or node or any group content from our group, which will require parameter that is organic groups membership entity ID. Also when come across og_membership_load() function to get the entire organic groups membership object, which will also require OG membership entity ID as parameter. So in these situations how can we get organic groups membership object membership entity ID. See the following function I have written to retrieve the organic groups membership object membership entity Id. /** * Get OG membership entity ID. * * @param int $gid. * The Organic group ID. * @param int $etid. * The entity ID of the group content. * @param string $entity_type. * The entity type of the group content. * * @return int. * The OG membership entity ID. */ function my_module_get_og_membership_entity_id($gid, $etid, $entity_type) { $result = db_query("SELECT og.id FROM {og_membership} og WHERE og.gid=:gid AND og.etid=:etid AND og.entity_type=:entity_type", array( ':gid' => $gid, ':etid' => $etid, ':entity_type' => $entity_type, ) ); $entity_exists = $result->rowCount(); if ($entity_exists) { foreach ($result as $record) { return $record->id; } } return FALSE; } The above function will return the OG membership entity ID, if there exists any og membership entity with the parameters passed, otherwise returns FALSE. Drupal Drupal 7 Drupal Organic Groups Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 13th January 2015 / by sarath.mohan
Organic Group Module in Drupal allows to create and manage different groups. While creating a content, we can add that content to a group. The og_group() function allows to add a content to a group. The parameters of the function og_group() includes the following: First parameter is the entity type of the group. Second parameter is the group id. Third parameter is an array of imformation including 'entity_type' can be node, user etc., 'entity' which is the corresponding entity id, and the 'field_name', which specifies the name of the field that holds the group id. Fourth parameter can be true or false, which specifies whether a new membership should be saved or not. The following is a function that creates a new node of type "group_content" and adds the content to a group. language = 'und'; $new_node->type = 'group_content'; // Set created user $new_node->uid = $user->uid; $new_node->title = t('Group Content'); $new_node->body = t("Sample body"); $new_node->status = 1; // Saving the node. node_save($new_node); $values = array( 'entity_type' => 'node', 'entity' => $new_node->nid, 'state' => OG_STATE_ACTIVE, 'membership_type' => OG_MEMBERSHIP_TYPE_DEFAULT, 'field_name' => 'og_group_ref' ); // Add the new content to a group called "Group1" with id "100" $group_id = 100; og_group('node', $group_id, $values); } ?> In this example, it creates a new node and adds the node to a group of id 100. Drupal Drupal 7 Drupal Organic Groups Leave a reply Your email address will not be published. Required fields are marker *
close

on 06th June 2013 / by uttam.kotekar
Drupal 7's version of Organic group is totally rewritten by taking the advantage of many new Drupal 7 features, especially entity and field APIs. One of the major difference between drupal OG-6 and OG-7 is the expansion of the concept of what a 'group' is. In Drupal 7, any type of entity can be a group and any type of entity can belong to a group. The organic groups module allows us to create a working group where a number of people can create content which is non-public and it is visible to group members only. In this article we are going to address the issue how to set up an organic group in drupal 7. Dependencies Organic Groups modules CTools Entity API Entity reference Views Bulk Operations Enable "Organic Groups", "Organic Groups Context", "Organic Groups Register" and "Organic Groups UI". After that, follow the below steps: Step1 : Create a Group node To create a basic "Group node", create a new content type called "Group Node" by navigating to Structure -> Content Types -> Add Content Type. In the Organic Groups settings area, assign this content type to "Group Node" and save. You can decide if your group should be listed on the 'groups' homepage. Modify other settings as you wish and Save Content Type The reason behind why we are creating a content type is because Organic group requires a lot of flexibility which content types prvides, as they allows different types of group types. Step2 : Create a Group post To create a "Group post", create a new content type called "Group Post" by navigating to Structure -> Content Types -> Add Content Type. Under tab "Group", the "Group" radio button should remain "Not a group type", and the "Group Content" should be "Group Content Type". You can select the group audience among you groups. Modify other settings as you wish and Save Content Type This is the basic setup of Organic Groups. Every user can now create a group if they have the permissions to create content of those content types. Drupal 7 Drupal Organic Groups Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 28th February 2013 / by webmaster
A number of Drupal users using the Drupal Organic Gropus module reported that they could not see groups that they belong to and also the groups the administrator belonged to. If you are facing the same issue with Drupal Organic Groups in your Drupal site then read on to find out the fix. Here is the most successful fix reported by many Drupal users. According to them, this issue was caused by a conflict with other Organic Groups modules. Disable all your other Organic group modules from your website and this should have enabled you to see the groups that you belong to. Hope that helps. The easiest way to solve a Drupal issue is to hand it to the Drupal experts. We can provide a wide range of Drupal services to help you maintain and manage your Drupal websites. Get in touch with us to know more. Reference: http://drupal.org/node/1885292 Drupal Drupal 7 Drupal Issues Drupal Organic Groups Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 28th February 2013 / by webmaster
A large number of Drupal users using the Drupal Organic Groups module in their Drupal site wanted to know how to hide the Organic Group field from the users directly. If you are facing the same question in your Drupal site and would like to know how to hide the Organic Group field from your users then read on to find out the solution. Here is the solution suggested by a Drupal user. You can configure Organic Groups to be transparent to your group members by using the Entityreference prepopulate module First enable the Entityreference Prepopulate module Next proceed to your group content entity and edit the group membership field Next enable 'Enable reference prepopulate under Additional behaviors After doing the above select'Action: Hide Field' 'Apply action on edit' Finally you need to create links to create new content that has the prepopulate data in the URL It shoud be of the formatform: node/add?og_group_ref=GROUP_NODE_ID Hope that helps. The easiest way to solve a Drupal issue is to hand it to the Drupal experts. We can provide a wide range of Drupal services to help you maintain and manage your Drupal websites. Get in touch with us to know more. Reference: http://drupal.org/node/1895578 Drupal Drupal 7 Drupal Issues Drupal Organic Groups Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 27th February 2013 / by webmaster
A Drupal user using Drupal Organic Groups wanted to know how to show the block on every page that belongs to Organic Groups. Presently the block was only visible in the start page of the blocks. If you are facing the same question in your Drupal site with Drupal organic groups then read on to find out the solution. Here is the solution suggested by a Drupal user. The solutions is to use the following code segment along with PHP block visibility settings. Hope that helps. The easiest way to solve a Drupal issue is to hand it to the Drupal experts. We can provide a wide range of Drupal services to help you maintain and manage your Drupal websites. Get in touch with us to know more. Reference: http://drupal.org/node/1894438 Drupal Drupal 6 Drupal Issues Drupal Organic Groups Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 27th February 2013 / by webmaster
A few Drupal users want to know how to check if a user is a member of an Organic Group via code. If you are facing the same question in your Drupal site with Drupal Organic Groups and would like to know the solution then read on to find out more. Here is the solution. Use the following code segment to know if a user is a member of an organic group. og_is_member()Hope that helps. The easiest way to solve a Drupal issue is to hand it to the Drupal experts. We can provide a wide range of Drupal services to help you maintain and manage your Drupal websites. Get in touch with us to know more. Reference: http://drupal.org/node/1905834 Drupal Drupal 7 Drupal Issues Drupal Organic Groups Leave a reply Your email address will not be published. Required fields are marker *