Robin W (@robin-w)

Forum Replies Created

Viewing 25 replies - 8,451 through 8,475 (of 14,231 total)
  • @robin-w

    Moderator

    bbpress with a default theme (eg twentseventeen) will do the following

    • search for say ‘hello’
    • bbpress will produce all single topics and single replies that match this (which could be many)
    • for a reply you will see the reply with the words In reply to :the topic name as a link
    • click the topic name and you are taken to the topic

    If this is not what you are getting, then come back

    @robin-w

    Moderator

    did you change the filter – I was calling the wrong one should be

    add_filter( 'bbp_get_topic_freshness_link', 'rew_freshness_no_date_link' , 100, 5)

    @robin-w

    Moderator
    In reply to: access control

    @robin-w

    Moderator

    no problem, come back if I can help further 🙂

    @robin-w

    Moderator

    ok, so the forum is visible as existing, but non-logged-in can only see designated threads, other threads are not visible until they log in.

    Trying to think how easy that would be to achieve

    I’ll come back…

    @robin-w

    Moderator

    sort of but not quite 🙂

    if you don’t allow anonymous posting, then all threads are ‘locked’ to non-logged in users.

    Can you explain further with an example – just me not understanding I expect

    @robin-w

    Moderator

    thanks fro your post – I’m author of private groups.

    When you say ‘lock certain threads to non-logged in users’ – are you allowing anonymous posting?

    @robin-w

    Moderator

    ok, should have tested before sending, but coded it late last night and I have been out all day !

    Now had a chance to try it, and correct code is

    add_filter( 'bbp_get_topic_freshness_link', 'rew_freshness_no_date_link' , 100, 5) ; 
    	
    function rew_freshness_no_date_link($anchor, $topic_id, $time_since, $link_url, $title) {
    	if (!empty ($topic_id)) {
    	?>
    	<a href="<?php echo $link_url; ?>"><?php echo $title ;?></a> (<?php echo $time_since ; ?>)
    	<?php
    	}
    	else echo 'No topics' ;
    }
    In reply to: access control

    @robin-w

    Moderator

    ok, thanks that helps.

    ONE

    you have set the forum to private in dashboard>forums>all Forums>do-i-quality>edit and visibility options on the right hand side in the forum attributes set to private.

    A private forum is one that is not public, so its existence is also not public. It therefore returns a 404 error to someone not logged in, as bbpress doesn’t know the difference between a user who is not logged in and any member of the public. Once logged in they see the forums. Most users click the remember me button and save passwords in their browser. When not logged in they will not see the existence of the forums. If you want the forums to be visible, then the private groups plugin above will do that.

    TWO

    This is simply a forum with dashboard>forums>all Forums>bylaws>edit and visibility options on the right hand side in the forum attributes set to public.

    THREE

    I’ll look through the wording again to see if I can make it better – I did write it some time ago, and probably due for a review but the settings are in there viz

    Forum visibility:

    Public – Anyone can see these forums
    Private – Only logged in registered users with a forum role can see these forums
    Hidden: Only Moderators/keymasters can see these forums

    Visibility is set for each forum, go into Dashboard>forums> and when you add/edit a forum, you will see visibility options on the right hand side in the forum attributes.

    By default forums are available to be publically viewed. If you set anonymous posting to be on (see 4. Above) then anyone can also post.

    @robin-w

    Moderator

    SORRY – just read you post again, and now I think I understand

    on one site you want the code as above

    on another site you just want a single post, but with title and date, but no link on the date – yes ?

    if so then untested but this should be it

    add_filter( 'bbp_get_forum_freshness_link', 'rew_freshness_no_date_link' , 100, 6) ; 
    	
    function rew_freshness_no_date_link($anchor, $forum_id, $time_since, $link_url, $title, $active_id ) {
    	if (!empty ($active_id)) {
    	?>
    	<a href="<?php bbp_topic_permalink($active_id); ?>"><?php bbp_topic_title(active_id) ?></a> (<?php bbp_topic_last_active_time(active_id); ?>)
    	<?php
    	}
    	else echo 'No topics' ;
    }

    @robin-w

    Moderator

    you’ve lost me now 🙂

    The key line that does the reference is

    <a href="<?php bbp_topic_permalink($topic); ?>"><?php bbp_topic_title($topic) ?> (<?php bbp_topic_last_active_time($topic); ?>)</a>

    This translates as

    <a href="[topic link]">[topic title] ([date])</a>

    which makes both the topic title and the date a single clickable link and the code shows 3 of these.

    I’m not really sure what you are trying to achieve – I had thought you wanted 3 clickable links on both title and date, which is what the above does.

    If you don’t want the date clickable, then do

    <a href="<?php bbp_topic_permalink($topic); ?>"><?php bbp_topic_title($topic) ?></a> (<?php bbp_topic_last_active_time($topic); ?>)

    In reply to: access control

    @robin-w

    Moderator

    I wrote that guide.

    it says

    Private – Only logged in registered users with a forum role can see these forums

    so if you set it to private, then those forums don’t display, so no-one will see that they exist.

    so I’m not quite sure how someone not logged in will see it to click it and get the 404?

    In reply to: access control

    @robin-w

    Moderator

    if you want the forum’s existence to be public – ie showing in the forum list, but not accessible then use my private groups plugin, with forum visibility set.

    Private groups

    private groups is a powerful plugin, allowing lots of granularity, but for your initial requirements :

    once installed and activated, go to

    dashboard>settings>bbp private groups

    in group name settings – set up a group 1 to be called anything but say ‘registered’
    In forum visibility – activate this, and set up where you want to redirect users to
    in assign groups to roles – select ‘Add group on first or no-group login’ and set participants to be assigned group 1
    then for each forum that you want users to see exists but not access, go into
    dashboard>forums>all forums>edit the forum and
    a) set the forum to public – the plugin will stop users seeing content
    b) you will see that you can assign it to a group – so set it to group 1

    If this is all forums, you will set each to this. If you have public forms where you want anyone to be able to see the forums, then don’t set a group

    dashboard

    @robin-w

    Moderator

    can you explain that a bit further?

    on my site it shows 3 posts, but if there are no posts, it says ‘no topics’.

    @robin-w

    Moderator

    picture not showing so can’t help

    @robin-w

    Moderator

    The topic ID is a changeable box, so lets you change the id number. Lots of code would be needed to get it to work for titles, but this code will show the topic name in the box at the bottom

    add_action( 'bbp_reply_metabox', 'rew_topic_title' );
    
    function rew_topic_title ($post_id ) {
    	$reply_topic_id = bbp_get_reply_topic_id( $post_id );
    	?>
    	<p>
    			<strong class="label"><?php esc_html_e( 'Topic Title:', 'bbpress' ); ?></strong>
    			<label class="screen-reader-text" for="bbp_author_id"><?php esc_html_e( 'Topic Title:', 'bbpress' ); ?></label>
    			<?php bbp_topic_title ($reply_topic_id) ; ?>
    		</p>
    	<?php
    }

    Put this in your child theme function file

    Functions files and child themes – explained !

    In reply to: 404 user profile

    @robin-w

    Moderator

    great – glad you are fixed

    @robin-w

    Moderator

    Log out and log in again

    I’d also look strongly at updating your wordpress and bbpress versions to the latest, as they both have security updates

    @robin-w

    Moderator

    to get rid of all forum data

    dashboard>tools>forums>reset forums

    @robin-w

    Moderator

    in place of your code put back the original

    	<?php bbp_forum_freshness_link(); ?>
    

    and then add this to your functions file

    add_filter( 'bbp_get_forum_freshness_link', 'rew_freshness_last_three' , 100, 6) ; 
    	
    function rew_freshness_last_three ($anchor, $forum_id, $time_since, $link_url, $title, $active_id ) {
    	//set up and run a query to get a list of all topics in this forum that this user can see
    	// Setup possible post__not_in array
    	$post_stati[] = bbp_get_public_status_id();
    
    	// Super admin get whitelisted post statuses
    	if ( bbp_is_user_keymaster() ) {
    		$post_stati = array( bbp_get_public_status_id(), bbp_get_private_status_id(), bbp_get_hidden_status_id() );
    
    	// Not a keymaster, so check caps
    	} else {
    
    		// Check if user can read private forums
    		if ( current_user_can( 'read_private_forums' ) ) {
    			$post_stati[] = bbp_get_private_status_id();
    		}
    
    		// Check if user can read hidden forums
    		if ( current_user_can( 'read_hidden_forums' ) ) {
    			$post_stati[] = bbp_get_hidden_status_id();
    		}
    	}
    	// Parse arguments against default values
    	$r = array(
    		'post_parent'         => $forum_id,
    		'post_type'           => bbp_get_topic_post_type(),
    		'post_status'         => implode( ',', $post_stati ),
    		'ignore_sticky_posts' => true,
    		'posts_per_page' => -1
    		);
    	
    
    	// Create a new query for the topic list
    	$get_posts = new WP_Query();
    
    	$topics = $get_posts->query( $r ) ;
    	
    	//var_dump ($topics) ;
    	
    	//now run through this list and get the last active date of each topic
    	foreach ($topics as $topic) {
    		$id = $topic->ID ;
    		$last_active = get_post_meta( $id, '_bbp_last_active_time', true );
    		$curdate = strtotime($last_active);
    		$show[$curdate] = $id ;
    		}
    	if (!empty ($show)) {
    		//so now we have a list of dates with topic ids, so we need to find the latest 3
    		arsort($show);
    		$count=0 ;
    		foreach ($show as $topic) {
    			$count++ ;
    			?>
    			<a href="<?php bbp_topic_permalink($topic); ?>"><?php bbp_topic_title($topic) ?> (<?php bbp_topic_last_active_time($topic); ?>)</a>
    		<?php
    			if ($count == 3) break ;
    		}
    	}
    	else echo 'No topics' ;
    
    	
    }

    It has to sort through all topics for all forums to work this out, so it may slow your forums index display and get worse as your forum content grows.

    @robin-w

    Moderator

    the page is a virtual page

    you can make it an actual wordpress page by following

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

    Item 3 method 2

    In reply to: Search isn’t working

    @robin-w

    Moderator

    Forum search not working

    ok, if you need help, you’ll need to put a bit more than this.

    Suggest you

    1. work through this link first

    Before Posting

    2. if you still have an issue, tell us exactly what is not working ie I type x and y happens

    In reply to: Two URLs for same page

    @robin-w

    Moderator

    not quite sure what you last sentence means, but in essence if

    dashboard>settings>forums>forum root slug>forum root equals ‘forums’, then create a page with the permalink of ‘forums’ and put

    [bbp-forum-index]

    in it. You can then do your seo on that page

    If you are using yoast seo, you may want to add this plugin as well – I haven’t yet looked at it, but seems to do some seo stuff on topics etc.

    BBpress Addon For Yoast SEO

    In reply to: strange 404 issue

    @robin-w

    Moderator

    I wouldn’t worry, this is just part of bots attempts to post stuff to your site. Those SEO emails I expect you keep getting – well those idiots that pay them to raise their sites ranking just create this stuff – bots trying to put references to their site on your site to raise google ranking – ignore it.

    They don’t hurt your rankings

    @robin-w

    Moderator

    user will get forum access as per

    dashboard>settings>forums>auto role – you can change this to blocked if you don’t want automatic access.

    The rest of your request would require some bespoke code, which is well beyond any free help I’m afraid.

Viewing 25 replies - 8,451 through 8,475 (of 14,231 total)