Skip to:
Content
Pages
Categories
Search
Top
Bottom

@mention autolink to profile


  • Matthias
    Participant

    @matthias70

    In buddypress forums the @username autolinks to the usernames profile.
    Is this normal behavior or a plugin?
    The @mention link to profile does not work in my bbpress forum. It works in my buddypress activitiy stream.
    Any ideas to get @mention link to profile working in my bbpress site?
    Thanks
    Matthias

Viewing 13 replies - 1 through 13 (of 13 total)

  • danbp
    Participant

    @danbp

    @mentions doesn’t work (actually) in bbPress.

    To add it, so you can mention a user in a topic, add this snippet to bp-custom.php or child-theme’s functions.php

    function custom_bbpress_maybe_load_mentions_scripts( $retval = false ) {
    	if ( function_exists( 'bbpress' ) && is_bbpress() ) {
    		$retval = true;
    	}
     
    	return $retval;
    }
    add_filter( 'bp_activity_maybe_load_mentions_scripts', 'custom_bbpress_maybe_load_mentions_scripts' );

    Matthias
    Participant

    @matthias70

    Hi @danbp,
    the @username on my site has still no link to the profile…?


    danbp
    Participant

    @danbp

    On a profile header, it’s not intended to link to the profile, as you’re already on a profile when you see @username !

    This is there as reminder for members who want to sent a message to that user.

    When on any activity page and you use @mention in a notice, you get a userlist depending the first letter you type after @. But never a link to a profile.

    Or do you mean that @mentions is not active, whithout any links on it ?


    Matthias
    Participant

    @matthias70

    Hi @danbp,
    no I mean the link to the profile shown here in the buddypress forum replies.
    When I write @danpb it is linked to your profile!
    Just want the same in my bbpress install, but the code in functions.php above does not work…


    danbp
    Participant

    @danbp

    The code works, but is not intended for what you want. 😉

    What is used here is a custom function.


    Matthias
    Participant

    @matthias70

    What is used here is a custom function.

    Hi @danbp and @ all other readers,
    do you know more about this custom function used in the buddypress forum?

    Just to get a link to the profile, if a user is mentioned ( @username ) in a topic…
    Thanks
    Matthias


    danbp
    Participant

    @danbp

    To link to a profile within bbpress topic editor, you should add the snippet to bp-custom.php

    Read also here, where i mentionned a plugin
    https://buddypress.org/support/topic/link-to-users-profile-non-template/


    Matthias
    Participant

    @matthias70

    Hi @danpb,
    now I’m using your code and the plugin, but my forum still shows no links in @mention
    I just was searching in the bbpress support forum and it seems that it is a built in feature. But I don’t know why it is not working on my install?
    Here is how @mention are shown in my forum. No link to the user profile at all

    Any suggestions to solve the problem?
    Thanks
    Matthias


    Matthias
    Participant

    @matthias70

    Hi @danpb,
    sorry it is working. Not backwards for older posts, but for new posts.
    The plugin was the solution…
    Thanks for your support!
    Matthias


    Matthias
    Participant

    @matthias70

    Hi @danpb,
    the @username link works in the lead topic but not in replies?
    Did I miss something to add?
    Thanks
    Matthias


    danbp
    Participant

    @danbp

    Keine ahnung ! It works on my forum… Do you use a cache or clear your browser history and cookies.

    Aside, did you allowed mention in BP settings ?


    Matthias
    Participant

    @matthias70

    Hi danbp,
    I can not find a setting to allow explicit @mention. I allowed the activity stream in buddypress. And @mentions are working fine in there.
    The notifications if someone is mentioned in the bbpress forums are working fine, too. I even have a dropdown field with suggestions for @mention in bbpress.

    The only thing is the missing link to the profile behind the @mention in replies…
    forums and buddypress sites are exluded from caching…

    Thanks
    Matthias


    Matthias
    Participant

    @matthias70

    Hi @danpb,
    I found a snippet in my theme functions.php that causes the missing link to profile in all @mentions in bbpress. When I delete the following code all @mentions in the bbpress topics and replies are shown.
    Can you have a look at the following code. Maybe you can see, why it deletes the mention links to the profiles…?

    // replies visible only for logged in users
    function bb_auth_reply_view( $reply_id ) {
    $reply_id = bbp_get_reply_id( $reply_id );
    
    // Check if password is required
    if ( post_password_required( $reply_id ) )
    return get_the_password_form();
    
    $content = get_post_field( 'post_content', $reply_id );
    
    // first topic reply shouldn't be hiding
    $rep_position = bbp_get_reply_position($reply_id);
    
    // if user is not logged in and not the first post topic
    if( !is_user_logged_in() && $rep_position > 0 ) {
    return "replies only for logged in users!";
    } else {
    // return normal
    return $content;
    }
    }
    add_filter( 'bbp_get_reply_content', 'bb_auth_reply_view' );
Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘@mention autolink to profile’ is closed to new replies.
Skip to toolbar