Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Disable @mentions (links) completely


  • Doremdou
    Participant

    @doremdou

    Hi,
    I would like to disable completely the mentions feature, even if someone put accidentaly a “@” before a username for exemple “jack” I don’t want the result “@jack” to link to jack profile, is this possible?

    I was able to disable mentions tabs etc. but not the link to profile created when someone put a “@” before a name.
    Any ideas for this?

    thank you very much for your time and help 🙂

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

  • Henry Wright
    Moderator

    @henrywright

    Hi @doremdou

    You can disable @-mentions with the BuddyPress No Mentions plugin.


    Doremdou
    Participant

    @doremdou

    Hello @henrywright thank you for your answer 🙂
    I tried the plugin but it only remove mentions tabs, if someone put a “@” before a name it always link to his profile, am I doing someone wrong or the plugin is not working like it should?


    Doremdou
    Participant

    @doremdou

    someone = something sorry


    danbp
    Moderator

    @danbp

    hi @doremdou,

    add this to bp-custom.php

    add_filter( 'bp_activity_do_mentions', '__return_false' );


    Doremdou
    Participant

    @doremdou

    Thank you @danbp for your answer.
    I don’t know why but even with your code in bp-custom.php user link to profile are still there on old and new @mentions

    Could it be a plugin “conflict”?


    danbp
    Moderator

    @danbp

    Could it be a plugin “conflict”?

    I don’t think, but it’s possible. To know the answer, check it out, you’re the master on your site !

    Have you tested by writing a notice where you mentionned a member ?

    The snippet removes only the link from @mention, but doesn’t remove or sanitize this part. If somebody writes @ something, you’ll see @ something but without the link to profile.

    And for almost any activity modification, the code isn’t retroactive. Past activities are stored with the old version and the new one are stored with your modification.


    Henry Wright
    Moderator

    @henrywright

    @doremdou the code @danbp provided should stop @-names being ‘linkified’. The function that ‘linkifies’ @-names begins like this:

    function bp_activity_at_name_filter( $content, $activity_id = 0 ) {
    
    	// Are mentions disabled?
    	if ( ! bp_activity_do_mentions() ) {
    		return $content;
    	}...

    As you can see, if bp_activity_do_mentions() returns false then $content is returned unmodified (i.e. @-names aren’t linked).

    In your case, you’re making sure the function returns false via add_filter( 'bp_activity_do_mentions', '__return_false' );

    So this should be working. There must be something else going on here…


    Doremdou
    Participant

    @doremdou

    I understand, I will try to disable everything until I see a change


    Doremdou
    Participant

    @doremdou

    Oh I think I understand, it is working on BP activities but mentions in activities which concerned bbPress forums (topics, replies…) are still linking to profiles.

    Should I ask how to fix this in bbPress forums or should the code you gave me above also disable it?

    Thank you very much


    danbp
    Moderator

    @danbp

    No the above code doesn’t disable @-mentions in bbpress

    You use this filter for bbPress topics:

    add_filter( 'bbp_find_mentions', '__return_false' );


    Doremdou
    Participant

    @doremdou

    Thank youuuuuuuuu @danbp ! 🙂
    I didn’t notice that it was not buddypress until now… sorry ^^

    thanks again @henrywright & @danbp
    have a good day


    danbp
    Moderator

    @danbp

    you’re welcome ! 😉

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Resolved] Disable @mentions (links) completely’ is closed to new replies.
Skip to toolbar