Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Setting Edit page as default for Profile

@artifex223

Participant

I was able to get this issue resolved.

After applying bp_core_new_nav_default(), I wrote a function to append ‘public’ to the [‘link’] item in the bp_options_nav array for the public profile page, and hooked it into ‘bp_before_member_header’.

Unfortunately, even with the link changed, clicking the Public tab still took me to the new default, the Edit tab. After a bit of searching, I found bp_redirect_canonical(), which was chopping off the ‘public’ I had added to the link. So I wrote another function to filter into ‘bp_do_redirect_canonical’ that returns false if the current component is profile and the current action is public.

Having finally produced the result I was aiming for, I still needed to make sure this change was only applied when the logged in user was viewing their own profile. Since bp_core_new_nav_default() needs to be hooked onto ‘bp_setup_nav’, I was not able to use the regular BP functions for current_user and displayed_user, since $bp is not fully setup by that point. So I wrote a function to determine if the profile being viewed belongs to the logged in user by comparing the third chunk of the URL with the user’s login, and used the result as a condition for applying the other hooks and filters.

My code is built into a class structure, which is why I did not simply paste it here. If anyone needs more help with this, though, let me know and I will see about refactoring the code for you into something that can just be dropped into functions.php.

Skip to toolbar