Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 751 through 775 (of 32,358 total)
  • Author
    Search Results
  • #233696
    pcwd
    Participant

    Hi

    I would like to customize the labels on the login page at
    bbpress login, password fields and the button text.

    I see some related PHP code at https://codex.wordpress.org/Customizing_the_Login_Form#Make_a_Custom_Login_Page

    Could you please suggest how to add that code to my website? Thank you so much!

    #233694
    leon1912
    Participant

    Thank you for the reply @robin-w 🙂

    When I select PHP cron event, should I enter the code in there and delete the snippet? Because when I click PHP cron event, a code editor will open.

    #233693
    Robin W
    Moderator

    ok, so delete the previous code and put this code instead

    function bbpress_close_old_topics() {
    	// Auto close old topics
    	$topics_query = array(
    		'author' => 0,
    		'show_stickies' => false,
    		'parent_forum' => 'any',
    		'post_status' => 'publish',
    		'posts_per_page' => -1
    	);
    	if ( bbp_has_topics( $topics_query ) )
    		while( bbp_topics() ) {
    			bbp_the_topic();
    			$topic_id = bbp_get_topic_id();
    			$topic_date = strtotime( get_post( $topic_id, 'post_date', true ) );
                    $forum_id = bbp_get_topic_forum_id($topic_id);
                    if ($topic_date < strtotime( '-2 hours') ) // && $forum_id == 1276 )
                        bbp_close_topic( $topic_id );
    		}
    }

    In other words we take out the cron scheduling functions from the code

    then

    Event type: PHP cron event
    Hook name: bbpress_close_old_topics
    arguments: none
    next run: now
    repeat: hourly

    That should do it, you should see it as an event.

    If you have a topic already set to expire, it should do so immediately as you have schgeduled to run ‘now and then every hour’ in the above.

    #233683
    enkoes
    Participant

    Hi, I’m thinking of hiding some items in forum & topic page as follows:

    Forum page:
    1) to hide forum information
    2) to hide topic viewing information
    see screenshot: https://paste.pics/KS7KD

    Topic page:
    1) to hide topic information
    2) to hide post viewing information
    3) to hide topic header (author & posts)
    see screenshot: https://paste.pics/KS7MF

    Are there any CSS codes that can achieve that?

    #233676
    leon1912
    Participant

    Hey @robin-w,
    thanks for your reply.
    I changed the code right away after you sent the reply.

    But it still does not work and I’m note sure why.

    #233652
    Robin W
    Moderator

    a cron event only runs at the interval specified, so the check event runs once a day ie

    wp_schedule_event(time(), 'daily', 'bbpress_daily_event');

    so would only close topics older than 2 hours once a day.

    suggest changing that line to

    wp_schedule_event(time(), 'hourly', 'bbpress_daily_event');

    so it would run every hour, so topics would be closed between 2 and 3 hours depending on when cron runs in relation to their creation.

    #233651
    leon1912
    Participant

    Hello!
    I used the code from @robin-w and pasted it into a code snippet but it does not seem to work. That is my code:

    register_activation_hook(__FILE__, 'bbpress_topic_scheduler');
    
    add_action('bbpress_daily_event', 'bbpress_close_old_topics');
    
    function bbpress_topic_scheduler() {
     wp_schedule_event(time(), 'daily', 'bbpress_daily_event');
    }
    
    function bbpress_close_old_topics() {
    	// Auto close old topics
    	$topics_query = array(
    		'author' => 0,
    		'show_stickies' => false,
    		'parent_forum' => 'any',
    		'post_status' => 'publish',
    		'posts_per_page' => -1
    	);
    	if ( bbp_has_topics( $topics_query ) )
    		while( bbp_topics() ) {
    			bbp_the_topic();
    			$topic_id = bbp_get_topic_id();
    			$topic_date = strtotime( get_post( $topic_id, 'post_date', true ) );
                    $forum_id = bbp_get_topic_forum_id($topic_id);
                    if ($topic_date < strtotime( '-2 hours') ) // && $forum_id == 1276 )
                        bbp_close_topic( $topic_id );
    		}
    }

    The auto close time is set to 2 hours to test it and I created a comment after 2 hours because it should happen in every forum.

    Have I done anything wrong? Thanks in advance! 🙂

    #233631
    Robin W
    Moderator
    room34
    Participant

    I’m just setting up bbPress on my site (WordPress 6.1.1, custom theme non-Block Editor/Gutenberg).

    I found interior forum pages are working but the main landing page was not. I was able to work around that by setting up a regular page and using the [bbp-forum-index] shortcode, but I see the user profile pages are still not working (and they are doing exactly what the forum index page was doing before).

    Here’s an example:
    https://icscalendar.com/forums-home/users/room34/

    It’s possible this is a problem with my theme, but I’m not immediately sure what might be wrong (and I’d like to fix this without having to test for plugin/theme conflicts because this is my live site and I don’t have a staging environment set up… yet).

    I’m guessing it may be a routing issue… I do have some code in my theme that uses the template_include filter.

    #233625
    Robin W
    Moderator

    tried those, still cannot replicate.

    Can you try changing the forums in forum='6,8,14' to see if it is one of those affecting?

    #233621
    enkoes
    Participant

    I found that something gone wrong with topic display shortcode:

    I used [bsp-display-topic-index show='20' forum='6,8,14'] in my topic display, but found out that bbPress sidebar couldn’t display any widget in the same page.

    After I shifted to [bbp-topic-index], bbpress sidebar back to normal (ie, can display widget)

    Is it some kind of glitch? How to solve it if I really want to use bsp display shortcode somehow?

    #233613
    SirLouen
    Participant

    I have to say that I’m pretty impressed by the fact that GD bbPress Tools Pro plugin has sent today news regarding the update to the next big version (7.0) and Milan will be upgrading the topic and replies system to a completely separate table.

    He says that this will increase efficiency for an obvious reason (indexing of wp_postmeta for such large amount of data in many forums is obviously one of the Achilles talon of bbPress).

    But to some extent I feel that this will be like a “fork” of the bbPress project.

    I’m uncertain if Milan is a regular user of these forums, but I would like to see your opinions on this movement. I’ve been using GD bbPress Tools for ages because it really complements well all my devs for bbPress on my forums (and I don’t have to be duplicating the code to perform most of the features that he has already implemented), but I’m pretty skeptical that this could be a major caveat for future releases and too much attachment to Milan (in case something happens to him, and considering that this is not open sourced).

    I’m not sure either if he will be implementing this for the free version in the WordPress repo.

    Furthermore, I may also ask this in his private forum, but I was looking for more opinions in this official forum.

    PS: Yes, Milan is around as expected @gdragon

    #233606
    Robin W
    Moderator

    note tested but possibly

    #bbpress-forums .bbp-parent-forum-12345 p.bbp-topic-meta .bbp-topic-started-in a {
        background-color: #328C00;
    }
    
    #bbpress-forums .bbp-parent-forum-12346 p.bbp-topic-meta .bbp-topic-started-in a {
        background-color: #ff4b33;
    }
    #233599
    Robin W
    Moderator
    #bbpress-forums p.bbp-topic-meta .bbp-topic-started-in a {
        background-color: #328C00;
    }

    put this in your themes custom css area

    #233596
    enkoes
    Participant

    I’m using shortcode bbp-topic-index as my forum frontpage. I would like to style my page similar to how it look like in bbpress support forum. My question is how do I highlight those forum names beside each topic created?

    see screenshot: https://paste.pics/KPDVE

    malachite
    Participant

    /wp-content/plugins/bbpress/includes/admin/classes/class-bbp-converter-db.php

    I commented out lines 33-37:

    // register_shutdown_function( array( $this, '__destruct' ) );
    // 
    // if ( WP_DEBUG && WP_DEBUG_DISPLAY ) {
    //    $this->show_errors();
    // }
    #233564
    malachite
    Participant

    I started getting this error after I upgraded to PHP 8.1. It prevents login, so this is a problematic error. BBPress is trying to setup a new login object and in the process wants to destroy any existing login object. Because BBPress doesn’t actually have a __destruct method php8.1 throws an error. I commented out that block of code and everything seems to work correctly. Of course that is a temporary fix that will be overwritten as soon as the plugin is updated.

    I don’t have Jetpack installed on this server so it is not the culprit.

    #233526
    Robin W
    Moderator

    the dot for ‘new thread/response’ remaained for one.

    sorry, not sure what this means, can you post an image

    #233504
    izzi8181
    Participant

    Thanks, I’ve actually already installed that and it does fix some of the issues I have, but not the main ones (they are a bit more unusual, thanks to the theme, so I need to alter the code somewhere).

    #233499
    izzi8181
    Participant

    New user, first post 🙂 I am using the Reign theme by WBCom, and I really like it, except for the layout of the BBPress forum index page, and the topic page. I’d really rather not have to switch to a new theme (already paid for Reign, don’t want to pay for another theme!) so I’d like to see if I can alter it myself to get what I want.

    Some general info: I taught myself html back in the 90s, so I’m OK with html and css, but I never got as far as php. However I can probably grasp the basics.

    I tried out the Youzify plugin and it does a lot of the layout styling that I want, but changes other things that I don’t want. Would it be possible to use the code from this to guide me to make the alterations I want?

    I’m stuck at the start: which file/s would I find the layouts? (css is about styling, I’m looking for table structure, where information is displayed, that sort of thing).

    Thanks!

    DeepBlue
    Participant

    Hi

    With the great bbp style pack plugin, with active moderation on moderation tab, we can approve any new topic or reply from a new user

    is it possible to use a shortcode to show all topics / replies “pending” (so the ones that require approval)

    that would be nice for moderator to have all contents to approve at the same place in frontend

    Is it something already doable with an existing shortcode ?

    Thank

    #233473
    Robin W
    Moderator

    just can just add it to the other one

    add_filter( 'gettext', 'rew_change_must_be_text', 30, 3 );
    
    function rew_change_must_be_text( $translated_text, $text, $domain ) {
    	if ( $text == 'You must be logged in to create new topics.' && bbp_get_forum_id() == 2927 ) {
    		$translated_text = 'new text here' ;
    	}
    if ( $text == 'You cannot create new topics' && bbp_get_forum_id() == 2927 ) {
    		$translated_text = 'new text here' ;
    	}
    	return $translated_text ;
    }
    Robin W
    Moderator

    in this part

    bbp_get_forum_id() == 2927

    so for your forum, go to

    dashboard>forums>all forums and select ‘edit’ of the forum you want

    At the top of your browser in the url bat you will see

    http://mysite.com/wp-admin/post.php?post=2927&action=edit

    2927 is the number of that forum, in my case 2927

    enkoes
    Participant

    Hi Robin, where do I specify the FORUM ID in the codes given?

    Robin W
    Moderator

    sorry, late in the day when I looked at this. change the forum id and text you want below to the one you want. if you want it blank, then $translated_text = ''

    add_filter( 'gettext', 'rew_change_must_be_text', 30, 3 );
    
    function rew_change_must_be_text( $translated_text, $text, $domain ) {
    	if ( $text == 'You must be logged in to create new topics.' && bbp_get_forum_id() == 2927 ) {
    		$translated_text = 'new text here' ;
    	}
    	return $translated_text ;
    }

    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

Viewing 25 results - 751 through 775 (of 32,358 total)
Skip to toolbar