How do I pull user_id?

LPH

Well-known member
I'm trying to get a link on a WP menu to go to the user_id members profile page. This is the code in the header.php. The user name is showing. Now, I am working on the link to the XF profile page.


Code:
                if ( is_user_logged_in() ) {
                    wp_nav_menu( array( 'theme_location' => 'primary' ) );
 
                    global $current_user, $XF;
                    get_currentuserinfo();
 
                    echo '<ul id="member" class="loggedin_menu_class">
                    <li><a href="/community/members/'. $user_id .'">'.$current_user->display_name.'</a></li>
                    <li><a href="/community/logout">Log Out</a></li>
                    </ul>';
 
                } else {
                    wp_nav_menu( array( 'theme_location' => 'primary' ) );
 
 
                    echo '<ul id="member" class="loggedin_menu_class">
                    <li><a href="/community/login">Log In or Sign Up</a></li>
                    </ul>';
                }


In particular, this anchor area needs to work. :)
Code:
/community/members/'. $user_id .'

System Info:
XF 1.1.3
WP 3.4.x multisite enabled
XenScripts bridge 1.1


UPDATE:

This appears to work !

Code:
<a href="/community/members/'. strtolower($XF->visitor->get('username')) . '.' . $XF->visitor->get('user_id') .'">'.$current_user->display_name.'</a>

Is there a better way?
 
Back
Top Bottom