You can’t use an object variable, $user->display_name
, in a string.
And why would you want a tab that links back to the member being viewed? You’re already viewing that member.
This will provide the url of the displayed member: bp_displayed_user_domain()
So you could do this:
function redirect_user_to_tab3(){
bp_core_redirect( bp_displayed_user_domain() );
}
If you just want the user name for the currently displayed user so that you can build an url, you could do this:
function redirect_user_to_tab3(){
$url = site_url() . '/slug/' . bp_get_displayed_user_username();
bp_core_redirect( $url );
}
Related Posts:
- How to get URL of current page displayed?
- Encode text string being appended as query to URL [closed]
- Is it safe to use $_SERVER[‘REQUEST_URI’]?
- The correct method to pass query vars in AJAX using ajaxurl
- How to check if feed URL was requested?
- What is the best practice for escaping data URIs?
- urlencoding of the_title() doesn’t work?
- How do I get the author’s page url from their ID?
- Dynamic URL to reference custom PHP files
- Concatenate site_url and string doesn’t work
- What’s the proper way to use wp_enqueue_script/style?
- Callback URL in WordPress
- Remove username in emails or swap username for email
- Wrong links in WordPress?
- Newbie question: no index.php? in my plain wordpress permalink
- Help with adding pagination to custom wp_query
- How is WordPress manipulating the posts like there are folders?
- Extract subdomain and relative address from a url
- Remove query string specific key value
- Echo URL of large version of Featured Image
- Why does WordPress remove my variables in the URL?
- Reordering Buddy Press profile navigation [closed]
- Show css depending on activity type in BuddyPress activity-loop [closed]
- Making BuddyPress Activity Stream (Post Type) Featured Images Clickable [closed]
- Dynamic content based on a URL parameter
- Colon is Missing In My Website Url in WordPress
- How do I programmatically set a user as spam in BuddyPress? [closed]
- How to change redirection route to a php page for making it only accessible by logged-in members?
- How to use $_GET function WordPress backend
- Extend PHP regex to cover “srcset” and “style” attributes
- My php header() function is not working [closed]
- Scrape external webpage for first image and add it to new post
- Create custom permalinks to show Custom Post Type’s relationship?
- Search Query: how to construct a search string from two select elements?
- Get URL Parameters from referer
- Need help enqueueing webfonts
- WordPress Stripping Colons?
- Why is $wp->request empty in WordPress 6.0?
- Get the URL of the page from which an ajax request has been launched within ajax callback
- How to check if the current page is at a specified path in the URL?
- Buddypress update user avatar image via REST
- How to pass a PHP $_GET variable and fetch/output it?
- Post’s ID pattern?
- After adding my website to a new server, I keep getting a unexpected end of file error, but the file is identitcal to it’s original source
- I’m unable to call img path using single quotes in an array?
- Need to Modify a WordPress Shortcode with another wordpress shortcode
- change default RSS feed URL
- How do i add slugs to a URL, but still redirecting to the same page
- Can’t change website Title on wordpress
- Nginx WordPress and another Web app URL structure
- Why BuddyPress fields not saving?
- Change homepage content if user is logged in – BuddyPress
- How to do something when user profile rendereing?
- How to use title attributes in sidebar widget?
- how to get attached file url for current post?
- Call featured image url
- Creating customized php files in theme folder
- implementing a jQuery “click to expand” link in WordPress [closed]
- is user member of a group, show them categories [closed]
- How do I include an external PHP file in a subdir WordPress install?
- How to add PHP pagination to wordpress
- Use an anchor link to open an iframe inside a WordPress page
- Adding custom url to readmore link using get_permalink()
- How to set base url for php widget
- Comment_author_url doing nothing
- Wp favorites posts by specific category? [closed]
- Display multi-select box choices in a bullet list [closed]
- Customize Buddypress adminbar [closed]
- Modifying WP URL handing code?
- How to deal with a GET variable of ‘name’?
- WordPress permalink issue
- WordPress is removing query variables like page, p from the URL of a custom static page
- Prevent Buddypress Rewrite Rules on Non-Buddypress pages/posts
- Workaround for og:image unsupported webp image type, Yoast SEO?
- Where is the php file of single member profile view (BuddyPress)
- extract url from a hyperlinked string in PHP [closed]
- Removing all my hardcoded URLs with get_site_url()
- Retrieve first image url from custom post with pagination
- Get string from array and start loop [closed]
- Magento and WordPress URL integration [closed]
- Passing multiple variables through url (php)
- How to remove parent section in an attachment URL in wordpress?
- Get current WordPress page then add #post ID to the end
- 2 small questions: How to redirect to a created page & show that pages title in wp, bp
- How to include support for all page types, calendar urls, archive, etc
- Whats wrong with my code? Need To add String to shortcode? [closed]
- Remove /category/ from category (archive) page URLs (without using a plugin)
- WPMU – How to echo only one URL
- append special url end of my website urls
- How can I change the URL via add_rewrite_rule()
- How to create a WordPress PAGE in another folder?
- bloginfo url in javascript
- How to extract URLs from wordpress taxonomies
- Create a custom plugin with dynamic child pages listing database records
- change the blog in the url if you go from a specific page wordpress
- Remove links to the comments section
- Remove “Forum” from BuddyPress group creation step
- How to create a dynamic url with post title from one website to another?
- Custom plugin with dynamic child pages listing database records
- Filtered queries not responeding to page path