[buddypress-trac] [BuddyPress Trac] #5747: Page mappings can create duplicate pages on reinstall

buddypress-trac noreply at wordpress.org
Thu Jul 10 17:00:26 UTC 2014

#5747: Page mappings can create duplicate pages on reinstall
 Reporter:  johnjamesjacoby  |       Owner:  johnjamesjacoby
     Type:  defect (bug)     |      Status:  reopened
 Priority:  low              |   Milestone:  2.1
Component:  Core             |     Version:  1.5
 Severity:  minor            |  Resolution:
 Keywords:                   |

Comment (by johnjamesjacoby):

 Replying to [comment:4 boonebgorges]:
 > The changes in r8570 will have the effect of hijacking any page with the
 slug 'groups'.
 This was intentional.

 > IMO this edge case is a larger problem than the one we're trying to
 solve here (that duplicate pages can be created in the case of
 How so?

 When duplicate pages are created, they are also assigned as the directory
 page (likely with a `-2` at the end.) Fixing this error in it's previous
 incarnation is a tedious and backwards process:

 * Notice you have 3 duplicate Pages with `-2` slugs
 * Navigate to wp-admin
 * Navigate to Pages
 * Hover over each "View" link to figure out which ones are the duplicates
 * Trash those Page(s)
 * Navigate to Deleted Pages
 * Delete those Page(s) completely (maybe without deleting other previously
 trashed pages you aren't ready to remove)
 * Visit BuddyPress Settings
 * Reassign the Page(s) to the originals
 * Double check that each URL is correct

 What happens after my changes, is BuddyPress (safely IMO) assumes these
 pages exist with the intent of being assigned. If that assumption is
 incorrect, the fix is much easier and (again, IMO) comes with some
 additional context and learning:

 * Notice that your existing pages have been wrongly overridden (note that
 now you've learned what BuddyPress directories are and do.)
 * Navigate to wp-admin
 * Create New Page(s)
 * Give them appropriate titles and Publish them
 * Visit BuddyPress Settings
 * Reassign the Page(s) to your new ones
 * Double check (with confidence than above) that each URL is correct

 What is currently in trunk:

 * is up to 3 less steps (and possibly more per click, per page)
 * Does not recreate duplicate site content unbeknownst to the user
 * Reduces friction in learning how BuddyPress directories work when
 conflicts occur

 > How about instead of get_page_by_path(), we check to see if the
 component has a page in `bp_core_get_directory_page_ids()`; if it does,
 and the page exists, use it; otherwise create a new one.
 When the pages exist, but the `bp-pages` option is deleted, duplicate
 pages will still be created.

 Replying to [comment:5 DJPaul]:
 > get_page_by_path() is also an uncached function, and while it might not
 make a huge difference here, I wanted to point it out.
 Worth acknowledging, but it's the only way to query these pages by their
 respective slugs, and we'll inherit any improvements that may go into it

 Ultimately, I'm willing to err on the side of a less confused user that
 already created pages than a more confused user that may need to learn how
 to edit/trash/delete pages they didn't already create.

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5747#comment:6>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list