Project

General

Profile

Actions

Bug #20402

closed

https://commons.gc.cuny.edu/create/ not working

Added by Marilyn Weber 6 months ago. Updated 6 months ago.

Status:
Resolved
Priority name:
High
Assignee:
-
Category name:
-
Target version:
Start date:
2024-05-24
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

A user reports "I am trying to create a site on CUNY academic commons, but the link to create a new site does not take me anywhere. I am stuck on this page:https://commons.gc.cuny.edu/create/"

And my experience is the same. Clicking on "Create a Site" just takes me back to https://commons.gc.cuny.edu/create/


Files

Actions #1

Updated by Boone Gorges 6 months ago

I've pushed up a fix where I hardcode the correct link: https://github.com/cuny-academic-commons/cac/commit/7330acbb421d7ca8bc690e6609b6dc65ba75ee1e This is running on production.

Ray, the problem is arising because the saved rewrite slug for the blogs component is incorrect. But I can't figure out how to fix it. When I visit https://commons.gc.cuny.edu/wp-admin/network/admin.php?page=bp-rewrites, I get a notice that the necessary bp_pages do not exist and have been created, and the rewrites admin tools don't appear. I wonder if maybe there's some flag in the database that is causing the bp-classic depreciation not to have fully taken hold. What do you think?

Actions #2

Updated by Raymond Hoh 6 months ago

The issue was bp_core_get_directory_pages() returning a blank object on production instead of an object containing all BP directory pages.

This function is used to create the root slug for each component by default: https://github.com/buddypress/buddypress/blob/e667c79966b84ee9e0d230a8bac7bddf6b53926b/src/bp-core/classes/class-bp-core.php#L230-L233, https://github.com/buddypress/buddypress/blob/e667c79966b84ee9e0d230a8bac7bddf6b53926b/src/bp-blogs/classes/class-bp-blogs-component.php#L81 . The root slug is used for the directory permastruct and the directory permastruct is used for the site creation URL in bp_rewrites_get_url() . Lastly, bp_rewrites_get_url() is used in the bp_get_blogs_directory_url() function, which is how we got to this bug! When the directory pages function is empty, the BuddyPress blogs component's root slug falls back to the component ID, which is blogs and explains the site creation URL mismatch.

I cleared the cache for bp_core_get_directory_pages() by running the WP-CLI command wp cache delete directory_pages bp_pages and this properly repopulated the directory pages and fixed the site creation URL for bp_get_blogs_directory_url().

I'm not sure how bp_core_get_directory_pages() returned an empty object though...

Actions #3

Updated by Marilyn Weber 6 months ago

It's still not working for me - I get a page that just says "Sites" on Chrome and "Page not found" on Firefox. Screenshots attached.

Actions #4

Updated by Boone Gorges 6 months ago

I flushed the rewrite rules and it's now working for me. It's possible that this needed to happen after Ray flushed the object cache, in order for the 'sites' base slug to be set instead of the default 'blogs'.

Actions #5

Updated by Marilyn Weber 6 months ago

Perfect, case closed!

Actions #6

Updated by Boone Gorges 6 months ago

  • Status changed from New to Resolved
  • Target version set to 2.3.8

Thanks for confirming.

Actions #7

Updated by Raymond Hoh 6 months ago

I flushed the rewrite rules and it's now working for me. It's possible that this needed to happen after Ray flushed the object cache, in order for the 'sites' base slug to be set instead of the default 'blogs'.

Argh, I was only testing bp_get_blogs_directory_url() through WP-CLI and forgot to flush the rewrite rules after deleting the cache for the directory pages. Apologies!

Actions

Also available in: Atom PDF