Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Mention tag in forum how to get it ?

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

  • danbp
    Participant

    @danbp

    hi @svend-rugaard,

    this is a bbpress trick. Add this snippet to bp-custom.php

    
    function abc() {
    	echo '@'. bbp_get_topic_author_display_name();
    }
    add_filter( 'bbp_theme_after_reply_author_details', 'abc' );

    Svend Rugaard
    Participant

    @svend-rugaard

    should i use the @mention snippet also for that because nohting happen ?


    danbp
    Participant

    @danbp

    Nothing happen ? Where do you try to use this function ?
    And No you haven’t to use another snippet.

    The snippet is not correct as it ouput the display name. We need nicename.

    Use this instead

    function abc() {
    $user = get_userdata( bbp_get_reply_author_id() );
    	if ( !empty( $user->user_nicename ) ) {
    		$user_nicename = $user->user_nicename;
    		echo '@'.$user_nicename;
    	}
    }
    add_filter( 'bbp_theme_after_reply_author_details', 'abc' );

    This will only show up in a bbpress forum. Like here, that’s what you asked for.


    Svend Rugaard
    Participant

    @svend-rugaard

    i use it in bp-custom.php ?


    Svend Rugaard
    Participant

    @svend-rugaard

    Look here ? http://www.playstationforum.dk/topic/opdatering-a-forum/

    My bp-custom.php is looking like this

    <?php
    // hacks and mods will go here
    ?>
    function abc() {
    $user = get_userdata( bbp_get_reply_author_id() );
            if ( !empty( $user->user_nicename ) ) {
                    $user_nicename = $user->user_nicename;
                    echo '@'.$user_nicename;
            }
    }
    add_filter( 'bbp_theme_after_reply_author_details', 'abc' )

    aces
    Participant

    @aces

    @svend-rugaard

    You need to put the php tags around the code, so <?php goes before the code danbp gave you.

    // is used to tell php to ignore the current ( single ) line. Multi line comments start with /* and end with */.

    Then ?> needs to go at the end of the file.

    There should be nothing ( including spaces or blank lines ) before the opening <?php or after the closing ?>. Some php files don’t have / need a closing ?>.

    Also to note is that a text editor such as notepad ++ should be used, rather than a word-processor…


    Svend Rugaard
    Participant

    @svend-rugaard

    would you put the code as it should be because i dont get it then ?

    Mine is looking like this now ?

    <?php
    // hacks and mods will go here
    ?>
    <?php function abc() {
    $user = get_userdata( bbp_get_reply_author_id() );
            if ( !empty( $user->user_nicename ) ) {
                    $user_nicename = $user->user_nicename;
                    echo '@'.$user_nicename;
            }
    }
    add_filter( 'bbp_theme_after_reply_author_details', 'abc' )?>

    aces
    Participant

    @aces

    double post


    aces
    Participant

    @aces

    <?php
    // hacks and mods will go here
    function abc() {
    $user = get_userdata( bbp_get_reply_author_id() );
    	if ( !empty( $user->user_nicename ) ) {
    		$user_nicename = $user->user_nicename;
    		echo '@'.$user_nicename;
    	}
    }
    add_filter( 'bbp_theme_after_reply_author_details', 'abc' );
    ?>

    Without ?> on line three. Would suggest putting ?> on it’s own line at the end…

    Edit : don’t know why it double posted…

    n.b. This is presuming there is nothing else in the file. If you want to add other snippets they should go after the opening <?php tag or before the closing ?> and should not break up any other php snippets…

    I just noticed that you missed the ; from the end of the add_filter line. This is important….


    Svend Rugaard
    Participant

    @svend-rugaard

    its not working and the bp-custom.php is blank … :S im giving up for now it been 2 hrs working on this now its 5 AM here and its just annoy me now 😀

    Hope i have overlook something because right now it doesnt work at least not on the post i allready have done.


    Svend Rugaard
    Participant

    @svend-rugaard

    okay im awake again, should this bp-custom.php be in my childtheme maybe thats why it isnt working ?


    Svend Rugaard
    Participant

    @svend-rugaard

    i must have been really tired yesterday so after read a little guides i found out my mistake was i have put it in child theme instead of plugin folder. Thansk for help


    Svend Rugaard
    Participant

    @svend-rugaard

    Was installing https://wordpress.org/plugins/buddypress-wall/ and it actually make the error go away .. :S

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Resolved] Mention tag in forum how to get it ?’ is closed to new replies.
Skip to toolbar