Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 1,251 through 1,275 (of 32,432 total)
  • Author
    Search Results
  • #226570
    khellstr
    Participant

    If I understood correctly, those settings affect only to widgets that are placed somewhere, on the sidebar, footer etc.

    If I use a Shortcode to place the widget in the Page it will not read those settings, instead it shows the default settings (no links).

    …maybe I’m doing this someway wrong, or not like it should be done, I’m quite new to WP and totally new to this “new” WordPress.

    khellstr
    Participant

    Hi,

    I’m trying to access the bbPress widget settings but WP opens the “new” widget editor when I go to Apperance –> Widgets. I have WordPress 5.8.3 Installed, and newest bbPress.

    How can I access these settings show in this image:
    Properties

    In the background there is what I get and in the foreground what I want. It is from a tutorial I’m following.

    I want to add the widget to the page with a Shortcode, and links aren’t working if I don’t have access to settings.

    #226564
    donal13
    Participant

    Robin-w the site is offline. I actually use it for notes on my clients dealings. It did not work for me and I even tried the plugin as well. Seen as it worked for neon67 I can only assume its a plugin that is causing me the problem. I changed the theme to the default WP theme and it did not work. I will deactivate the plugins over the weekend and try the code again and hopefully it will work.

    #226556
    Robin W
    Moderator

    ok so 2 things you can do here

    1. add a label

    add_action ('bbp_theme_before_topic_form_content' , 'rew_content_title') ;
    
    function rew_content_title () {
    echo '<label for="bbp_topic_content">Topic Content</label><br />' ;
    }

    Just change ‘Topic Content’ to whatever you wish

    2. add back the editor

    add_action( 'wp_footer', 'rew_supports_js' );
    
    function rew_supports_js() {
    	echo '<script>document.body.classList.remove("no-js");</script>';
    }

    Put these 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

    #226549
    Robin W
    Moderator

    Solo puedo sugerirle que use el traductor de Google o el traductor de su navegador, para ver este enlace

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

    #226546
    Robin W
    Moderator

    have you tried this

    add_action( 'wp_footer', 'rew_supports_js' );
    
    function rew_supports_js() {
    	echo '<script>document.body.classList.remove("no-js");</script>';
    }

    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

    #226469
    Adeel Mughal
    Participant

    if it’s wp search then why do they have setting bbpress forum-wide search in bbpress settings?

    should I need to look at wp search core code or queries?

    #226468
    Milan Petrovic
    Participant

    bbPress search has no options, it is the same as WP search, so if you havw code modifying WP search it will affect bbPress search also.

    #226467
    Adeel Mughal
    Participant

    Thanks for replying.

    Title and content, and topic replies are not considered as content? that’s why not search from topic replies?

    Do I have to do that customization on bbpress search side? because right now I am using default bbpress search.

    Can you tell me where should I have to add code or can you refer me to any site where I can check and modify code

    #226466
    Milan Petrovic
    Participant

    By default, WP search works on content and title. But, there are plugins and/or custom code that can change that. Maybe you have some custom code to modify the search scope.

    neon67
    Participant

    Happy new year 2022! we have already arrived.
    but the code doesn’t work again 🙂
    now your new code is on air .. but .. you can go to the same addresses

    Robin W
    Moderator

    ok, lets try agian and see if we can get there.

    Your site has

    https://imhodom.ru/forums/users/ox/replies/

    so we need to check for ‘/users/’ and ‘/replies/’

    and we’ll try and up the priority so that other code does not overwrite

    add_action( 'bbp_template_redirect', 'neon_check_replies', 100);
    
    function neon_check_replies(){
    	//only execute if the url contains both /user/ and /replies/, so test for this first
    	if (strpos($_SERVER['REQUEST_URI'], '/users/') !== FALSE  && strpos($_SERVER['REQUEST_URI'], '/replies/') !== FALSE) wp_redirect( 'https://imhodom.ru/forums' );
    }
    
    neon67
    Participant

    I pasted the code, but …

    it should look like this
    https://imhodom.ru/forums/users/ox/topics/ – lock оr redirect…
    but it doesn’t work like want (that’s want to fix)
    https://imhodom.ru/forums/users/ox/replies/

    Please delete this message as you see.
    The last advice code is inserted and works.

    Robin W
    Moderator

    ok, so if the replies link goes to

    https://mysite.com/forums/user/admin/replies/

    then this

    add_action( 'bbp_template_redirect', 'neon_check_replies');
    
    function neon_check_replies(){
    	//only execute if the url contains both /user/ and /replies/, so test for this first
    	if (strpos($_SERVER['REQUEST_URI'], '/user/') !== FALSE  && strpos($_SERVER['REQUEST_URI'], '/replies/') !== FALSE) wp_redirect( 'https://mysite/home' );
    }

    will send anyone clicking the link to the site home page

    what does it do for you?

    neon67
    Participant

    Does this code work for you?
    If so, I will look on my side myself.
    You’ve done so much for me.

    neon67
    Participant

    I paste the code down before the sign ?>
    The first code worked – redirected the address with the word ‘users’.
    The second code doesn’t make any changes by the look.

    Robin W
    Moderator

    ok try this

    add_action( 'bbp_template_redirect', 'neon_check_replies');
    
    function neon_check_replies(){
    	//only execute if the url contains both /users/ and /replies/, so test for this first
    	if (strpos($_SERVER['REQUEST_URI'], '/users/') !== FALSE  && strpos($_SERVER['REQUEST_URI'], '/replies/') !== FALSE) wp_redirect( 'https://example.com/some/page' );
    }
    neon67
    Participant

    Further study of the code showed that works for all addresses where /users/.
    It closes the profile / forums / users / name /
    And doesn’t work for / forums / users / name / replies /

    Robin W
    Moderator

    This function will take all attempts to go to the replies page to whatever url you want

    add_action( 'bbp_template_redirect', 'neon_check_replies');
    
    function neon_check_replies(){
    	//only execute if the url contains both /users/ and /replies/, so test for this first
    	if (strpos($_SERVER['REQUEST_URI'], '/users/') == FALSE  && strpos($_SERVER['REQUEST_URI'], '/replies/') == FALSE) return ;
    	else wp_redirect( 'https://example.com/some/page' );
    }

    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

    Robin W
    Moderator

    ok, so using this process for each of the following files in place of xxfilexx.php below

    find
    wp-content/plugins/bbpress/templates/default/bbpress/xxfilexx.php

    transfer this to your pc and edit

    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/xxfilexx.php

    bbPress will now use this template instead of the original

    so template 1.

    \templates\default\bbpress\user-profile.php

    to remove lines 42 & 43 to tale out the counts if you wish.

    then template 2

    templates\default\bbpress\user-details.php

    take out lines 34-60

    then templates

    \templates\default\bbpress\user-topics-created.php
    \templates\default\bbpress\user-replies-created.php

    take out all the code between the 2 ‘do_action’ lines

    That should get you there

    #226353
    Robin W
    Moderator

    ok, so you say you get an error

    Error thrown
    Call to a member function get_users_for_object() on null

    is this the entire error, or is there more?
    when does this occur eg on every website page, on bbpress pages, on particular pages ?

    #226283
    mica123
    Participant

    It is so long ago since I used it. I am not sure which theme you are using – it really depends on that. I was using the old Responsive theme and @robkk advised me to use a different code for the bbpress.php file. I am coying what I found in my files for you here, but I really don’t know if this is the correct one. Unfortunately, @robkk is not active any more – he was truly wonderful.

    <?php
    
    // Exit if accessed directly
    if ( !defined( 'ABSPATH' ) ) {
    	exit;
    }
    
    /**
     * bbPress Template
     *
     *
     * @file           bbpress.php
     * @package        bbPress
     * @author         Robkk
     * @version        Release: 1.0
     * @filesource     wp-content/themes/responsive/bbpress.php
     * @link           https://codex.bbpress.org/themes/theme-compatibility/getting-started-in-modifying-the-main-bbpress-template/
     * @since          available since Release 2.4
     */
    
    get_header(); ?>
    
    <div id="content-full" class="grid col-940">
    
    	<?php if ( have_posts() ) : ?>
    
    		<?php while( have_posts() ) : the_post(); ?>
    
    			<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    				<h1 class="entry-title post-title"><?php the_title(); ?></h1>
    
    				<div class="post-entry">
    					<?php the_content(); ?>
    				</div>
    				<!-- end of .post-entry -->
    
    				<div class="post-edit"><?php edit_post_link( __( 'Edit', 'responsive' ) ); ?></div>
    
    			</div><!-- end of #post-<?php the_ID(); ?> -->
    
    		<?php endwhile; ?>
    
    	<?php endif; ?>
    
    </div><!-- end of #content-full -->
    
    <?php get_footer(); ?>
    
    #226263
    TKServer
    Participant

    Recently my MYSQL CPU usage went from 40% to over 100% and my server has been slowing down as a result. In doing some research I’ve learned to setup some mysql logging for slow queries. I have a particular query that happens often. In the query below it appears that over 700,000 rows are queried in the DB taking up almost 3 seconds. Imagine that times however many users and it is bogging the site down. Is this query below from bbpress or how can I tell? It’s hard to trace where it is being called:

    # Time: 211220 17:42:06
    # User@Host: mysite_wp[mysite_wp] @ localhost []
    # Thread_id: 1667  Schema: mysite_wp  QC_hit: No
    # Query_time: 2.641487  Lock_time: 0.000104  Rows_sent: 10  Rows_examined: 717793
    # Rows_affected: 0  Bytes_sent: 188
    SET timestamp=1640047326;
    SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id )  INNER JOIN wp_postmeta AS mt1 ON ( wp_posts.ID = mt1.post_id ) WHERE 1=1  AND (
      wp_postmeta.meta_key = '_bbp_last_active_time'
      AND
      (
        ( mt1.meta_key = '_bbp_forum_id' AND CAST(mt1.meta_value AS SIGNED) != '1773' )
      )
    ) AND wp_posts.post_type = 'topic' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'closed') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10;
    #226202
    Robin W
    Moderator

    This is a bug in bbpress – yet to be fixed.

    In the meantime install

    bbp style pack

    which should fix

    or

    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

    if( !function_exists( 'bbpress_browser_supports_js' ) ){
    	function bbpress_browser_supports_js() {
    		echo '<script>document.body.classList.remove("no-js");</script>';
    	}
    	add_action( 'wp_footer', 'bbpress_browser_supports_js' );
    }
    #226171

    In reply to: Issue with Polylang

    xxreef
    Participant

    Hi robin,
    in my situation for the default language
    http://domain.com/forums/topic/admin-gui/edit/
    work with flag “Hide URL language information for default language”,

    but for the others language the rewrite rule is triggered for edit, and add /it/, and 404 is raised.

    Bye Renzo

Viewing 25 results - 1,251 through 1,275 (of 32,432 total)
Skip to toolbar