Get the current username
-
Right now I have this function
function bp_template_content_sub_function() { if ( is_user_logged_in() ) { //Add shortcode to display content in sub tab if($_SERVER['REQUEST_URI']=="/members/lolno1/mystocks/activity/") { echo do_shortcode('[user-activity]');} } else { wp_login_form( array( 'echo' => true ) ); } }
in my functions.php. lolno1 is the username. So if I go to that url, with that username, the correct information displays, however, if I’m logged in as another user, I have to go to that url to get the current users info to display, which of course is incorrect. The url should be /members/[current user]/mystocks/activity/
How do I change the above code to have the current logged in user URI work correctly?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Get the current username’ is closed to new replies.