Project

General

Profile

Actions

Bug #19214

closed

Group creation is causing a fatal error

Added by Raymond Hoh about 1 year ago. Updated about 1 year ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
Groups (misc)
Target version:
Start date:
2023-11-06
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

While looking into #19202, I found that group creation is broken. On the group creation page, if you click on the "Create Group and Continue" button, you will get a fatal error.

tl;dr: The bug is with the cac-group-library plugin and how it attempts to modify a group's navigation to remove some nav menu items. The bug only came about once we made our bp-nelo theme its own theme in CAC 2.2.0.

Boone, here's the rundown:
1. Before CAC 2.2.0, bp-nelo was a child theme of bp-default. When loading a BuddyPress template, all code execution stops after the template is loaded: https://github.com/buddypress/buddypress/blob/7a2458117e98f4861f9a9b85806b712770fb5919/src/bp-core/bp-core-catchuri.php#L511-L512

2. In CAC 2.2.0, bp-nelo is its own theme so BuddyPress's theme compat layer kicks in. However, BP theme compat doesn't halt code execution after a template is loaded: https://github.com/buddypress/buddypress/blob/7a2458117e98f4861f9a9b85806b712770fb5919/src/bp-core/bp-core-catchuri.php#L527-L532.

3. This led to the following on the group creation page:
i. When a BuddyPress group is created, it sets the buddypress()->groups->current_group property to the new group's details: https://github.com/buddypress/buddypress/blob/7a2458117e98f4861f9a9b85806b712770fb5919/src/bp-groups/actions/create.php#L60-L62 . This code runs on 'bp_actions' at priority 10.

ii. The 'cac-group-library' plugin attemps to alter a group's nav menu and it does a check for bp_is_group() to determine if we're on a single group page: https://github.com/cuny-academic-commons/cac-group-library/blob/b9d15c3f512e065d56ade216e7eb509b873a5248/src/Nav.php#L64-L70. This code runs on 'bp_actions' at priority 200. When this code runs at priority 200, bp_is_group() is returning true due to 3)i: https://github.com/buddypress/buddypress/blob/7a2458117e98f4861f9a9b85806b712770fb5919/src/bp-core/bp-core-template.php#L2737-L2739 .

iii. Due to bp_is_group() returning true, the cac-group-library plugin attempts to access some group nav class methods that only exist on a single group page . This causes the fatal error.


I've patched up the cac-group-library nav removal code to run on 'bp_actions' at priority 9 to sidestep the bp_is_group() problem and will create a ticket over on BuddyPress Trac to let devs know how bp_is_group() can potentially be true on the group creation page.


Related issues

Has duplicate CUNY Academic Commons - Bug #19239: Error occured when creating a group in CDevResolvedRaymond Hoh2023-11-09

Actions
Actions #1

Updated by Raymond Hoh about 1 year ago

  • Status changed from New to Resolved

Fixed in https://github.com/cuny-academic-commons/cac/commit/da1d3f50ba968c5e870a13dbdf51b5cd1d9f7113 and pushed to production. I've also created a BP Trac ticket here .

Actions #2

Updated by Raymond Hoh about 1 year ago

Just wanted to update this ticket to mention that four groups were created since the release of CAC 2.2.0:

+------+-------------------------------------------------------------------+---------------------+
| id   | slug                                                              | date_created        |
+------+-------------------------------------------------------------------+---------------------+
| 3151 | sp-cuny-working-group-1576728188                                  | 2023-11-05 19:49:49 |
| 3150 | sp-cuny-working-group-693359538                                   | 2023-11-05 19:46:30 |
| 3149 | sp-cuny-working-group                                             | 2023-11-05 19:44:58 |
| 3148 | department-of-communications-performing-arts                      | 2023-10-26 03:26:37 |
+------------------------------------------------------------------------------------------------+

It's more like two groups since the SP CUNY Working Group one probably went through the group creation process again after the fatal error popped up.

Actions #3

Updated by Boone Gorges about 1 year ago

  • Has duplicate Bug #19239: Error occured when creating a group in CDev added
Actions

Also available in: Atom PDF