Robin W (@robin-w)

Forum Replies Created

Viewing 25 replies - 12,576 through 12,600 (of 13,958 total)
  • @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.

    @robin-w

    Moderator

    good, I couldn’t fathom out why chnagingh a lsug would affect anything !

    Ok, that’s strange, it works fine on my test site, and just uses the same core functionality as the main functions.

    Not sure what to suggest next….let me have a think overnight !

    In reply to: Full Width Forum Help

    @robin-w

    Moderator

    ok, this is not my strong area, but try making this as your bbpress.php page

    
    <?php 
    
    get_header(); // Loads the header.php template. ?>
     
    	<?php if ( is_bbpress() ) { ?>
     
    		<header class="entry-header">
    			<h1 class="entry-title"><?php single_post_title(); ?></h1>
    			<?php echo apply_atomic_shortcode( 'entry_byline', '<div class="entry-byline">' . __( 'Published by [entry-author] on [entry-published] [entry-comments-link before=" | "] [entry-edit-link before=" | "]', 'spine2' ) . '</div>' ); ?>
    		</header><!-- .entry-header -->
     
    		<?php while( have_posts() ): the_post(); ?>
     
    			<?php the_content(); ?>
     
    		<?php endwhile; ?>
     
     
    		<footer class="entry-footer">
    			<?php echo apply_atomic_shortcode( 'entry_meta', '<div class="entry-meta">' . __( '[entry-terms before="Posted in " taxonomy="category"] [entry-terms before="| Tagged "]', 'spine2' ) . '</div>' ); ?>
    		</footer><!-- .entry-footer -->
     
    	<?php } else { ?>
    	<div id="content" class="hfeed">
     
    		<?php get_template_part( 'loop-meta' ); // Loads the loop-meta.php template. ?>
     
    		<?php get_template_part( 'loop' ); // Loads the loop.php template. ?>
     
    		<?php get_template_part( 'loop-nav' ); // Loads the loop-nav.php template. ?>
     
    	</div><!-- #content -->
     
    <?php get_footer(); // Loads the footer.php template. ?>

    @robin-w

    Moderator

    ok, so it is changing forum slugs that creates an issue for search – yes?

    Is it key that you change the slug? – what are you trying to achieve by doing this?

    @robin-w

    Moderator

    Now we know ! 🙂

    @robin-w

    Moderator

    try adding ‘!important’ to the changes eg

    #bbpress-forums div.odd, #bbpress-forums ul.odd {
    background-color: #222222 !important;
    }

    to ensure they are not overwritten by later loading

    In reply to: Plugin not working

    @robin-w

    Moderator

    2011 should be fine with bbpress – perhaps it’s 2011 that’s corrupted?

    In reply to: Plugin not working

    @robin-w

    Moderator

    I’d deactivate the plugin, then delete it.

    Then add as new.

    Sounds like it may be corrupted somewhere.

    You won’t lose any forum data by doing so

    @robin-w

    Moderator

    I can only suggest you hire someone to get rid of the spam and upgrade you

    http://jobs.wordpress.net/

    @robin-w

    Moderator

    Nothing to do with me !! Suspect just a refresh, although I am with you on the pale hover color 🙂

    In reply to: Notification Email

    @robin-w

    Moderator

    Can you explain further what is happening/not happening, I am not clear what your issue is – in particular what you mean by non-members, and the word ‘now’ suggests a change in behaviour following a change you have made??

Viewing 25 replies - 12,576 through 12,600 (of 13,958 total)