Robin W (@robin-w)

Forum Replies Created

Viewing 25 replies - 12,726 through 12,750 (of 14,118 total)
  • @robin-w

    Moderator

    I’m here, but this is beyond my technical knowledge – I was hoping that Stephen would pick this up, but he hasn’t – he may be away, or think that I have it under control ๐Ÿ™‚

    Ok, so with no other plugins and 2.54 you have this problem??

    I have 2.54 with twentyten and no issues, permalinks are topic title.

    So must be peculiar to your site – so something needs setting/resetting, and obviously permalinks aren’t the answer as they’re working with wordpress. So bbpress is not playing nicely.

    How much of a test area do you have that you can try stuff in?

    @robin-w

    Moderator

    but I use Oblivion theme witch is compatible with bbpress

    In which case it is a problem with another plugin.

    If that doesn’t fix, then consult themefroest on how the compatible theme works.

    @robin-w

    Moderator

    Hey no problem, this has fixed two issues I didn’t know it had, so persistence paid off, and thanks for all your help with this !

    @robin-w

    Moderator

    Agree it would be useful, and could be coded, but there are many calls on the developers time (I’m not a developer).

    @robin-w

    Moderator

    Is there any way to completely skip the forums index? I donโ€™t see why I would need multiple forums when I can have 1 main forum with different topics.

    Yes you can skip the forum index, just create a page and put one of the shortcodes on it

    https://codex.bbpress.org/shortcodes/

    In your case you’d use

    [bbp-single-forum id=$forum_id] โ€“ Display a single forums topics. eg. [bbp-single-forum id=32]

    @robin-w

    Moderator

    Thankyou !!

    @robin-w

    Moderator

    Not without coding ! sorry !

    @robin-w

    Moderator

    Not a quick answer – how well are you able to code?

    @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, switch to a default theme such as twentytwelve, and see if this fixes.

    and see

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

    @robin-w

    Moderator

    @robin-w

    Moderator

    Mareva

    and (hopefully) fixed !!

    Can you download from 1.8.1 from

    bbp Private Groups

    and ensure it’s working for you ! I’ll then upload it to wordpress

    @robin-w

    Moderator

    ..and have found the problem, working on a fix….

    @robin-w

    Moderator

    Here is the point : if I log on as user2 and search for a term I know is only in forum 1, it shows the result but it should not.

    Great – that’s it, I can now replicate – sorry took me a while to understand your search – I’ll dig around and see what’s happening !

    @robin-w

    Moderator

    ok, I have just set up a test as follows :

    user1 access to group 1
    user2 access to group 2

    forum 1 assigned to group 1 visibility private parent:no parent
    forum 2 assigned to group 1 and group 2 visibility private parent:no parent

    dashboard>settings>private groups>

    visibility
    set to off (unchecked)
    all other options blank

    general settings
    all blank

    The I log on as user2 and search for a term I know is in both forums, and it only shows the results for forum 2.

    Then I log in as user1 and search for a term I know is in both forums, and it shows the results for forum 1 and forum 2.

    Then I log out, and serach again, and it show no results from either forum.

    Which bits of the above are different for you?

    @robin-w

    Moderator

    No hold on and let me have a think and a look !

    @robin-w

    Moderator

    Ok, what I want to do is check if the function is trying to filter and failing or not even trying to filter.

    I am therefore going to get the plugin to dump one of the lists, so that you can tell me what it is showing – it won’t look pretty, but should help.

    First of all you need to work out a search that produces only a few results, say less than 10, and that you can list all the results that you would expect to see for full access, and that you want to see for the private groups, and make a not of their numbers.

    so for instance

    search for zebra produces posts numbers

    2345,2367,2657,2894,2965

    But one of these is in a private forum so a non-logged in user should see

    2345,2367,2894,2965

    Once you have this list, then do the following :
    Use notepad to create a file called search.php

    then put this code into it

    <?php
    
    //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';
    	}
    	
    	//PG then loop to find allowable forums
    	//Get an array of IDs which the current user has permissions to view
    	$allowed_posts = private_groups_get_permitted_post_ids(new WP_Query($default));
    	Echo 'Allowed posts list' ;
    	var_dump ($allowed_posts) ;
    	// The default forum query with allowed forum ids array added
        $default['post__in'] = $allowed_posts;
    
        
    	//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() ? '&rarr;' : '&larr;',
    				'next_text' => is_rtl() ? '&larr;' : '&rarr;',
    				'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') ; 

    Then go into FTP

    Then look in

    wp-content/plugins/bbp-private-groups/includes

    and you’ll see a file called

    wp-content/plugins/bbp-private-groups/includes/search.php

    Rename this file to searchold.php (as we’ll need it back later!)

    Then copy the search.php that you made above to this folder (wp-content/plugins/bbp-private-groups/includes).

    Then run your search.

    You should see a horrible list at the start, but this will be what should be the filtered list

    run this with full access and with restricted access (ie not logged in) and tell me what lists you get and of they are different.

    @robin-w

    Moderator

    That is quite complicated.

    However this will add ‘edit profile’ to you menu if you put it in your function file !

    // Filter wp_nav_menu() to add profile link
    add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' );
    function my_nav_menu_profile_link($menu) { 	
    	if (is_user_logged_in()) {
    		$current_user = wp_get_current_user();
    		$user=$current_user->user_login ;
    		//Lower case everything
    		$user = strtolower($user);
    		//Make alphanumeric (removes all other characters)
    		$user = preg_replace("/[^a-z0-9_\s-]/", "", $user);
    		//Clean up multiple dashes or whitespaces
    		$user = preg_replace("/[\s-]+/", " ", $user);
    		//Convert whitespaces and underscore to dash
    		$user = preg_replace("/[\s_]/", "-", $user);
    		$profilelink = '<li><a href="/forums/users/' . $user . '/edit">Edit Profile</a></li>';
    		$menu = $menu . $profilelink;
    		return $menu;
    	
    }

    @robin-w

    Moderator

    hmm….

    Ok, if I give you a new file, are you able to FTP it to a location within wordpress – ie do you know how to ftp !

    @robin-w

    Moderator

    Great – glad you’re fixed !

    @robin-w

    Moderator

    Phew!!

    Great glad you’re fixed !!

    @robin-w

    Moderator

    OK, it may be a plugin conflict – ie 2.5.4 isn’t playing with one of your plugins.

    Try

    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, switch to a default theme such as twentytwelve, and see if this fixes.

    @robin-w

    Moderator

    not sure what is happening, but try resetting the permalinks

    Dashboard>settings>permalinks and just click save changes.

    @robin-w

    Moderator

    @robin-w

    Moderator

    ok, think we need to eliminate any other factors

    Plugins

    Deactivate all but bbpress and private groups 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, switch to a default theme such as twentytwelve, and see if this fixes.

    Come back and let me know !

    @robin-w

    Moderator

    Really glad that writing that part of the guide has worked for someone else – it was a real challenge to write !

    Try changing the line

    add_filter( 'bbp_get_topic_reply_link','jc_return_review' );

    to

    add_filter( 'bbp_before_get_topic_reply_link_parse_args','jc_return_review' );
    

    This lets you change just one part of the function.

Viewing 25 replies - 12,726 through 12,750 (of 14,118 total)