Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for '+.+default+.+'

Viewing 25 results - 1,376 through 1,400 (of 6,788 total)
  • Author
    Search Results
  • #184680
    Robin W
    Moderator

    ok, so this is a search function – yes?

    If so, look at this code that I use with my private groups plugin to filter search results and see if you can make this work for you

    //this function filters to the bbp search function to allow only returns from allowed forums
    
    function pg_has_search_results( $args = '' ) {
    	
    	global $wp_rewrite;
    //start with code as per bbp search !
    	/** Defaults **************************************************************/
    
    	$default_post_type = array( bbp_get_forum_post_type(), bbp_get_topic_post_type(), bbp_get_reply_post_type() );
    
    	// Default query args
    	$default = array(
    		'post_type'           => $default_post_type,         // Forums, topics, and replies
    		'posts_per_page'      => bbp_get_replies_per_page(), // This many
    		'paged'               => bbp_get_paged(),            // On this page
    		'orderby'             => 'date',                     // Sorted by date
    		'order'               => 'DESC',                     // Most recent first
    		'ignore_sticky_posts' => true,                       // Stickies not supported
    		's'                   => bbp_get_search_terms(),     // This is a search
    	);
    
    	// What are the default allowed statuses (based on user caps)
    	if ( bbp_get_view_all() ) {
    
    		// Default view=all statuses
    		$post_statuses = array(
    			bbp_get_public_status_id(),
    			bbp_get_closed_status_id(),
    			bbp_get_spam_status_id(),
    			bbp_get_trash_status_id()
    		);
    
    		// Add support for private status
    		if ( current_user_can( 'read_private_topics' ) ) {
    			$post_statuses[] = bbp_get_private_status_id();
    		}
    
    		// Join post statuses together
    		$default['post_status'] = implode( ',', $post_statuses );
    
    	// Lean on the 'perm' query var value of 'readable' to provide statuses
    	} else {
    		$default['perm'] = 'readable';
    	}
    	
    	//PRIVATE GROUPS then loop to find allowable results
    	//bail from this part if there are no search terms, as otherwise it sorts the whole database and overflows memory
    	if (! bbp_get_search_terms() == '' ) {
    	//change page default to allow filter against all search results - otherwise allowed posts is only the first page of results ie whatever is in  bbp_get_replies_per_page()
    	$default['posts_per_page'] = -1;
    	$allowed_posts = private_groups_get_permitted_post_ids(new WP_Query( $default ));
    	// Then add allowed forum ids to the default query 
        $default['post__in'] = $allowed_posts;
    	if (empty ($allowed_posts )) $default['post__in'] = array(0) ;
    	//then set per page back (so that we get the correct pagination )
    	$default['posts_per_page'] = bbp_get_replies_per_page();
    	
    	}
    	
    	
    	
    	//then return to bbp search code
    	
    	/** Setup *****************************************************************/
    
    	// Parse arguments against default values
    	$r = bbp_parse_args( $args, $default, 'has_search_results' );
    
    	// Get bbPress
    	$bbp = bbpress();
    
    	// Call the query
    	if ( ! empty( $r['s'] ) ) {
    		$bbp->search_query = new WP_Query( $r );
    	}
    
    	// Add pagination values to query object
    	$bbp->search_query->posts_per_page = $r['posts_per_page'];
    	$bbp->search_query->paged          = $r['paged'];
    
    	// Never home, regardless of what parse_query says
    	$bbp->search_query->is_home        = false;
    
    	// Only add pagination is query returned results
    	if ( ! empty( $bbp->search_query->found_posts ) && ! empty( $bbp->search_query->posts_per_page ) ) {
    
    		// Array of arguments to add after pagination links
    		$add_args = array();
    
    		// If pretty permalinks are enabled, make our pagination pretty
    		if ( $wp_rewrite->using_permalinks() ) {
    
    			// Shortcode territory
    			if ( is_page() || is_single() ) {
    				$base = trailingslashit( get_permalink() );
    
    			// Default search location
    			} else {
    				$base = trailingslashit( bbp_get_search_results_url() );
    			}
    
    			// Add pagination base
    			$base = $base . user_trailingslashit( $wp_rewrite->pagination_base . '/%#%/' );
    
    		// Unpretty permalinks
    		} else {
    			$base = add_query_arg( 'paged', '%#%' );
    		}
    
    		// Add args
    		if ( bbp_get_view_all() ) {
    			$add_args['view'] = 'all';
    		}
    
    		// Add pagination to query object
    		$bbp->search_query->pagination_links = paginate_links(
    			apply_filters( 'bbp_search_results_pagination', array(
    				'base'      => $base,
    				'format'    => '',
    				'total'     => ceil( (int) $bbp->search_query->found_posts / (int) $r['posts_per_page'] ),
    				'current'   => (int) $bbp->search_query->paged,
    				'prev_text' => is_rtl() ? '→' : '←',
    				'next_text' => is_rtl() ? '←' : '→',
    				'mid_size'  => 1,
    				'add_args'  => $add_args, 
    			) )
    		);
    
    		// Remove first page from pagination
    		if ( $wp_rewrite->using_permalinks() ) {
    			$bbp->search_query->pagination_links = str_replace( $wp_rewrite->pagination_base . '/1/', '', $bbp->search_query->pagination_links );
    		} else {
    			$bbp->search_query->pagination_links = str_replace( '&paged=1', '', $bbp->search_query->pagination_links );
    		}
    	}
    	//finally filter to return
    	// Return object
    	return apply_filters( 'pg_has_search_results', $bbp->search_query->have_posts(), $bbp->search_query );
    }
    
    add_filter ('bbp_has_search_results', 'pg_has_search_results') ; 
    #184679
    Alex Stine
    Participant

    Hello @robin-w,

    If I’m not mistaken, doesn’t this come with bbPress by default? Not sure what template it is actually in right now, but if you open up a single forum, you should see it. For example this URL.

    Plugins

    Thanks.

    #184674
    Alex Stine
    Participant

    Hello @robin-w,

    I’m not using a default bbPress function to hide the topics. I’m using a custom plugin to handle the hiding of topics so members who are participants have a choice if they want the topic to be public to all members or private to moderators and keymasters. As you can see with the code above, that excludes the custom private topics from search results. Now what I need to do is update the pagination counts.

    For example, there’s a topic named “Testing” and another topic named “test123”. Pagination will show 2 topics. If “testing” is now marked private, pagination will show 2 topics. I need to figure out a way to update the pagination so it only shows 1 topic since that’s all is showing to participants. However if a moderator comes along with the required permission to view a private topic, the pagination should still show 2 topics since the moderator has permission to see the private topic.

    I hope this helps explain my goal.

    Thanks.

    #184651
    Stephen Edgar
    Keymaster

    You shouldn’t need to do any of the above, setting your WordPress install to use German as the default language should automatically download bbPress’ translations.

    p.s. If you’re using the method above for a different reason, uploading them to wp-content/languages/bbpress instead of wp-content/languages/buddypress would be the answer 😉

    #184617
    Robin W
    Moderator

    Ok, I understand – that is called ‘breadcrumbs’

    I think your theme might be hiding them.

    as a test try a default theme such as twentyten and see if they are there

    The come back

    #184554
    Robin W
    Moderator

    It could be a theme or plugin issue

    Plugins

    Deactivate all but bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.

    Themes

    If plugins don’t pinpoint the problem, as a test switch to a default theme such as twentyfifteen, and see if this fixes.

    Then come back

    #184548
    Robin W
    Moderator

    ok, not sure I can help further – think it is a wordpress/database issue.

    Last 2 throws of the dice

    1. is debug switched on, and if not turn it on to see what errors are appearing. if you need instructions for that – come back

    2. try changing theme to a default one like twentyseventeen, then deactivate and see if that does anything. if that works you could switch back to your normal theme once bbpress is gone.

    #184528
    mapofemergence
    Participant

    Hi @TKServer, I’m glad you revamped this topic.
    Although since my last post I didn’t work further on the code, I’m still very much interested in the discussion.
    Originally, I was going in the same direction that you just suggested but, ultimately, I thought that a separate API would be desirable for a variety of reasons.

    I can name the ones I thought of, but I’m sure others might have even stronger (and more educated) motivations:

    • the most general and obvious: a separate API makes you less dependant on certain builtin constraints of WP API and let you take design decision which are more tightly connected with bbPress specifically; even though bbPress leverages WP’s custom post types and tags, there’s a higher layer of abtraction (read: forum functionality) which implies a whole set of requests for which the existing endpoints’ structure is not ideal
    • depending on what info you want to get with a single request, the default WP API queries might not serve the scope well (ie. they could force the user to make multiple queries where just one would be desirable and sufficient; also, where multiple database calls are required, it might not provide those in the best performing way)
    • from a user standpoint, I believe it is better to offer schemas (and filters) which reflect more the semantics of a forum, than the ones of a blog; I believe you can still build those custom terms in the existing API, but it might become confusing soon, and in my opinion you’d loose the advantage of staying with a single API, anyway
    • additionally (and actually the main reason for me personally), I see bbPress as part of an ecosystem, with WP and BuddyPress. Since BuddyPress already went for a separate API, I thought it would make sense to do the same with bbPress, keeping things clean and separate. Utlimately, the ideal would be to have the bbPress API live with the bbPress plugin itself, so that the development of the two can progress together (and therefore be more efficient and optimised, both ways)
    • finally, speaking of bbPress BuddyPress, there’s an area where the two plugins overlap (bb forums in BP groups); I believe it is already a non-trivial problem to solve in a separate API and it would likely be even more complicated to try and stay within the WP limits; I was mentioning this in another post too, which I believe is still awaiting approval from moderators (please pardon me if I dare poking them here, once more) 🙂

    Again, this is just my opinion; there are probably pros and cons in both options and I’d be more than happy to hear from anyone who’s more bbPress-savvy than I am.

    Cheers,
    s t e

    Ryan Hellyer
    Participant

    This is very old thread, but I just want to clarify something, as this keeps showing up in Google searches for this topic.

    Technically WordPress could work out the post-type; it already does this in the case of posts and pages using the same URL structure. It is however faster if it knows the post-type in advance, hence bbPress prefers to use those slugs by default.

    There is also a secondary problem, which is probably why there isn’t even a common hack to work around this problem, in that if you allow people to create topics and replies at the root level, there could easily be clashes between slugs. This isn’t such a big problem with posts and pages, as usually it’s only the blog admin/editor creating the posts, but in the case of a forum it would be very easy for a member of the public to inadvertently create a clashing slug. You could also ensure that forum posts didn’t clash with existing content in other post-types, but forum users could use page slugs which the admins may want to use for other posts in future. Basically, things get messy.

    Having said all that, this should in theory be possible I think (I haven’t tried to figure out how yet, I’m just searching around to find an existing solution), there would just be a few potential drawbacks. If anyone knows how to do this, please post the solution for the rest of us to see 🙂

    #184349

    In reply to: Query error

    bjorngus
    Participant

    Ok, i have something that seems to work, try it out if you want to, feel free to give me feedback on it.

    function fix_default_search_string_is_bool($args)
    {
        //bbpress gives FALSE as search string causing no replys to show, this fixes it.
        if ($args['s'] === false) {
            unset($args['s']);
        }
        return $args;
    }
    
    add_filter('bbp_after_has_replies_parse_args', 'fix_default_search_string_is_bool');
    #184276
    davebevan
    Participant

    I am trying to replace my comments on posts with bbpress topics. This plugin is working for the most part…I’m able to auto create new topics of my published posts on the forum. However, my comment box has disappeared on the posts. There is a comment button to click. But when clicked, there is nothing displayed for posting comments.

    I have found out that this is a theme issue and not a plugin issue. When I change to a different theme, such as a WordPress default theme, the plugin works. However, I do not want to lose my current theme. Does anyone know if there is any css code I can add to my theme in order to make the bbpress comment box to appear on the WordPress posts.

    Website: http://bamadigest.com
    Thank you!

    #184270
    pjbarry21
    Participant

    Update… the only plugin I didn’t disable in the testing before is Buddypress (the core plugin). I just disabled everything except bbpress and buddypress. And changed back to the default theme. Still got the same error. Then I disabled buddypress itself. That stopped the error. But, I also only get the error for some users.

    I’m going to replace all the core buddypress files to see if that resolves it.

    #184221
    pluus
    Participant

    Hmph… okay… I’ve noticed that /plugins/bbpress/includes/search/template.php is actually responsible for that feature:

    
    function bbp_has_search_results( $args = '' ) {
    	global $wp_rewrite;
    
    	/** Defaults **************************************************************/
    
    	$default_post_type = array( bbp_get_forum_post_type(), bbp_get_topic_post_type(), bbp_get_reply_post_type() );
    
    	// Default query args
    	$default = array(
    		'post_type'           => $default_post_type,         // Forums, topics, and replies
    		'posts_per_page'      => bbp_get_replies_per_page(), // This many
    		'paged'               => bbp_get_paged(),            // On this page
    		'orderby'             => 'date',                     // Sorted by date
    		'order'               => 'DESC',                     // Most recent first
    		'ignore_sticky_posts' => true,                       // Stickies not supported
    		's'                   => bbp_get_search_terms(),     // This is a search
    	);
    
    

    So, changing ‘post_type’ => $default_post_type to ‘post_type’ => bbp_get_topic_post_type() works. However, it’s not clearly the best practice to modify the plugin directly anyother way to override this?

    #184166
    tweichart
    Participant

    Hey guys,

    I get a 500 error after the latest update:

    
    AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: [] operator not supported for strings in /var/www/vhosts/<url>/wp-content/plugins/bbpress/includes/forums/functions.php:1800
    Stack trace:
    #0 /var/www/vhosts/<url>/wp-includes/class-wp-hook.php(298): bbp_pre_get_posts_normalize_forum_visibility(Object(WP_Query))
    #1 /var/www/vhosts/<url>/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array)
    #2 /var/www/vhosts/<url>/wp-includes/plugin.php(515): WP_Hook->do_action(Array)
    #3 /var/www/vhosts/<url>/wp-includes/class-wp-query.php(1681): do_action_ref_array('pre_get_posts', Array)
    #4 /var/www/vhosts/<url>/wp-includes/class-wp-query.php(3238): WP_Query->get_posts()
    #5 /var/www/vhosts<url>/wp-includes/class-wp.php(617): WP_Query->query(Array)
    #6 /var/www/vhosts/<url>/wp-includes/clas...'
    

    ln 1800 looks like this:

    
    $post_stati = $posts_query->get( 'post_status' );
    
    // Default to public status
    if ( empty( $post_stati ) ) {
        $post_stati[] = bbp_get_public_status_id();
    
    // Split the status string
    } elseif ( is_string( $post_stati ) ) {
        $post_stati = explode( ',', $post_stati );
    }
    

    could be fixed by forcing the array:

    
    $post_stati = $posts_query->get( 'post_status' );
    if (!is_array($post_stati)){
        $post_stati = array($post_stati);
    }
    
    // Default to public status
    if ( empty( $post_stati ) ) {
        $post_stati[] = bbp_get_public_status_id();
    
    // Split the status string
    } elseif ( is_string( $post_stati ) ) {
        $post_stati = explode( ',', $post_stati );
    }
    

    side note: wp version 4.7.4, bbpress version 2.5.12

    Thanks in advance,
    Toby

    #184165
    Chad R. Schulz
    Participant

    When I say single forum/topic/reply slug I actually meant for the single post-type slugs of forum/topic/reply. As the /forums/ slug is just a wrapper for all those bbPress custom post-types. So you could effectively remove the /forums/ wrapper and end up with just http://wwww.somesite.com/forum/name-of-specific-forum/. If you rename the single /forum/ slug to /forums/ it would become http://wwww.somesite.com/forums/name-of-specific-forum/ or something similar with topics like http://wwww.somesite.com/topics/name-of-specific-topic/

    And adding the topic slug after the forum slug is not intuitive as the topics don’t actually exist inside the forums, they are simply linked to it–similar to a shortcut. This is something that can be done with breadcrumbs, however.

    Again, permalinks can be rather tricky. In fact I’m fairly certain they’re the reason the “Private” forums are leading not-logged in visitors to a 404 page. I’d try putting everything back to the default settings and seeing if that fixes the error. Also, look at any customizing, plugins you might have that could interfere with bbPress defaults.

    BTW, bbPress has a default error message for not-authorized users and “private” forums that should display. Again, something must be off in the settings/configuration.

    My forum has no “private” forums, so I have little experience with this particular issue. Sorry.

    Best of luck,
    Chad

    #184156

    In reply to: Auto Role not working

    Robin W
    Moderator

    contributor is a wordpress role, not a bbpress one.

    so if you are using the default registration

    then

    dashboard>settings>general and what is ‘new default user’ set to ?

    dashboard>settings>forums and what is ‘auto role’ set to ?

    #184126
    blasterspike
    Participant

    Hi,
    I have followed this documentation page

    Enable Visual Editor


    to enable TinyMCE. Now I would like to change the default behavior of TinyMCE to not add a paragraph for each new line but use instead <br>.
    For WordPress I have to use this

    function tinymce_remove_root_block_tag( $init ) {
        $init['forced_root_block'] = false; 
        return $init;
    }
    add_filter( 'tiny_mce_before_init', 'tinymce_remove_root_block_tag' );

    But the TinyMCE in bbPress doesn’t get this setting.
    I have tried to do something like

    function bbp_enable_visual_editor( $args = array() ) {
        $args['tinymce'] = true;
        $args['quicktags'] = false;
        $args['forced_root_block'] = false;
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );

    but it doesn’t work.
    How can I pass that “forced_root_block” to the TinyMCE enabled for bbPress?

    Thanks

    Massimo

    #183896
    xelota
    Participant

    Wordpress : WordPress 4.7.4 avec le thème BlackFyre.
    bbpress : Version 2.5.12
    http://www.vieuxetmechants.com/

    Hello i’ve created custom and i don’t understand the role MembreVetM can’t edit or delete their own post

    function add_new_roles( $bbp_roles )
    {
        $bbp_roles['bbp_gamer'] = array(
            'name' => 'Gamer',
             'capabilities' => custom_capabilities( 'bbp_gamer' )
            );
     
    	$bbp_roles['bbp_membrevetm'] = array(
            'name' => 'MembreVetM',
             'capabilities' => custom_capabilities( 'bbp_membrevetm' )
            );
    		
        $bbp_roles['bbp_veteran'] = array(
            'name' => 'Vétéran',
            'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() )
            );
    	
    	$bbp_roles['bbp_officier'] = array(
            'name' => 'Officier',
            'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() )
            );
    	
        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_gamer' )
            $caps = custom_capabilities( $role );
     
        if( $role == 'bbp_membrevetm' )
            $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 )
        {
     
            case 'bbp_gamer':
                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'   => false,
                    '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'   => false,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => false,
                    'delete_others_replies' => false,
                    'read_private_replies'  => false,
     
                    // Topic tag caps
                    'manage_topic_tags'     => false,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => false,
                    'assign_topic_tags'     => false,
                );
     
    			case 'bbp_membrevetm':
                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'         => true,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => true,
                    'delete_others_replies' => false,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => true,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => true,
                    'assign_topic_tags'     => true,
                );
     
                break;
     
            default :
                return $role;
        }
    }
    #183772
    Robin W
    Moderator

    that text is in

    \templates\default\bbpress\form-topic.php

    and you’ll probably also want

    \templates\default\bbpress\form-reply.php

    for replies

    you’ll probably want to put revised versions in your child theme

    Functions files and child themes – explained !

    You can copy all the templates across, but you only need to copy those that you want to change, and it is better just to do this, as then you know which you have altered.

    so if you wanted to amend form-topic.php you would do the following

    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

    find
    wp-content/plugins/bbpress/templates/default/bbpress/form-topic.php
    Make a copy of this file, 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
    and you can amend this

    #183765
    paripari
    Participant

    Hi guys

    Please see attached screenshot. When not logged into the forum, there is the standard message “You must be logged in to create new topics”

    I want to change that text and add a link there to signup to my membership page, i used the explore inspection tool, and think i pin pointed it to this file ” bbp-template-notice” BUT i cant find that file any where…

    Please advice

    HELP

    #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.

    #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.

    #183704
    Pascal Casier
    Moderator

    Hi,
    Probably seen as spam ? Check any ‘Pending/draft/spam’ under replies, in Akismet, or any other plugins that could block this.
    If you don’t find it, deactivate all plugins except bbPress and try again. Also switch to a default theme to see if that helps.
    Pascal.

    #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?

    #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!

Viewing 25 results - 1,376 through 1,400 (of 6,788 total)
Skip to toolbar