Questions tagged [group]

Use it for questions related to the Group module, not the Organic Groups module.

Filter by
Sorted by
Tagged with
1 vote
2 answers
702 views

Where in the MySQL database schema is the URL alias for a group relation?

I am building a report outside of Drupal that pulls data from a Drupal 8 database. The report shows titles of different nodes and I want to link those titles to the web page for that content. This ...
5 votes
3 answers
2k views

How to programmatically add content to a group in the Group Module?

I'm using the Group module. If I have a group type such as Project, and I have a content type such as Article, and I programmatically created a new article node using Node::create(), how can I in the ...
1 vote
2 answers
2k views

How to get the id of a group when using the Group module?

I'm using the Group module. How can I get the id of a group whose a user is a member (I have the user id)?
0 votes
1 answer
1k views

Filter a view by the Group ID of the current logged in user

I have been looking for an answer for 3 days with no success. Looks like this is a common requirement among plenty of Drupal 8 projects with not a single answer accross the internet about how is ...
0 votes
0 answers
31 views

View media with group permissions

I have a file media type and these files will be private files, with different access levels (1, 2 etc). What I need View page only for registered users, if the user has granted access level 1, the ...
0 votes
1 answer
433 views

Why is migration lookup failing during synchronisation of Group entities?

On the basis of an RSS feed, I am required to create Group entities and Users out of the feed's items. Each item contains sufficient data: <item> <id>123</id> <title>An ...
0 votes
0 answers
22 views

Group and Group content menu

I'm trying to display menu from Group page. All is ok with the module Group content menu. But when I'm trying to display the same menu on a subpage of the Group, there is no menu as if the context is ...
-2 votes
2 answers
177 views

How to migrate Group module from 2.0 to 3.0?

I am working on implementing the Group module on Drupal 9. The Release Notes describe moving from Group 2.0.x to 3.0.x as a 'Migration', which I take it is not just an upgrade that can be done using ...
1 vote
1 answer
49 views

Sub groups under groups

Anybody has idea about how we can have Sub Groups under Drupal Group? This module; https://www.drupal.org/project/group, will manage grouping of content, users.... perfectly. But we are looking to ...
1 vote
0 answers
45 views

List all groups of a user in one row as a multi-field

I want to list all the users and groups they are member of in one table, one row per user. I have a simple view that lists all users in the system. I added relation to group content membership and a &...
1 vote
1 answer
484 views

How to restrict group node access to a user/member of an group?

I am using the Group module and I have created a group called "Group-Y" and group type "Group-type-Y". I also defined a group role name "Admin". Added an member with role "Admin". I have checked this ...
0 votes
1 answer
351 views

Explicitly passing argument to local action for access check

I'm using the group module, and in a custom module I'm trying to create a local task that will bring you directly to the create page for a particular group content type. My goal is to skip the create ...
0 votes
0 answers
408 views

Upgrading to 8.8.0 Receive PluginNotFoundException: The "group" entity type does not exist

I'm updating from 8.7.4 to 8.8.0. After updating core/modules and running "/update.php", I receive the follow error: Drupal\Component\Plugin\Exception\PluginNotFoundException: The "...
1 vote
1 answer
95 views

Using group and rules modules to automatically create group for new user

I am using the Group (not OG ...) and rules modules for this task. I created group type, Applications Support. Then I created a rule, After saving a new user. Under the rule, I used the following ...
0 votes
1 answer
40 views

Disable content creation outside group context

I'm using the group module. I have a content type for which nodes should only ever exist as members of groups. Is there a sensible way to disable creation from /node/add/{content_type} so that nodes ...
0 votes
1 answer
95 views

How to pass group context to custom form page using group module

I have a custom block that is displayed within each group on every page. The block visibility is set to /league/* The custom block shows up fine for /league/{gid}, /league/{gid}/members, /league/{gid}/...
0 votes
1 answer
13 views

Page not found when viewing Group entities

I'm using the Group module and I've defined an "Organization" group type. When I create an entity of that type by going to /group/add and hit save, I get Page Not Found for the url /group/1. ...
0 votes
0 answers
579 views

How can I remove or rename tabs from the local tasks block?

I'm using Drupal 9.2.6 with Group module and I want to remove some tabs from local tasks block and rename some of them. I've created the module and placed above code with hook_menu_local_actions_alter ...
2 votes
1 answer
91 views

$group->addContent() in hook_node_insert() doesn't update the access permissions for the node

I have a content type with a field that lets the users decide which group to add the content to. The content is added to the group via hook_node_insert(). function tm_wiki_node_insert(NodeInterface $...
10 votes
3 answers
22k views

Programmatically get the results of a view

Using the group module in D8, I have the below view with machine name: group_members_per_group Machine Name of: (Member account) User: Full Name is: field_user_full_name (Member account) User: ...
0 votes
0 answers
126 views

Entity reference field dependant on other entity reference field

Drupal 9. I have a content type with two entity reference fields. The first entity reference field references group entities provided by the group module. The second entity reference field references ...
1 vote
1 answer
217 views

Is it possible to add an entity to the current route parameters?

Using \Drupal::routeMatch()->getParameter(), it's possible to fetch objects that come from the parameters of the URL. I'm wondering if it is possible to add values to the routeMatch. For example, ...
-2 votes
1 answer
49 views

Views Reference Field shows nodes of all groups

On my website users can create groups. All groups have two content types: Book Chapter (is always a child of content type Book) Only administrators are allowed to create new nodes. An administrator ...
2 votes
1 answer
2k views

Is it possible to check with Twig the role the current user has?

Is it possible to check with Twig the Group role the current user has, to use it as in the following code? {% if is_member == true %} {# … #} {% endif %} I tried with $group_memberships = \Drupal::...
2 votes
2 answers
957 views

Programmatically remove content from a group

In order to add a node to any group in Drupal 8, I use the following code. $group->addContent($node, 'group_node:article'); Now, for removing content from a group, I have tried $group->...
1 vote
1 answer
103 views

How do I set a condition to only show a block to a group members?

Is there a way to check whether a user is a group member when the user visits the group page? I have some blocks that should be hidden if an user is not a member.
0 votes
1 answer
234 views

Cannot update Group module with composer

We are using the Group module on our D8 site. We use composer to manage our modules and dependencies. I am somewhat of a composer novice, so it's possible that the solution is right in front of me, ...
4 votes
2 answers
4k views

How can I programmatically add members to a group?

I am trying add members to a group programmatically using Groups module in Drupal 8, and I am doing the following to achieve this: use Drupal\Core\Entity\ContentEntityBase; $roles = array('test_role')...
0 votes
1 answer
106 views

Show latest content date from group content type

I've a group type vendor with following groups: V1 V2 V3 Each group is associated with content type notes as shown below: Notes (Content Type) with nodes associated with groups: N1 (Group: V1) N2 (...
2 votes
2 answers
1k views

How do I get group to which the node belongs and redirect anonymous users to the login page if they land on it?

I'm using the Drupal Group module and I've added content to a Drupal group I've created. I've also added users to this Group. Works well: Drupal users have to login to see this content in that group. ...
2 votes
1 answer
636 views

How do I add a new group permission?

How to add new group permissions? describes how add new group permissions when using the Drupal 7 version of the module. function [mymodule]_group_permission() { return array( 'schedule ...
1 vote
0 answers
308 views

Prevent access from files with direct url

In the Group module people can upload files if they're group manager. But the thing is, these files should be restricted to the group and everyone who isn't a member may not see this files. The ...
-1 votes
1 answer
62 views

How do I list all names of the same group type?

For a Group type (Birds), I tried to create a View in Drupal 9 to list all groups of that type, but I end up getting a group title entry for every node, for example this list. Birds groups Hawks ...
0 votes
2 answers
120 views

How to filter my view of Groups to show results matching Term A or Term B

I am adding taxonomy terms to groups (using the group module) and want to use the terms to filter groups within a view. However, my exposed filters don't seem to work. There is no error, but the ...
1 vote
0 answers
280 views

How to ensure that node access check results are enforced everywhere? [closed]

I am trying to do this without hook_node_grants because, for some reason, it messes with the nodes that are being controlled by the 'Group' module. The Group module itself used to use Node grants, but ...
1 vote
1 answer
106 views

How to create a message with message stack when user becomes a member of a group module group?

Hi currently I try to code a custom module for notification based on message stack module. Now I'm searching for the event or hook to perform some custom code when the user becomes a member of a group....
0 votes
1 answer
339 views

Which hook to use to detect new members added to group?

What is the best way to make a hook that only fires when new members are added to a group? I have a function that exports group memberships to moodle course enrolments. Right now I have it bound to ...
2 votes
1 answer
804 views

Get user ids of group members

I want to get a list of all users that are members of a group. I can get the members using getMembers(): $members = $group->getMembers(); foreach ($members as $member) { var_dump($member);...
2 votes
0 answers
850 views

Get the ID of the group to which the node is added

Using Drupal 8 with the Group module, I have an action that is run via hook_node_insert that needs to know the group id of the group that the node is added to. Im using this code to get the group id ...
0 votes
0 answers
38 views

Entity Query returns incorrect results while running functional javascript test

Im writing a functional javascript test for my project where im facing a problem with my feature. I have created a group entity just above it and referencing a parent group. This doesn't work: $...
0 votes
0 answers
52 views

How to add the Group Role as body class in the page template

I like to add the Group Role of the currently logged in user to the body class of the page twig template. So this is not the same as the user roles the user account has. Currently using Drupal 9.0.3. ...
0 votes
1 answer
93 views

How do I trigger group membership was granted for a user - Group module

I try to use group module in d8. 1. I created a new group type named test 2. I added 2 group as demo with admin is default group_membership. 3. in group 1 (name okok) I edited and added new user to ...
0 votes
1 answer
147 views

Get enabled content types machine name

I'm trying to get the enabled content type machine names for a given group. I wrote the following code, but to get the machine name I should cut the strings to group_node:. /** @var \Drupal\...
0 votes
2 answers
124 views

How to return a user's group access permissions?

I am trying to block a user from accessing certain content/blocks if they do not have permission to view content of a certain type within a group. I have the user ID and the group ID, but how do I ...
0 votes
2 answers
300 views

How to check if current page is a group entity?

Im using drupal 7 and group module I am trying to run some code only if the current page is a group. here is my code <?php $arg = arg(0); $arg1 = arg(1); global $user; if($arg ='group' &&...
0 votes
1 answer
124 views

Create Group permission to grant view of all group content

I'm running Drupal 8.7.11 and Group 8.x-1.0-rc5. I have a situation whereby I have > 5,000 groups. The majority of the users are members of 10 groups. However I have a small set of users who need ...
1 vote
1 answer
478 views

How do I add a user to a group?

I am using the Drupal 7 version of the Group module. I found this Drupal 8 code which adds a user to a group, and I can't find anything similar for Drupal 7. use Drupal\Core\Entity\ContentEntityBase; ...
0 votes
1 answer
146 views

How do I get the list of permissions?

I am trying to use the group method hasPermission(permission_label, user). I found an example that is the following: $group->hasPersmission('administer members', $user) I would like to know ...
0 votes
1 answer
620 views

How can you get the route name/path of groups?

I am new to Drupal 8. I am working on groups module and want to assign different themes to different groups.So i need route name of groups. how to find route name of groups. Thanks in advance. /** ...
0 votes
0 answers
155 views

Group id not shown when view is empty in Drupal 8?

I am new to Drupal 8. I make custom view field (programmatically) and pass session variable to it.Session variable contain group id. The problem is that when the view is empty i mean no content in ...