Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 751 through 775 (of 32,491 total)
  • Author
    Search Results
  • Robin W
    Moderator

    instructions for them

    find
    wp-content/plugins/bbpress/templates/default/bbpress/form-topic.php

    transfer this to your pc and edit

    go to line 248 and change

    ? esc_html_e( 'You cannot create new topics.', 'bbpress' )

    to

    ? esc_html_e( '', 'bbpress' )

    and save

    create a directory on your theme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

    where %your-theme-name% is the name of your theme

    Then transfer the file you saved above and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/form-topic.php

    bbPress will now use this template instead of the original

    #235318

    In reply to: Close topic label

    enkoes
    Participant

    Hi, thanks a lot! … feel amazed to see how coding can do the changes to our forum layout.

    This code just works fine in topic listing page.

    For topic page, it would be perfect if user can still see the [Closed] label beside the topic title.
    See https://paste.pics/N5WS0

    Regards.

    #235314
    wpturk
    Participant

    You can create a new page and put [bbp-forum-index] in it. This way, it will be your forum root page and you can edit this page.

    Here is the related documentation: 3. Creating a forum page -> Method 2

    Step by step guide to setting up a bbPress forum – Part 1

    #235313
    nextlevelg
    Participant

    Just installed the plugin and it seems to have some issues with order tracking for woocommerce plugin since it is showing a shortcode of this last plugin on the forums root page (https://nextlevelgamingstore.com/forums/), and Im not even being able to edit this page or something. How can I fix that or just edit the forums root page? Also I would like to have the forums root in a page so I can edit it.

    #235311

    In reply to: Close topic label

    wpturk
    Participant

    No, you can not use the same snippet, since these are different hooks. You can use:

    function rew_add_close_to_topics () {
    
            if ( bbp_is_topic_closed()) {
                    echo '[Closed] ' ;
            }
    }
    add_action ('bbp_theme_before_topic_title' , 'rew_add_close_to_topics', 15);
    #235294

    In reply to: Close topic label

    enkoes
    Participant

    Hi, do u mean we replace
    add_filter ('the_title' , 'rew_add_close_to_topics') ;

    with
    add_action ('bbp_theme_before_topic_title' , 'rew_add_close_to_topics', 15);?

    #235289

    In reply to: Close topic label

    wpturk
    Participant

    You can use

    add_action ('bbp_theme_before_topic_title' , 'rew_add_close_to_topics', 15);

    #235241

    In reply to: Close topic label

    Robin W
    Moderator

    I’ll add this functionality to style pack in a few days, but in the meantime

    add_filter ('the_title' , 'rew_add_close_to_topics') ;
    
    function rew_add_close_to_topics ($title) {
    	if ( bbp_is_topic_closed()) {
    		$closed = '[Closed]' ;
    		$sep = ' ' ;
    		$position = 'after' ;
    		if (($position == 'before') && !str_contains($title, $closed)) $title = $closed.$sep.$title ;
    		if (($position =='after') && !str_contains($title, $closed)) $title = $title.$sep.$closed ;
    	}
    return $title ;	
    }

    and amend words/position etc. as you wish.

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets

    and change the background of the closed block to match your theme

    #235238

    In reply to: Customizing lead topic

    Robin W
    Moderator

    so is this with this function installed?

    add_filter ('bbp_get_topic_post_date' , 'rew_change_to_freshness', 10 , 6) ;
    add_filter ('bbp_get_reply_post_date' , 'rew_change_to_freshness', 10 , 6) ;
    
    function rew_change_to_freshness ($result, $topic_id, $humanize, $gmt, $date, $time) {
    	$result = bbp_get_time_since( bbp_convert_date( $time ) ) ;
    	
    return $result ;
    }
    #235229
    wpturk
    Participant

    Probably, your theme or one of your plugin is already modifying external links to add “nofollow” attributes etc … and simultaneously breaking target="_blank" … Difficult to say before checking your theme and all your plugins. I would remove target="_blank" if it’s not working.

    #235223
    wpturk
    Participant

    🙂

    function add_custom_content($content) {
    
        $topic_id = bbp_get_topic_id();
        $user_id = bbp_get_topic_author_id( $topic_id );
    
        if ( bbp_is_user_keymaster($user_id) ) {
    
                $after ='<p><i>Still struggling with your website(s) speed? Click <strong><a href="https://example.com/" target="_blank">here</a></strong>.</i></p>';
                $content = $content . $after;
        }
        return $content;
    }
    add_filter ('bbp_get_topic_content', 'add_custom_content');
    #235221
    wpturk
    Participant

    you have to be careful with the quotation marks:

    function add_custom_content($content) {
    
        $topic_id = bbp_get_topic_id();
        $user_id = bbp_get_topic_author_id( $topic_id );
    
        if ( bbp_is_user_keymaster($user_id) ) {
    
                $after ='<p><i>Still struggling with your website(s) speed? Click <a href="https://example.com/">here</a>.</i></p>';
                $content = $content . $after;
        }
        return $content;
    }
    add_filter ('bbp_get_topic_content', 'add_custom_content');
    #235208
    wpturk
    Participant

    You can change the $before and $after variables to whatever you like. For example an external link before all topics:

    function add_custom_content($content) {
    
        $topic_id = bbp_get_topic_id();
        $user_id = bbp_get_topic_author_id( $topic_id );
    
        if ( bbp_is_user_keymaster($user_id) ) {
    
                $before ='<p>This is my <a href="https://bbpress.org/">EXTERNAL LINK</a>.</p>';
                $after ='<p>TEXT AFTER</p>';
                $content = $before . $content . $after;
        }
        return $content;
    }
    add_filter ('bbp_get_topic_content', 'add_custom_content');

    For the excerpt issue you can give a try with another priority:

    function filter_the_excerpt( ) {
        return ' ';
    }
    add_filter( 'the_excerpt', 'filter_the_excerpt', 999, 2 );
    #235189
    Philippe Roussel
    Participant

    No, that doesn’t do anything. I asked the question to the plugin author a few days ago but got no answer. One last request regarding the code you gave me earlier on: How can I insert an external link in my [TEXT]?

    #235182
    wpturk
    Participant

    Hi, I’ve not used this plugin so I don’t know how it works.

    Maybe the plugin is using the WordPress excerpt, you can try this:

    add_filter( 'the_excerpt', 'filter_the_excerpt', 10, 2 );
        function filter_the_excerpt( ) {
        return ' ';
     }
    #235177
    Philippe Roussel
    Participant

    Hi,

    I use the Post Comments as bbPress Topics plugin, which gives by default an excerpt of the concerned post. None of the other options seem to work but none of them suit me either. Expanding on the php code you gave earlier in this thread, would it be possible to simply delete all content in the topic other than “[See the full post at: …]” and, of course, my own [TEXT]?

    Thank you

    #235166

    In reply to: Formatted text

    wpturk
    Participant

    you need this additional line if you want to strip replies too:

    add_filter ('bbp_get_reply_content', 'aa_stripped_content');

    #235163

    In reply to: Formatted text

    wpturk
    Participant

    Hi, mostly formatting comes with copy-paste of html text. If you want to strip html from the text you can make use of some WordPress functions: wp_strip_all_tags(), convert_chars() etc …

    ex:

    function aa_stripped_content($content) {
        
        $content = wp_strip_all_tags($content);
        return $content;
    }
    add_filter ('bbp_get_topic_content', 'aa_stripped_content'); 
    #235139
    Robin W
    Moderator

    ok, so if you go to

    dashboard>subjects>all subjects, and then select ‘les abonnements’ (the subscriptions) for the chosen subject then select option ‘subscribe selected users’ and apply

    are they then showing as ‘sucbribed’ and this in not working, or does the subssribed/unsubscribed not change ?

    #235131
    enkoes
    Participant

    Brilliant! Thanks for the codes. Just tested and it works like a charm! 😀

    #235129
    wpturk
    Participant

    As I guessed, it’s coming from your theme

    You can try this: (it’s not tested)

    function aa_profile_title ( $title, $id ) {
    
            if ( bbp_is_single_user_profile() && empty(get_post_type($id)) ) {
    
                    $author_id = bbp_get_displayed_user_field('ID');
                    $nickname = um_get_display_name( $author_id );
                    $title = $nickname;
            }
            return $title;
    }       
    add_filter( 'the_title', 'aa_profile_title', 10, 2);
    #235126

    In reply to: Related topics!

    imFiles
    Participant

    This one works for bbpress: https://wordpress.org/plugins/contextual-related-posts/ if you want only related topics just go into Contextual Related Posts Settings and on the List tuning tab and on Post types to include select topic only. One thing it doesn’t have an automatic option to add the related items, so you need to added them either manually or the best way is with a fucntion.
    I use this one to add it after each topic:

    //add adsense after topic
    add_action( 'bbp_template_after_replies_loop', 'rew_other_topics' );
    function rew_other_topics () {
    	 $topic_id = bbp_get_topic_id() ;
    	 $forum_id = bbp_get_topic_forum_id($topic_id) ;
    	if ( function_exists( 'echo_crp' ) ) { echo_crp(); }
    }
    #235120
    wpturk
    Participant

    you have to be careful with the Quotation marks, try:

    $before ='<p style="text-align:center">TEXT BEFORE</p>';

    #235118
    enkoes
    Participant

    Hi, I would like to display nickname (and not username) in the whole bbpress forum.

    For topics list, I modified the code from a previous topic Show username instead of full name / display name and it works well so far.

    See https://paste.pics/MVA62

    The modified codes that I use is as follows:

    add_filter( 'bbp_get_reply_author_display_name' , 'rew_reply_change_to_nickname', 10 , 2 ) ;
    
    function rew_reply_change_to_nickname ($author_name, $reply_id) {
    	// Get the author ID
    	$author_id = bbp_get_reply_author_id( $reply_id );
    	$nickname = um_get_display_name( $author_id );
    return $nickname ;
    }
    
    add_filter( 'bbp_get_topic_author_display_name' , 'rew_topic_change_to_nickname', 10 , 2 ) ;
    
    function rew_topic_change_to_nickname ($author_name, $topic_id) {
    	// Get the author ID
    	$author_id = bbp_get_topic_author_id( $topic_id );
    	$nickname = um_get_display_name( $author_id );
    return $nickname ;
    }

    Note: I use Ultimate Member (UM) plugin to display user details.

    However, when comes to user profile, I’m struggling on how to force display nickname right above the avatar. Hope you can help me with that.

    See https://paste.pics/MVA6A

    Note: It’s very tedious to modify “display name publicly as” from the WordPress dashboard for every registered user. Thus hopefully codes may well do the job for me.

    #235111
    wpturk
    Participant

    Here we go:

    function add_custom_content($content) {
    
        $topic_id = bbp_get_topic_id();
        $user_id = bbp_get_topic_author_id( $topic_id );
    
        if ( bbp_is_user_keymaster($user_id) ) {
    
                $before ="<p>TEXT BEFORE</p>";
                $after ="<p>TEXT AFTER</p>";
                $content = $before . $content . $after;
        }
        return $content;
    }
    add_filter ('bbp_get_topic_content', 'add_custom_content');
Viewing 25 results - 751 through 775 (of 32,491 total)
Skip to toolbar