• Resolved SMae

    (@smae)


    Hello,

    I would like to add a button that has a member’s url to the bottom of their profile card in the directory page. I have tried to use href=“user.user_url” but it does not work.

    How do I retrieve the member’s metadata?

    Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • @smae

    Try to use the solution in this guide:
    Adding the “View Profile” link in the Member Directory cards

    https://docs.ultimatemember.com/article/1659-adding-the-view-profile-link-the-member-directory-cards

    Thread Starter SMae

    (@smae)

    Hello,

    Thank you for your reply. I want to retrieve the user’s website url, not their profile url.

    Can you help?

    @smae

    You can use the social connect icons option in the Members Directory form.

    Add the user’s website URL link with this code snippet:

    add_filter("um_builtin_all_user_fields","um_092221_website_url_social");
    function um_092221_website_url_social( $fields ){
    
        foreach ( $fields as $field => $args ) {
            if ( isset( $field ) && $field == 'user_url' ) {
                $fields[ $field ]['advanced'] = 'social';
                $fields[ $field ]['icon'] = 'um-faicon-globe';
                $fields[ $field ]['match'] = 'https://';
                $fields[ $field ]['color'] = '#96979a';
                $fields[ $field ]['title'] = 'My website ' . um_profile( $field );
            }
        }
    
        return $fields;
    }

    @smae

    Update of the code snippet to avoid PHP error:

    $fields[ $field ]['match'] = ' ';

    Thread Starter SMae

    (@smae)

    Hello,

    Thank you.

    I do not want to display social icons in the directory, only on their profile page.

    I want the button to be a bootstrap “View Website” button.

    Is there not a way to directly access the member’s metadata so I can place it wherever I want, styled however I want? For example, I can access the display name with user.display_name, yet user.user_url or user.user_url_html do not work.

    Thank you again.

    @smae

    You can try this code snippet to customize the Member Directory template file with user.user_url for the user’s web page:

    add_filter( "um_ajax_get_members_data", "um_profile_web_page_members_data", 10, 3 );
    
    function um_profile_web_page_members_data( $data_array, $user_id, $directory_data ){
    
        $data_array['user_url'] = um_user( "user_url" );    
        return $data_array;
    }
    Thread Starter SMae

    (@smae)

    Perfect! Thank you for your help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Meta data in Profile Card’ is closed to new replies.