Programmatically created groups not appearing in the list view

Created on 26 December 2023, 11 months ago

I'm attempting to programmatically create groups in version 3. Despite their successful creation, none are listed in the /admin/group section.

Here's the code I'm using:

  $node = Node::load($nid);

  $group = Group::create([
    'type' => 'client', 
    'label' => $node->getTitle(),
  ]);

  $user = User::load(1);
  $group->setOwner($user);
  $group->save();

Am I missing something obvious?

💬 Support request
Status

Closed: works as designed

Version

3.2

Component

Code

Created by

🇵🇹Portugal introfini

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @introfini
  • Status changed to Closed: works as designed 11 months ago
  • 🇵🇹Portugal introfini

    I figured out why it wasn't working: the problem was that my admin account didn't have the Administrator role set.

Production build 0.71.5 2024