WordPress.org

Ready to get started?Download WordPress

Forums

Who's Online
[resolved] I need help changing the profile links in this plugin (5 posts)

  1. dubbinz
    Member
    Posted 1 year ago #

    Hi I noticed that it says you added a filter for this in the php file or at least I think that's what it meant in the updates and I found the function but I just don't understand what I need to change.

    I need to change the /author/ link in the widget to /members/ to match buddypress links. I am assuming it is this code I need to change right?

    * Return HTML for a single blog user for the widget.
     *
     * @uses apply_filters() Calls 'wpwhosonline_author_link' on the author link element
     * @return string HTML for the user row
     */
    function wpwhosonline_user( $last_online_ts, $user ) {
    	$avatar = get_avatar( $user->user_email, 32 );
    	$name = $user->display_name;
    	$link = '<a href="' . get_author_posts_url( $user->ID, $user->user_nicename ) . '" title="' . esc_attr( sprintf(__("Posts by %s"), $user->display_name) ) . '">' . $name . '</a>';
    
    	$link = apply_filters( 'wpwhosonline_author_link', $link, $user );

    where exactly do I edit and how would I edit this link (if in fact this is what it does, I am not php fluent at all)

    http://wordpress.org/extend/plugins/wp-whos-online/

  2. joetheinsider
    Member
    Posted 1 year ago #

    I need this help as well, for me I only need it to be pointed to bbPress author link.

    The plugin author mentioned a code to insert in functions.php but my tries did not work to have the bbpress autor link work. Here's the code he mentioned if this will help...

    function mytheme_whosonline_link( $link, $user ) {
        return '<a href="/user/' . $user->user_login . '">' . esc_html( $user->display_name ) . '</a>';
    }
    add_filter( 'whosonline_author_link', 'mytheme_whosonline_link', 10, 2 );
  3. Adam Backstrom
    Member
    Plugin Author

    Posted 1 year ago #

    I don't have BuddyPress set up, but it looks like there's a bp_core_get_userlink() function. Try this:

    function my_userlink( $link, $user ) {
        return bp_core_get_userlink( $user->ID );
    }
    add_filter('wpwhosonline_author_link', 'my_userlink', 10, 2);

    Untested!

  4. joetheinsider
    Member
    Posted 1 year ago #

    Thanks Adam,

    I tried this and seems to work, just need some tweaking especially for me to have this work in bbpress user profile.

    Thanks a lot!

  5. DudeSchmitti
    Member
    Posted 5 months ago #

    @joetheinsider did you get this one working for bbpress?
    and if yes, what did you do?

    I'd like the user-link in the widget lead to the user profile in wordpress :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.