Robin W (@robin-w)

Forum Replies Created

Viewing 25 replies - 5,876 through 5,900 (of 14,305 total)
  • @robin-w

    Moderator

    ok, so this is a single topic page – yes ?

    Pre-acquisition dividend

    so where are the words ‘in header’ or where exactly do you want these words?

    @robin-w

    Moderator

    can you post a ink to your site and say precisely where you would like this please

    @robin-w

    Moderator

    just participants in this version – much work still to do !

    @robin-w

    Moderator

    I’ve had a play this evening with this issue.

    This code is very rough and ready, but if it works as I think it does, then it shows pending REPLIES to the user who posted them and moderators and keymasters. NOT topics !!

    so when a user posts a reply and it goes into moderation, they see there reply in the topic with a warning.

    If you want to try it, put this in your child theme’s function file – or use

    Code Snippets

    add_filter ('bbp_has_replies' , 'rew_has_replies' ) ;
    	
    function rew_has_replies( $args = array() ) {
    
    	/** Defaults **************************************************************/
    
    	// Other defaults
    	$default_reply_search   = bbp_sanitize_search_request( 'rs' );
    	$default_post_parent    = ( bbp_is_single_topic() ) ? bbp_get_topic_id() : 'any';
    	$default_post_type      = ( bbp_is_single_topic() && bbp_show_lead_topic() ) ? bbp_get_reply_post_type() : array( bbp_get_topic_post_type(), bbp_get_reply_post_type() );
    	$default_thread_replies = (bool) ( bbp_is_single_topic() && bbp_thread_replies() );
    
    	// Default query args
    	$default = array(
    		'post_type'              => $default_post_type,         // Only replies
    		'post_parent'            => $default_post_parent,       // Of this topic
    		'posts_per_page'         => bbp_get_replies_per_page(), // This many
    		'paged'                  => bbp_get_paged(),            // On this page
    		'orderby'                => 'date',                     // Sorted by date
    		'order'                  => 'ASC',                      // Oldest to newest
    		'hierarchical'           => $default_thread_replies,    // Hierarchical replies
    		'ignore_sticky_posts'    => true,                       // Stickies not supported
    		'update_post_term_cache' => false,                      // No terms to cache
    
    		// Conditionally prime the cache for all related posts
    		'update_post_family_cache' => true
    	);
    
    	// Only add 's' arg if searching for replies
    	// See https://bbpress.trac.wordpress.org/ticket/2607
    	if ( ! empty( $default_reply_search ) ) {
    		$default['s'] = $default_reply_search;
    	}
    
    	// What are the default allowed statuses (based on user caps)
    	if ( bbp_get_view_all( 'edit_others_replies' ) ) {
    
    		// Default view=all statuses
    		$post_statuses = array_keys( bbp_get_topic_statuses() );
    
    		// Add support for private status
    		if ( current_user_can( 'read_private_replies' ) ) {
    			$post_statuses[] = bbp_get_private_status_id();
    		}
    
    		// Join post statuses together
    		$default['post_status'] = $post_statuses;
    
    	// Lean on the 'perm' query var value of 'readable' to provide statuses
    	} else {
    		//get public and pending (not sure if we need this or just to remove the perm status that was here ?
    		$post_statuses = array_keys( rew_get_topic_statuses() );
    	}
    
    	/** Setup *****************************************************************/
    
    	// Parse arguments against default values
    	$r = bbp_parse_args( $args, $default, 'has_replies' );
    
    	// Set posts_per_page value if replies are threaded
    	$replies_per_page = (int) $r['posts_per_page'];
    	if ( true === $r['hierarchical'] ) {
    		$r['posts_per_page'] = -1;
    	}
    
    	// Get bbPress
    	$bbp = bbpress();
    	
    	//now filter the query before execution
    	
    	// Add filter if participant
    	$user_id = get_current_user_id() ;
    	$role = bbp_get_user_role( $user_id );
    	if ($role == 'bbp_participant'  || $role == 'bbp_moderator' || bbp_is_user_keymaster($user_id)) { 
    		add_filter( 'posts_where', 'rew_where' );
    	}
    
    	// Call the query
    	$bbp->reply_query = new WP_Query( $r );
    	
    	
    		// Remove filter
    	if ($role == 'bbp_participant'  || $role == 'bbp_moderator' || bbp_is_user_keymaster($user_id)) { 
    		remove_filter( 'posts_where', 'rew_where' );
    	}
    	
    	// Maybe prime the post author caches
    	if ( ! empty( $r['update_post_family_cache'] ) ) {
    		bbp_update_post_family_caches( $bbp->reply_query->posts );
    	}
    
    	// Add pagination values to query object
    	$bbp->reply_query->posts_per_page = (int) $replies_per_page;
    	$bbp->reply_query->paged          = (int) $r['paged'];
    
    	// Never home, regardless of what parse_query says
    	$bbp->reply_query->is_home        = false;
    
    	// Reset is_single if single topic
    	if ( bbp_is_single_topic() ) {
    		$bbp->reply_query->is_single = true;
    	}
    
    	// Only add reply to if query returned results
    	if ( ! empty( $bbp->reply_query->found_posts ) ) {
    
    		// Get reply to for each reply
    		foreach ( $bbp->reply_query->posts as &$post ) {
    
    			// Check for reply post type
    			if ( bbp_get_reply_post_type() === $post->post_type ) {
    				$reply_to = bbp_get_reply_to( $post->ID );
    
    				// Make sure it's a reply to a reply
    				if ( empty( $reply_to ) || ( bbp_get_reply_topic_id( $post->ID ) === $reply_to ) ) {
    					$reply_to = 0;
    				}
    
    				// Add reply_to to the post object so we can walk it later
    				$post->reply_to = $reply_to;
    			}
    		}
    	}
    
    	// Only add pagination if query returned results
    	if ( ! empty( $bbp->reply_query->found_posts ) && ! empty( $bbp->reply_query->posts_per_page ) ) {
    
    		// Figure out total pages
    		if ( true === $r['hierarchical'] ) {
    			$walker      = new BBP_Walker_Reply();
    			$total_pages = ceil( $walker->get_number_of_root_elements( $bbp->reply_query->posts ) / $bbp->reply_query->posts_per_page );
    		} else {
    
    			// Total for pagination boundaries
    			$total_pages = ( $bbp->reply_query->posts_per_page === $bbp->reply_query->found_posts )
    				? 1
    				: ceil( $bbp->reply_query->found_posts / $bbp->reply_query->posts_per_page );
    
    			// Pagination settings with filter
    			$bbp_replies_pagination = apply_filters( 'bbp_replies_pagination', array(
    				'base'    => bbp_get_replies_pagination_base( bbp_get_topic_id() ),
    				'total'   => $total_pages,
    				'current' => $bbp->reply_query->paged
    			) );
    
    			// Add pagination to query object
    			$bbp->reply_query->pagination_links = bbp_paginate_links( $bbp_replies_pagination );
    		}
    	}
    
    	// Filter & return
    	return apply_filters( 'rew_has_replies', $bbp->reply_query->have_posts(), $bbp->reply_query );
    }
    
    function rew_get_topic_statuses( $topic_id = 0 ) {
    
    	// Filter & return
    	return (array) apply_filters( 'bbp_get_topic_statuses', array(
    		bbp_get_public_status_id()  => _x( 'Open',    'Open the topic',      'bbpress' ),
    		), $topic_id );
    }
    
    function rew_where( $where ) {
    	$user_id = get_current_user_id() ;
        global $wpdb;
    	$posts = $wpdb->posts ;
        return $where . " OR ( 
                 ".$posts.".post_author = ".$user_id."
            AND  ".$posts.".post_status = 'pending'
    		                 
        ) ";
    }
    
    add_action ('bbp_theme_before_reply_content' , 'rew_pending' );
    
    function rew_pending () {
    	$id = bbp_get_reply_id() ;
    	$status = get_post_status ($id) ;
    	if ($status == 'pending' ) {
    	echo '<i><b>This reply is pending review and can only be seen by you and the administrators</b></i>' ;
    	}
    	
    }

    @robin-w

    Moderator

    sorry can you be specific with an example please – eg I want xx above the words YY on page zz

    @robin-w

    Moderator

    ok, so for the example you give, what do you want to hide?

    In reply to: CSS styling query

    @robin-w

    Moderator

    nor have I.

    The function is called by core/filters.php

    Line 203: add_filter( 'bbp_get_form_forum_content', 'bbp_code_trick_reverse' );
    Line 206: add_filter( 'bbp_get_form_topic_content', 'bbp_code_trick_reverse' );
    Line 209: add_filter( 'bbp_get_form_reply_content', 'bbp_code_trick_reverse' );

    so you could try

    remove_filter ('bbp_get_form_forum_content', 'bbp_code_trick_reverse' );

    etc.
    in your child theme and see what removing it does

    @robin-w

    Moderator

    no problem, glad to have helped 🙂

    @robin-w

    Moderator

    as standard people can type url’s into their topics/replies.

    The number is set in

    dashboard>settings>discussion and look for comment moderation and maybe up the number of links

    @robin-w

    Moderator

    hmmm..something is wrong with your site and not bbpress related.

    I can only advise that you contact your host provider for support and maybe revert to previous copy.

    @robin-w

    Moderator

    try

    dashboard>settings>discussion and look for comment moderation and maybe up the number of links

    @robin-w

    Moderator

    🙂

    In reply to: CSS styling query

    @robin-w

    Moderator

    the only place I can find <pre> is in

    includes/common/formatting.php line 120 onwards

    In reply to: CSS styling query

    @robin-w

    Moderator

    not used the enlighter js plugin, so can’t really help further – sorry 🙂

    @robin-w

    Moderator

    the issue is with auto optimise which is not loading the style sheet as far as I can see

    @robin-w

    Moderator

    great – thanks for letting us know

    @robin-w

    Moderator

    hmm…can’t see that bbpress is loading either, so since I can’t access the forum, I suspect you have it set somewhere to only load on forum pages ?

    @robin-w

    Moderator

    bbpress will do fine, buddypress is not forum software, but the two work together if you want.

    add this to get the styling of bbpress to match your forum

    bbp style pack

    In reply to: add front end editor

    @robin-w

    Moderator

    no problem, we’ve all been there !!

    @robin-w

    Moderator

    Our issue is that a forum user cannot import more than one image unless they are the Keymaster.

    can you explain what that means? it doesn’t upload, they can’t upload, it errirs or what happens please?

    @robin-w

    Moderator

    unfortunately we can’t see that link without login details (which please do not show).

    You should create an ordinary WordPress page, add a block with your text, and then follow this with a shortcode block with

    [bbp-forum-index]

    in it

    @robin-w

    Moderator

    would need a link to your site

    @robin-w

    Moderator

    you can filter that to stop it

    In reply to: Forum roles issue

    @robin-w

    Moderator

    that might well be the best pragmatic solution – contact me via

    Contact me

    In reply to: CSS styling query

    @robin-w

    Moderator

    ok, a long post from you, let me deal with q1 first.

    bbpress has a style sheet. Theme authors may want to change that sheet to improve how bbpress works with their theme, so correctly they put a changed version in their theme and bbpress will use that. But that will be a css file that related to a specific version of bbpress – say 2.5.14. When bbpress releases version 2.6.x, your theme will still use the version that your theme author changed unless eh cares to update it. The 2.6.x version will be a different length and have changes to the style sheet, hence why you might well see 1048 lines in then theme versiin – it is most likely a css sheet amended from a previous version of bbpress.

    so it is unreasonable to expect bbpress to never change their style sheet, and equally unreasonable to expect every theme author to update their css versions everytime bbporess acres to issue a new version. So unless your theme is a paid theme that guarenhtees to keep bbpress style updated, you have to make a call on what you do.

    I’d suggest you stick with the theme version, and use custom css to fix any issues you find between the newest version of bbpress and your theme version css file.

Viewing 25 replies - 5,876 through 5,900 (of 14,305 total)