When viewing a profile I want a different tab based on the displayed user role
-
Hi,
I have been using the below code, So when someone clicks on the profile of an association it will redirect to the products tab.
All is well and I can use the other tabs to navigate around except when I click on the activities tab. It takes me to the products tab users cannot see the associations (role) activity stream.I removed this code and it worked fine so it is some where here. I have this in the child-theme/buddypress-nouveau/members/single/home.php page
WP Version 5.7.2 PHP 7.4.12
$displayed_user = new WP_User( bp_displayed_user_id() ); if ( ( in_array( 'associations', $displayed_user->roles, true )) && (strpos($_SERVER['REQUEST_URI'], "my-products") == false) && (strpos($_SERVER['REQUEST_URI'], "front") == false) && (strpos($_SERVER['REQUEST_URI'], "profile") == false) && (strpos($_SERVER['REQUEST_URI'], "activity") == false) && (strpos($_SERVER['REQUEST_URI'], "friends") == false) && (strpos($_SERVER['REQUEST_URI'], "my-donations") == false) && (strpos($_SERVER['REQUEST_URI'], "notifications") == false) && (strpos($_SERVER['REQUEST_URI'], "messages") == false) && (strpos($_SERVER['REQUEST_URI'], "groups") == false) && (strpos($_SERVER['REQUEST_URI'], "location") == false) && (strpos($_SERVER['REQUEST_URI'], "invite-anyone") == false) && (strpos($_SERVER['REQUEST_URI'], "settings") == false) && (strpos($_SERVER['REQUEST_URI'], "w-my-account") == false) && (strpos($_SERVER['REQUEST_URI'], "store-manager") == false) && (strpos($_SERVER['REQUEST_URI'], "articles") == false) && (strpos($_SERVER['REQUEST_URI'], "media") == false) && (strpos($_SERVER['REQUEST_URI'], "item-header-content") == false) ) { //is assoc and is not already redirected to products or other profile links $currenturl = $_SERVER['REQUEST_URI']; $urlto = $currenturl."my-products"; ?> <script> window.location.replace("<?php echo($urlto); ?>"); </script> <?php } else { // just load ?>
Thank you for helping with this
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.