Please or Register to create posts and topics.

Universal Link to Asgaros Profile Page

I’m trying to customize things toward a mobile view since half of our users appear to be using their phones to view our site.

Is there a way to get a URL of the profile link within the Asgaros Menu and put that link in a Site Menu?

I want the Profile in the green forum menu to be placed in the site menu at the top.

Hey @hawks-cast,

you can use the following code to change a menu entry:

add_filter( 'nav_menu_link_attributes', 'asgaros_menu_profile', 10, 3 );

function asgaros_menu_profile( $atts, $item, $args ) {
    if (!strpos($atts['href'], '--asgaros-profile--')) {
        return $atts;
    }

    $user = wp_get_current_user();
    $profile_link = home_url() . "/forum/profile/" . $user->user_nicename;
    $atts['href'] = $profile_link;

    return $atts;
}

After adding this code you only have to add “–asgaros-profile–” to the URL of the menu entry and it will be replaced with the profile link.

Hawks Cast has reacted to this post.
Hawks Cast
If you ever wonder how to return the favour for helping you.