Menu link to Profile
-
Hi!
First of all, if I’m double posting this, I’m really sorry!
I want to create a menu item (or text link) to let users quickly go to their bbpress profile.
(http://raven.michaelravenstein.nl/forums/users/userid/)So how do i get the right link?
Any help is welcome!
– Michael
-
Robin, WordPress includes functions for this:
e.g.
sanitize_file_name($current_user->user_login);
https://codex.wordpress.org/Function_Reference/sanitize_file_name
https://codex.wordpress.org/Function_Reference/sanitize_title
https://codex.wordpress.org/Function_Reference/sanitize_title_with_dashes
(There are quite a few of them, they are linked in the ‘related’ sections of the above articles)@netweb thanks for posting that, thought there would be but couldn’t find it offhand.
@mathijs-lemmers ok so try<meta http-equiv="refresh" content="0;URL=http://mysite.com/forums/users/<?php global $current_user; get_currentuserinfo(); echo sanitize_file_name($current_user->user_login). ""; ?>/edit/">
Perfect! That did the trick, thanks so much for your time 😉
Have a nice day everybody!
great – glad you’re fixed !
nice thanks
Hi Robin,
This thread is a bit old, but hoping it is still a place to pursue this..
The WP Exec PHP plugin that was suggested above to enable this has not been updated in over two years, but in trying to use two different current well reviewed plugins that enable placing php in pages via shortcodes, Shortcode Exec PHP and PHP Code For Posts, I get the following same error with your last offered php snippet above…
Parse error: syntax error, unexpected ‘<‘ in /home/spirawake/public_html/wp-content/plugins/shortcode-exec-php/shortcode-exec-php-class.php(895) : eval()’d code on line 1
In both cases I created the shortcode using this, as per above;
<meta http-equiv="refresh" content="0;URL=http://mysite.com/forums/users/<?php global $current_user; get_currentuserinfo(); echo sanitize_file_name($current_user->user_login). ""; ?>/edit/">
I’ve often used shortcodes in other ways, and am hoping that maybe there is something that needs to be changed in this code because it is being inserted into the page via a shortcode…?
Kind regards…
Try
https://wordpress.org/plugins/bbp-style-pack/
go to the logion tab, and you’ll see an option to add a profile link to the menu
Thanks Robin,
It is a very. very nice plugin that you have created… But it won’t do for my needs in these regards… It puts the Edit Profile link into the main menu as a primary menu item, with no ability to change where it is or do anything else with it… It is there in the primary main site menu or nothing…
If your plugin put the Edit Profile link into the Menu section of Admin, with the same ability to use it however, in the same way that pages, posts, forums, CPTs and all the rest are there to be used as needed or not, then it would be very helpful, even perfect for my needs… Where the link goes TO is perfect…
I don’t need the rest of what your plugin does, as I have done some very extensive modifications of bbPress via my child theme over the last couple years…
But anyone starting out or in early stages with bbPress should find your plugin very helpful indeed…
So, still wondering what you think about getting some code similar to what this thread is discussing to work via one of the PHP plugins I mention above…? I want to be able to just have a discrete but clear little (page/post) link that I can place in a specific place in a specific sidebar, like I have done with other links, that lets logged in folks who are using the forums directly link to their particular Forums profile page and make changes… Basically accomplish the same thing that I can accomplish for the main WP profile page with this link: http://www.yourwebsite.com/wp-admin/profile.php… If someone not logged in clicks this link they are taken to a WP login page…
Thanks for all the hard work you are doing for a while now to make bbPress better and better and better…
Kind regards…
I added an alternative simple answer on more recent thread:
hi, i have a problem !
i want when users click on button in the page, if they are logged in, redirect to their profile
(http://mywebsite.com/members/me/) but if they arent log in, they are redirect to login page (http://mywebsite.com/login)
like login/register buddypress in the wp menu !!!
- You must be logged in to reply to this topic.