This topic has 3 replies, 2 voices, and was last updated 8 years by Radu.

  • Author
  • #137359
     branderboy
    Participant

    how to add a link to profiles? example    /members/%username% /

    #137474
     Radu
    Moderator

    I don’t understand what you want to achieve, where you want to add link ? provide screenshot that points out the page location

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #137484
     branderboy
    Participant
    This reply has been set as private.
    #137609
     Radu
    Moderator

    Hi,

    add this code to wp-content/themes/kleo-child/functions.php

    COPY CODE
    
    function member_link_name_shortcode_func(  ) {
    
        if(is_user_logged_in()) {
            if (function_exists('bp_is_active')) {
                $logged_in_username = bp_get_loggedin_user_fullname();
                $logged_in_link = bp_loggedin_user_domain( '/' );
                $output = '<a href=".$logged_in_link.">'. $logged_in_username.' </a>';
                return $output;
    
            } elseif (class_exists('bbPress')) {
                $logged_in_username = bbp_get_user_nicename(bbp_get_current_user_id());
                $logged_in_link = bbp_get_user_profile_url( bbp_get_current_user_id() );
                $output = '<a href=".$logged_in_link.">'. $logged_in_username.' </a>';
                return $output;
            }
        }
    }
    
    add_shortcode('member_name','member_link_name_shortcode_func');
    

    Then add this shortcode in the page that you want to show the username + link

    [member_name]

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?