[buddypress-trac] [BuddyPress Trac] #9108: BuddyPress Classic Plugin Issue: Incorrect Profile Linking in Custom Sub-Navigation

buddypress-trac noreply at wordpress.org
Fri Feb 23 22:56:11 UTC 2024


#9108: BuddyPress Classic Plugin Issue: Incorrect Profile Linking in Custom Sub-
Navigation
--------------------------+-----------------------
 Reporter:  vapvarun      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  12.4.0
Component:  Navigation    |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |
--------------------------+-----------------------

Comment (by vapvarun):

 seems $bp_menu_items = $bp->members->nav->get_primary();
 https://github.com/buddypress/buddypress/blob/16d64d547c2ee45b913469b55cecb5e49b05b129/src
 /bp-core/bp-core-functions.php#L2794

 is creating issue

 {{{#!php
 <?php
         if ('rewrites' !== bp_core_get_query_parser()) {
                 error_log('Using non-rewrite query parser');
                 $bp_menu_items_x = $bp->members->nav->get_primary();

                 // Prepare the array to hold updated menu items.
                 $updated_menu_items = [];

                 // Base URL for the logged-in user's profile.
                 $loggedin_user_url = bp_loggedin_user_domain();

                 foreach ($bp_menu_items_x as $item) {
                         // Clone the item to avoid modifying the original
 directly.
                         $new_item = clone $item;

                         // Update the link to point to the logged-in
 user's profile section.
                         // This assumes that the slug is a valid and
 unique identifier for the profile section.
                         $new_item->link =
 trailingslashit($loggedin_user_url . $new_item->slug);

                         // Add the updated item to the array.
                         $bp_menu_items[] = $new_item;
                 }

                 error_log(print_r($bp_menu_items, true)); // Log the
 output of $bp_menu_items
         }
 }}}

 by default, we are getting URLs for displayed user-id
 I tried to pass values to bp_loggedin_user_domain during debugging to make
 it work.

 This information is only being added to the log for the purpose of
 documentation and is not a solution to the problem

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/9108#comment:3>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list