Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 1,976 through 2,000 (of 32,466 total)
  • Author
    Search Results
  • #217654
    Robin W
    Moderator

    I’d not spotted that it did that, it should just display on the topic !

    I’ll release a new style pack with a correction.

    If you have used my code, then this is the change at line 2098, with the lines before and after

    if ( empty( $topic ))
    		return;
    		
    //if not a topic but a reply to that topic, then return
    if (bbp_get_reply_id() != bbp_get_topic_id( (int) $r['id'] ) ) return  ;
    	
    //if participant and not their own topic, then return
    #217653
    Julia
    Participant

    Thank you for your help. Thanks to your code, I manage to set up open close button in the reply page .
    So in bbp style pack or my customized code, the open close status button sets on all comments in the reply page.
    It would be un-displayable by using CSS code except for top comment[topic author comment].

    Do you have some sample code to hide unnecessary open close status buttons by CSS(Cascading Style Sheet) ?

    Example

    
    //topic author		
    <a href="http://~   #post-1762" class="bbp-reply-header">#1762</a>
    class="bbp-topic-close-link"
    //------------------------------------------------------------------------
    //reply first
    <a href="http://~   #post-1763" class="bbp-reply-header">#1763</a>
    class="bbp-topic-close-link"
    
    #bbpress-forums  XXX.bbp-topic-close-link {
            display: none;
      }
    
    #217644
    akula2
    Participant

    Hi @karado58,

    Thank you for help response, yes the code work very good!!
    Thanks very much!!!!

    #217641
    Robin W
    Moderator

    ok so

    find
    wp-content/plugins/bbpress/templates/default/bbpress/loop-single-forum.php

    transfer this to your pc and edit

    find

    <?php do_action( 'bbp_theme_before_forum_title' ); ?>
    
    		<a class="bbp-forum-title" href="<?php bbp_forum_permalink(); ?>"><?php bbp_forum_title(); ?></a>
    
    		<?php do_action( 'bbp_theme_after_forum_title' ); ?>

    and replace with

    <?php do_action( 'bbp_theme_before_forum_title' ); ?>
    		
    		<?php if  (!bbp_is_forum_category( bbp_get_forum_id())){ ?>
    
    		<a class="bbp-forum-title" href="<?php bbp_forum_permalink(); ?>"><?php bbp_forum_title(); ?></a>
    		
    		<?php } else { ?>
    		
    		<div class="bbp-forum-title"> <?php bbp_forum_title();?> </div>
    		<?php }
    		?>
    		
    		<?php do_action( 'bbp_theme_after_forum_title' ); ?>

    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/loop-single-forum.php

    bbPress will now use this template instead of the original

    you will probably need to add some styling to the class “bbp-forum-title”

    #217633
    Robin W
    Moderator

    this option is in

    bbp style pack

    dashboard>settings>bbp style pack>Topic/Reply Display>item 17

    if you want to see the code it is in that plugin

    \bbp-style-pack\trunk\includes\functions.php

    starting at line 2066

    #217628
    Julia
    Participant

    Addding close topic select box in the reply page

    Only the moderate can set up open/close on topic status now.
    I have plan to change the author in topic to set open/close status by yourself.

    The code ongoing

    
    function my_bbp_theme_before_topic_form_submit_wrapper() {
        
        if (!current_user_can('moderate', $topic_id)) {   //  The all visitor can see open/close box
            echo '<label for="bbp_topic_status">'.esc_html_e('Topic Status:', 'bbpress').'</label><br />';
            bbp_form_topic_status_dropdown();
        }
    }
    add_action('bbp_theme_before_topic_form_submit_wrapper', 'my_bbp_theme_before_topic_form_submit_wrapper');
    
    function my_bbp_get_topic_statuses($topic_statuses, $topic_id) {
    
        //  The all visitor may be possible to chang the topic status,if the select box works.
        if (!current_user_can('moderate', $topic_id)) {
            $topic_statuses = array(
                bbp_get_public_status_id() => _x('Open', 'Open the topic', 'bbpress'),
                bbp_get_closed_status_id() => _x('Closed', 'Close the topic', 'bbpress')
            );
        }
        return $topic_statuses;
    }
    add_filter('bbp_get_topic_statuses', 'my_bbp_get_topic_statuses', 10, 2);
    

    Two questions

    1st
    The topic open/close select box is shown all visitor except for author.
    So this code need to change all vistor to topic author.
    But I don’t know.

    
    if (!current_user_can('moderate', $topic_id)) {  // All visitor can do
    ↓
    if(current_user_can( '//topic author//' ) ) {    // Only topic author can do
    

    2nd
    The select box is shown, but it doesn’t work at all.
    In short, the select box is appearance only.
    So I have to add some code to work open/colse select box.
    The select box does not link to topic status function.
    But I don’t know how to chage the code.

    
        $topic_statuses = array(
        bbp_get_public_status_id() => _x('Open', 'Open the topic', 'bbpress'),
        bbp_get_closed_status_id() => _x('Closed', 'Close the topic', 'bbpress')
        )
    
    #217612
    Reed Sutton
    Participant

    Anyone know why a post isn’t displaying in the forum topic index on my site?
    URL: https://frugalflyer.ca/forum/

    Using this shortcode:
    [bsp-display-topic-index show=’10’ template = ‘short’ show_stickies=’true’ noreply=’true’]

    Screenshot: https://imgur.com/a/6U5ZVAu

    #217610
    sbask
    Participant

    “We are happy with them having no FORUM role (only a site role) when the account is created. The problem of the being able to log them out when the account is created is not related – please note they are separate, and only one is a problem. We do not want to assign, by BBPress settings or code, any account a forum role. We only want them to earn a forum role when they log in to the site, as they do. This was specific custom code added after an earlier change, and took the devs to get it done.”

    #217607
    Robin W
    Moderator

    you could just untick the ‘automatically give’ in the forums settings and then add it yourself on login eg untested

    add_action('wp_login', 'rew_assign_role_on_login', 10, 2);
    
    rew_assign_role_on_login ($user_login, $user) {
    $user_id = $user->ID ;
    $role = bbp_get_user_role( $user_id );
    	if ( empty( $role ) ) {
    		bbp_set_user_role( $user_id, bbp_get_participant_role() );
    	}
    }
    Robin W
    Moderator

    that’s great.

    You might want to take a look at bbp_new_topic_handler which I took this code from and gives you checks for all the parameters.

    which is in

    bbpress 2.6.6\includes\topics\functions.php line 96 onwards

    to see what checks bbpress does to the data before processing. This function is used by the new topic form.

    the content is hooked to 4 functions, 3 of which are removed for capable uses on line 140 etc.

    presuming that you are creating the content so will not be trying to break or do naugthy things, then you can probaby ignore these.

    bbpress does one more it calls the function bbp_code_trick from the filter on line 173

    which is this in bbpress 2.6.6\includes\common\formatting.php

    function bbp_code_trick( $content = '' ) {
    	$content = str_replace( array( "\r\n", "\r" ), "\n", $content );
    	$content = preg_replace_callback( "|(<code>)(.*?)</code>|",      'bbp_encode_callback', $content );
    	$content = preg_replace_callback( "!(^|\n)<code>(.*?)</code>!s", 'bbp_encode_callback', $content );
    
    	return $content;
    }

    If you’re trying things, then I’d suggest you create some draft items in bbpress and then see what content is in the database to see what you would need to save there.

    Robin W
    Moderator

    you don’t say how technical you are, but if you can do basic coding, the guts of creating a topic is

    $topic_data = array(
    		'post_author'    => $topic_author,
    		'post_title'     => $topic_title,
    		'post_content'   => $topic_content,
    		'post_status'    => $topic_status,
    		'post_parent'    => $forum_id,
    		'post_type'      => bbp_get_topic_post_type(),
    		'tax_input'      => $terms,
    		'comment_status' => 'closed'
    	) ;
    
    	// Insert topic
    	$topic_id = wp_insert_post( $topic_data, true );
    //this updates counts subscriptions etc,
    do_action( 'bbp_new_topic', $topic_id, $forum_id, $anonymous_data, $topic_author );

    so you could wrap the above in a function and create a 2nd function that creates the above variables, and then loops round the 8 forum_id’s to create 8 topics

    #217596
    JLee
    Participant

    Looks like you are being ignored, no one wants to help you!!

    I’ve only been learning CSS code for about 2 weeks, but I happily try and help you. Try this below.

    Removes Last Post:

    li.bbp-forum-freshness, li.bbp-topic-freshness 
    {
       
     display: none;
    } 

    Shifts Topics/Posts to right side:

     li.bbp-forum-info, li.bbp-topic-title 
    {
        float: left;
        text-align: left;
        width: 75%;
    } 
    #217589
    Robin W
    Moderator

    may need some tinkering, but something like

    add_filter( 'bbp_get_topic_permalink', 'rew_add_forum_id', 10, 2) ;
    
    function rew_add_forum_id ($topic_permalink, $topic_id ) {
    	$forum = bbp_get_topic_forum_id( $topic_id) ;
    	if ($forum == '2925') {
    		//append ?id etc.
    		$topic_permalink.= '?id=2925' ;
    	}
    return $topic_permalink ;
    }
    #217588
    sasasasaaa
    Participant

    Hi, after long searching and trying and testing my last chance is to ask here.
    I have added a special forum with shortcode in a course page and want to give all topic links, which appear in the course forum, a “?id=” at the end of the urls (the ID is the course id).

    I use a customize breadcrumb. And if I have the course ID in the url of single topic page I can use it to show correct breadcrumb.

    Does anybody know how to add “?id=” at the end of the topic links on the forum pages?

    Help is very much appreciated.

    Thanks a lot

    #217568

    In reply to: create a un function

    Robin W
    Moderator

    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

    add_filter( 'bbp_get_reply_content', 'rew_add_class' , 10 , 2) ;
    
    function rew_add_class ($content, $reply_id ) {
    	$content.='<div class="frenchlemans">I’m superman</div>' ;
    return $content;
    }
    #217562

    In reply to: create a un function

    Robin W
    Moderator

    ok, let us try and get to what you want.

    so if the content of a reply was ‘hello how are you ?’

    then at the moment bbpress would show

    <div class="bbp-reply-content">
    hello how are you ?
    </div>

    what would you like it to show?

    #217555

    In reply to: create a un function

    Robin W
    Moderator

    so if you currently have

    <div class="bbp-reply-content">
    
    This is the content
    
    </div>

    what do you want it to look like ?

    #217533
    memphremagog
    Participant

    Hello all,

    I have already configured WordPress in French. I am using the version 5.6–fr_CA, but bbpress is not translated as mentioned here : https://codex.bbpress.org/getting-started/bbpress-in-your-language/

    So I followed steps 1 and 2 indicated on the website, but the translation still doesn’t work. Do you have a solution?

    I am using version 2.6.6 of bbpress. My website is the following: https://adaptationmemphre.ca

    Thank you very much,

    chandra08
    Participant

    Hello, I dont know if I’m asking in the right place.

    But, I want to ask about code that has a connection with BBpress.

    I want to make a button in javascript that alert reply id of the user.

    This is my code:

    function engagement_post($reply_id = 0){
    
        $get_reply_id = bbp_get_reply_id($reply_id);
        $get_author_id= bbp_get_reply_author_id( $get_reply_id );
        echo $get_reply_id;
    
        ?>
        <style>
    
        .buttons{
                    background-color: #E8E8E8;
                    border-radius: 12px;
                }
    
        </style>
        
        <button class="buttons" onclick ="myFunction(this)" name="button1" type="button1" style="font-size:10px">BUTTON</button> 
    
        <script>
        const data =[
    
            {id: '<?php echo $get_reply_id ?>'}
        ];
        
        function myFunction(){
            var id = $(data).attr("id");
            alert('Button Clicked!, Reply ID:'+id);
    
        }
    
        </script>
    
        <?php
    
    }add_action('bbp_theme_after_reply_content', 'engagement_post');

    I’m already tried, but not find the answer. The code seems like only alert the first topic id. I mean, after topic id, the reply still alert same id. Example: Topic ID: 474, and then the other user reply and have reply id: 475, the javascript still alert 474.

    The purpose of this code, I want to make like and dislike button. So I need to make every button know what kind of reply id is it.

    All answer is very appreciated. Thank You Very Much

    #217512
    wpturk
    Participant

    Shortcodes are not allowed in bbpress post as default. You need to check your code/plugin which allows shortcodes in bbpress posts, there might be the problem.

    #217503

    In reply to: GD Attachments Archive

    Milan Petrovic
    Participant

    WP_Query doesn’t return the results, it is an object holding a lot of things, including the results. Check out how to use WP_Query for the loop, there are many examples on WordPress.org and elsewhere. And, results are also objects, so you need to create code to take the object and display the results.

    #217498
    Julia
    Participant

    bbp_theme_before_forum_title

    I could not do it.
    It is same loop with bbp_theme_after_forum_title

    bbpress.org shows that “23. Show the bbPress forum search everywhere”.
    Layout and functionality – Examples you can use

    But it may be that there is not hook point to set on the search form above of the title.

    #217493
    Robin W
    Moderator

    try

    bbp_theme_before_forum_title

    #217480
    adamisrael
    Participant

    We’ve been using wp-poll to insert polls into topics, but after moving web hosts and upgrading to bbPress 2.6.6 and WordPress 5.5 the shortcodes don’t appear to be working.

    If I create a topic and put in the shortcode ‘[poll id=”93″]’, the post simply shows that shortcode. It doesn’t look like the shortcodes being rendered.

    Has anyone seen this before, or have ideas on what I can try to get polls working again?

    Thanks!

    #217479
    Julia
    Participant

    Thank you for your help.
    But your code does not work correctly.

    bbp_template_before_replies_loop
    in reply page
    [Title]
    [Breadcrumb]
    [Search form]

    bbp_theme_after_forum_title
    in forum page
    [Forum title]
    [Search form]
    [Forum title]
    [Search form]
    [Forum title]
    and loop

    These are not my target.

Viewing 25 results - 1,976 through 2,000 (of 32,466 total)
Skip to toolbar