Home Forums WTI Like Post PRO Customize The User Likes Name

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #259
    D
    Participant

    Can you help me link the User Likes Name to the User Buddypress Activity Page?
    I’m assuming this chunk of code would have to be modified but I’m afraid I might break the site. if ($show_user_likes) {
    $wti_like_post .= “<div class=’wti-user-likes wti-likes-” . $post_id . “‘>”;
    $wti_like_post .= GetWtiUserLikes($post_id);
    $wti_like_post .= “</div>”;
    }
    }
    The DIV displayed in firebug lugin updates
    <div class=”wti-user-likes wti-likes-1917″>Author</div>

    I would appreciate it if you could help me with a function for my function.php to avoid wiping out any changes made to the core files during p

    #260
    Webtechideas
    Keymaster

    The function GetWtiUserLikes needs to be slightly modified to allow this. Open wti_like_post.php file using any editor and search for the above function.

    You need to change $users[] = $user_info->display_name; to $users[] = apply_filters( 'wti_like_post_user_profile_link', $user_info->display_name, $user_id );

    This will allow attaching a function to the filter to modify the default output. Now let’s define a function related to the above filter as below.

    add_filter('wti_like_post_user_profile_link', 'WtiLikePostUserProfileLink', 10, 2);
    
    function WtiLikePostUserProfileLink($display_name, $user_id)
    {
    	return bp_core_get_userlink( $user_id );
    }

    Please note that if you are logged in and have liked a post, then it will show You instead of your display name where you have liked. If you want to change that as well, then change $users[] = __('You', 'wti-like-post'); to $users[] = apply_filters( 'wti_like_post_user_profile_link', __('You', 'wti-like-post'), $current_user->ID);

    For more details on the above function which gives you the buddypress profile link, please check here.

    Thanks

    #261
    D
    Participant

    Thanks a lot. It worked like a charm, appreciate the clear response and your help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘WTI Like Post PRO’ is closed to new topics and replies.