Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 5,251 through 5,275 (of 32,518 total)
  • Author
    Search Results
  • Scott N
    Participant

    @talkedtv — I know it’s been three years, but if you can remember and describe here how your theme caused this problem and how you fixed it, I’d be most appreciative! My forum search is exhibiting the exact same behavior, and I am using a highly customized theme, including custom bbPress templates.

    EDIT: I did come up with a workaround, but it’s clunky as it requires creating a blank placeholder page with the slug search. In my page.php template, right after the_post() is called, I added this:

    if ( strpos($_SERVER['REQUEST_URI'], '/search/') === 0 ) {
        $post = get_page_by_path('search');
    }
    #183742

    In reply to: TTFB problem

    newz12
    Participant

    I have hired someone to look at the database and this is his comments:

    ==========================================

    so, basically your query is processing too many records in a couple of tables wp_posts(1’980’935 records) and wp_postmeta(10’818’678). It matches and returns 57’639 records.

    The core query is:
    select SQL_NO_CACHE wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1 AND (wp_posts.ID = 515125 OR wp_posts.post_parent = 515125);

    which returns 399’291 record for 2.1s
    which is a huge join

    Then the extra “where” conditions add extra time. The query bellow:

    select SQL_NO_CACHE wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1 AND (wp_posts.ID = 515125 OR wp_posts.post_parent = 515125) AND wp_postmeta.meta_key = ‘_bbp_forum_id’;

    reduces the returned records to: 57’639 and in fact the rest of the where statements do not change the final result but are only adding more time for processing.
    The query takes about 3s.

    Both queries above are well indexed and are execucuted in the optimal way.
    With this amount of returned records matched against the 2 big tables (~11mln and ~2mln records in each) executon time of less than 3s can not be achieved.

    is this forum using a custom php code developed in house?

    ME: It is using bbPress, which runs on WordPress

    the thing is, this code is not optimal in term of database design
    because it’s using a couple of wordpress general storage tables
    to store the forum posts and threads
    as you can guess this 2 tables have a lot more data in it along the forum data
    from other hand the query you sent has too many “where” conditions
    which are not relevant at all

    AND CAST(wp_postmeta.meta_value AS SIGNED) NOT IN (‘515120′,’515123’) ) )
    AND wp_posts.post_type IN (‘topic’, ‘reply’)
    AND (
    (wp_posts.post_status = ‘publish’ OR (wp_posts.post_status = ‘pending’ AND wp_posts.post_author = 0) OR wp_posts.post_status = ‘closed’ OR wp_posts.post_status = ‘hidden’)
    OR
    (wp_posts.post_author = 0 AND (wp_posts.post_status = ‘private’))
    )

    non of this are changing the final result at all, but are slowing the core query with extra time

    in short – there is not an easy “magic” fix in the database side
    as I said the core query is well indexed and runs optimal by the SQL engine
    the only thing can be done is to change the query a bit
    but we can hardly get it under 2.5s
    and this will require PHP code changes

    ME: What would be your suggestion to achieve a similar performance with database?

    get rid of the WP
    the WP pluggin you use is a forum implementation on top of WP
    understand that, but you are expecting something by this WP pluggin that it can’t provide

    with storring everyhing in a couple of tables – that can’t be done

    won’t even comment:
    AND CAST(wp_postmeta.meta_value AS SIGNED) NOT IN (‘515120′,’515123’) ) )

    this part
    wp_postmeta | CREATE TABLE wp_postmeta (
    meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    post_id bigint(20) unsigned NOT NULL DEFAULT ‘0’,
    meta_key varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
    meta_value longtext COLLATE utf8mb4_unicode_ci,
    PRIMARY KEY (meta_id
    )

    as you can see meta_value field is a longtext!!!
    you can imagine how can you filter by this field
    without index
    scanning millions of records by a field that holds huge strings
    in same table wp stores all sessions, etc..

    just to imagine how much extra data is stored in wp_postmeta table
    here is a some stats by meta_key and the number of records (top 20 or so):

    | external_image_id | 100828 |
    | external_place_lat | 100845 |
    | external_place_lng | 100862 |
    | external_upload_batch | 110848 |
    | amazonS3_cache | 121546 |
    | _bbp_activity_id | 199233 |
    | filter | 239951 |
    | id_field | 239952 |
    | __defaults_set | 239974 |
    | _bbp_post_id | 1418227 |
    | _bbp_topic_id | 1426899 |
    | _bbp_author_ip | 1426899 |
    | _bbp_forum_id | 1426909 |
    | _barcelona_vote_up | 1732202 |
    | _barcelona_views | 1732206 |

    in fact this WP pluggin is using mysql as a simple storage and not as a relational DB
    as I said above it’s a bad DB design problem
    because it’s a just a pluggin/extension of a CMS system

    ==========================================================

    Basically he is telling me that we won’t be able to achieve good loading time, because it is running on WordPress and the database design is a problem.

    What do you think, is there hope?

    We run a forum with 1.4 million posts and almost 100k members, if it can give you an idea.

    #183741
    ico33
    Participant

    Hi, in my site I noticed a strange issue after last WordPress update. It seems to have problem with “cache”.

    For example, if I log-in through the Home Page, after click in sign-in, the page refresh but it seems that the log-in didn’t work. If I press F5 to refresh the page, here I can now see the log-in effectuated.

    I thought about my caching plugin, and I wrote to the assistance of my provider. They exclude the problem is in caching plugin, they found this:

    The issue appears to be caused from the latest WordPress upgrade that was automatically applied within your website.

    Code:

    sitename@esm9 [~/public_html]# wp core version
    4.7.4

    There seems to be conflict between a plugin of yours that is creating this strange behavior within the website.

    To find which is the responsible plugin, you may start deactivating them one by one and after that checking the functions that were not working as expected. Once they work this will indicate which plugin caused the issue.

    I did what they suggest, and when I deactivate BBPRESS, everything works! So, what to do??

    #183729
    sagetopia
    Participant

    I’m seeing issues that seem to only affect public forums (private or hidden work as expected). Public forums don’t appear in the admin ‘All’ list view, although they do appear under ‘Published’. Attempting to view the single page for a public forum gives a 404 when logged in. When not logged in, it gives the following fatal error: Fatal error: Uncaught Error: [] operator not supported for strings in .../plugins/bbpress/includes/forums/functions.php on line 1855 Looking at that line, the get method of WP_Query returns an empty string if no matching key is found. That explains the [] operator error and adding a default empty array to the call does fix the issue for non logged in users. However, the root cause must be higher up the call chain because it doesn’t fix the permalink problem.

    #183706
    Pascal Casier
    Moderator

    Hi,
    There are some things that could be done on this page:
    https://codex.bbpress.org/layout-and-functionality-examples-you-can-use/#27-custom-redirect-after-login

    Hope it helps.
    Pascal.

    #183705

    In reply to: Hide Topic / Reply IDs

    Pascal Casier
    Moderator

    This CSS might help to hide it from the screen, but of course in the source code of the HTML page you might still find it.

    .bbp-forum-header a.bbp-forum-permalink, .bbp-reply-header a.bbp-reply-permalink, .bbp-topic-header a.bbp-topic-permalink {
      display: none;
    }
    #183688
    devpaq
    Participant

    This worked perfectly, Thanks!
    The only thing I added was AND wp_posts.post_status = 'publish' so that it didn’t export those that were spam posts.

    #183678
    horsmanzach
    Participant

    Hello, I am running WordPress 4.7.4 and bbPress 2.5.12.

    My forum can be found on https://thehulkpress.com/forum . The page looks exactly how I want it to there, but when I click on the forum channel the page background changes to white. I’ve tried a variety of different css codes to change the rest of the pages to black, but can’t seem to find the correct block of code. Can someone suggest a way to change not only the first page, but the rest of the pages’ background to black? Thank you

    – Zach

    #183667
    Robin W
    Moderator

    if your theme has a css area, put this in it

    #main-content {
      background-color: #000;
    }
    #183666
    softgenic
    Participant

    I manage to do this by PHP code but I am now facing one small issue the freshness time that’s coming through bbpress recent topic widget is different as compared to the freshness that’s coming through <?php printf( __( 'Last Post: %1$s', 'bbpress' ),bbp_get_topic_freshness_link( array('post_id' => get_post_meta( get_the_ID(), '_bbp_last_active_id', true )) ) ); ?> so can you please let me know how to atleast make sure the freshness time is correct?

    #183663
    Robin W
    Moderator

    thee problem is that the code would take me time to work out, and I just don’t have any time free at the moment.

    #183660
    softgenic
    Participant

    Hi Robin, Your plugin is great but I just need a simple PHP code to loop through this just like we loop through wordpress posts using wp query., is there any way I can run a simple code to get the data of last three recent posts and then I can easily render the information in my created HTML

    #183655
    Robin W
    Moderator

    if you are happy with code, download my style pack plugin

    bbp style pack

    if you look in includes/shortcodes

    you’ll find a shortcode for bsp_display_topic_index

    around line 40 you’ll find the output that you could modify and then style.

    #183650
    Chad R. Schulz
    Participant

    @yo35: It can be done. But, you’ll need to either mod the plugin or insert a custom function inside your child theme (while deactivating the plugin to avoid conflicts).

    the original plugin code is:

    function pw_bbp_shortcodes( $content, $reply_id ) {
    	
    	$reply_author = bbp_get_reply_author_id( $reply_id );
    
    	if( user_can( $reply_author, pw_bbp_parse_capability() ) )
    		return do_shortcode( $content );
    
    	return $content;
    }
    add_filter('bbp_get_reply_content', 'pw_bbp_shortcodes', 10, 2);
    add_filter('bbp_get_topic_content', 'pw_bbp_shortcodes', 10, 2);
    
    function pw_bbp_parse_capability() {
    	return apply_filters( 'pw_bbp_parse_shortcodes_cap', 'publish_forums' );
    }

    What needs to change is the section returning the do_shortcode( $content ) as follows:

    	if( user_can( $reply_author, pw_bbp_parse_capability() ) ) {
    		$content = shortcode_unautop( $content );
    		return do_shortcode( $content );
    	}

    This will remove the autop filter that adds <p></p> to the shortcode text.

    Good luck.

    #183647
    softgenic
    Participant

    Hi Guys,

    I am trying to show last 3 recent topics in this form: http://prntscr.com/f00irx . Can anyone please tell me what should be the wp query or PHP code to get title, topic url, author avatar image & time so I can easily get the information and then show it in the layout I created in the above screenshot for showing last 3 recent topics?

    Thanks

    #183642
    yo35
    Participant

    @Robin W: thanks for your answers. The “bbPress – Do Short Codes” plugin do the job.

    However, there is still a problem: bbPress seems to have a kind of postprocessing that adds several <p></p> tags within the post content, including the sections that result from shortcode processing. Is it possible to disable this behavior?

    #183632
    sally
    Participant

    Hello,

    i would like to hide topic / reply IDs, what appear on the right starting with # .., like its here in the bbpress forums…

    Is there a way, to hide the Ids only public, and only show them as admin?

    Is there a code snippet to accomplish this?

    Thx
    Regards
    Sally

    #183624

    Topic: TTFB problem

    in forum Troubleshooting
    newz12
    Participant

    We have issue with the time to first byte (TTFB) using the plugin BBPress. On the single topic page we get TTFB about 5-7 sec. After researching this issue we have found that the problem is in the file “content-single-topic.php” and the bottleneck is the function “bbp_has_replies()”.

    After researching this function we have found that the problem is in the code:

    wp-content/plugins/bbpress/includes/replies/template.php:184
    $bbp->reply_query = new WP_Query( $r );

    this row takes about 5-6 sec, so performing the query which retrieves the list of replies takes about 5-6 sec. Also we have dumped the query which is performed:

    SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts FORCE INDEX (PRIMARY, post_parent) INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1 AND (wp_posts.ID = 515125 OR wp_posts.post_parent = 515125) AND ( ( wp_postmeta.meta_key = ‘_bbp_forum_id’ AND CAST(wp_postmeta.meta_value AS SIGNED) NOT IN (‘515120′,’515123’) ) ) AND wp_posts.post_type IN (‘topic’, ‘reply’) AND ((wp_posts.post_status = ‘publish’ OR (wp_posts.post_status = ‘pending’ AND wp_posts.post_author = 0) OR wp_posts.post_status = ‘closed’ OR wp_posts.post_status = ‘hidden’) OR (wp_posts.post_author = 0 AND (wp_posts.post_status = ‘private’))) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date ASC LIMIT 56150, 25;

    You can check a test here:
    https://tools.pingdom.com/#!/NXIxm/https://www.bombingscience.com/forums/topic/tags-tags-tags/page/602/

    We are using Version 2.5.12

    Could you please check this issue and provide us solution in order to speed up this query?

    #183623
    dominikb
    Participant

    now i added this to functions.php:

    
    //code to add forum-roles
    
    function add_new_roles( $bbp_roles )
    {
        /* Add a role called tutor */
        $bbp_roles['bbp_mentor'] = array(
            'name' => 'Mentor',
            'capabilities' => custom_capabilities( 'bbp_mentor' )
            );
    
        /* Add a role called pupil */
        $bbp_roles['bbp_kursteilnehmer'] = array(
            'name' => 'Kursteilnehmer',
            'capabilities' => custom_capabilities( 'bbp_kursteilnehmer' )
            );
    
        return $bbp_roles;
    }
    
    add_filter( 'bbp_get_dynamic_roles', 'add_new_roles', 1 );
    
    function add_role_caps_filter( $caps, $role )
    {
        /* Only filter for roles we are interested in! */
        if( $role == 'bbp_mentor' )
            $caps = custom_capabilities( $role );
    
        if( $role == 'bbp_kursteilnehmer' )
            $caps = custom_capabilities( $role );
    
        return $caps;
    }
    
    add_filter( 'bbp_get_caps_for_role', 'add_role_caps_filter', 10, 2 );
    
    function custom_capabilities( $role )
    {
        switch ( $role )
        {
    
            /* Capabilities for 'mentor' role */
            case 'bbp_mentor':
                return array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => false,
                    'throttle'              => false,
                    'view_trash'            => false,
    
                    // Forum caps
                    'publish_forums'        => false,
                    'edit_forums'           => false,
                    'edit_others_forums'    => false,
                    'delete_forums'         => false,
                    'delete_others_forums'  => false,
                    'read_private_forums'   => true,
                    'read_hidden_forums'    => false,
    
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => false,
                    'delete_topics'         => false,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => true,
    
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => false,
                    'delete_others_replies' => false,
                    'read_private_replies'  => true,
    
                    // Topic tag caps
                    'manage_topic_tags'     => false,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => false,
                    'assign_topic_tags'     => true,
                );
    
                /* Capabilities for 'kursteilnehmer' role */
            case 'bbp_kursteilnehmer':
                return array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => false,
                    'throttle'              => false,
                    'view_trash'            => false,
    
                    // Forum caps
                    'publish_forums'        => false,
                    'edit_forums'           => false,
                    'edit_others_forums'    => false,
                    'delete_forums'         => false,
                    'delete_others_forums'  => false,
                    'read_private_forums'   => true,
                    'read_hidden_forums'    => false,
    
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => false,
                    'delete_topics'         => false,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => true,
    
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => false,
                    'delete_others_replies' => false,
                    'read_private_replies'  => true,
    
                    // Topic tag caps
                    'manage_topic_tags'     => false,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => false,
                    'assign_topic_tags'     => true,
                );
    
                break;
    
            default :
                return $role;
        }
    }
    

    it still does not work.

    Any hints, whats wrong here?

    #183622
    shlauncha
    Participant

    I feel as though I’m losing my mind. There’s an option to enable the full TinyCME editor correct?

    I’m looking at this: https://codex.bbpress.org/enable-visual-editor/

    But when I do that, all I’m seeing is this:

    I’ve tried the code in the codex on a base WordPress theme and all plugins disabled.

    Is it possible to enable a more robust editor?

    Thanks

    #183620
    floriancam
    Participant

    I dont know if I can answer my own question but I found a way to change this :

    function modify_breadcrumb_args() {
        $args['home_text'] = 'newname';
    
        return $args;
    }
    
    add_filter( 'bbp_before_get_breadcrumb_parse_args', 'modify_breadcrumb_args' );
    #183610
    lalit73545
    Participant

    Hi, is this possible we can display forum details like , suppose we have two forum, name called forum1 & forum2, Forum1 has 5 topics & forum2 has 10 topic. so is This possible on bbpress we can display first Forum1 then their associate topic 5 then later on forum2 then their associate topic 10. Please do the needful for me. Thanks i am waiting for your reply….

    #183605
    akira010203
    Participant

    Hello!

    I’ve added a new custom forum main page with some bb-codes instead of the default main page and I get a little disapointment, I can’t find out how to change the forums root page which redirect to mysite/forums instead of mysite/mynewmainforumpage.

    Is it possible to do it?

    Thanks!

    #183559

    In reply to: Hide links in posts

    virusek89
    Participant

    Is there anyone who can help me?

    I found this code but he does not want to work

    <?php
    function hide_links($post_content) {
     if ( in_category( array( 'YOUR CAT ID', 'YOUR CAT ID') )) {
    	global $wpdb;
    
    		return ($post_content = !is_user_logged_in()?preg_replace('/<a(.*?)>(.*?)<\/a>/m', '<div style="color:red;font-size:12px;"> YOUR TEXT</div>',$post_content):$post_content);
    	 }	
    
     }
      add_filter('the_content', 'hide_links')
    
    ?>
    #183546
    panda666uk
    Participant

    Are there any free tools/files/code out there to migrate a Kunena forum on a joomla site over to bbpress on a wordpress site ?

    Thanks

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