Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 4,651 through 4,675 (of 32,518 total)
  • Author
    Search Results
  • #189210

    In reply to: Recent replies list

    kasperdalkarl
    Participant

    I tried to do that now and update the file, but still no change.

    <?php

    /**
    * Forums Loop
    *
    * @package bbPress
    * @subpackage Theme
    */

    ?>

    <?php echo do_shortcode(‘[bbpress_recent_replies_by_topic show =5]’) ?>

    <?php do_action( ‘bbp_template_before_forums_loop’ ); ?>

    <ul id=”forums-list-<?php bbp_forum_id(); ?>” class=”bbp-forums nk-forum”>

    <?php while ( bbp_forums() ) : bbp_the_forum(); ?>

    <?php bbp_get_template_part( ‘loop’, ‘single-forum’ ); ?>

    <?php endwhile; ?>

    <!– .forums-directory –>

    <div class=”nk-gap-2″></div>

    <?php do_action( ‘bbp_template_after_forums_loop’ ); ?>

    #189207
    brent0r
    Participant

    @kdelsimone
    If you want the link changed from the topic to the reply, I suggest copying loop-search-reply.php from /wp-content/plugins/bbpress/templates/default/bbpress to your child themes bbpress directory @ /wp-content/themes/theme-child/bbpress
    From there you can edit it and change line 25 from this:
    <a class="bbp-topic-permalink" href="<?php bbp_topic_permalink( bbp_get_reply_topic_id() ); ?>"><?php bbp_topic_title( bbp_get_reply_topic_id() ); ?></a></h3>

    to this:
    <a class="bbp-topic-permalink" href="<?php bbp_reply_url(); ?>"><?php bbp_topic_title( bbp_get_reply_topic_id() ); ?></a></h3>

    #189190

    In reply to: Recent replies list

    Robin W
    Moderator

    not sure why, but adding show seems to fix

    <?php echo do_shortcode(‘[bbpress_recent_replies_by_topic show =5]’) ?>

    #189186
    Robin W
    Moderator

    I’ve been thinking this over, and can’t see a simple way to achieve this.

    To get something working would involve adding extra fields to a topics meta data, and then filtering the display to catch.

    With the forum visible in effect the code for a forum or set of forums would need to (by default) make a topic private using an additional field, and then all the display parameters would need to hide it unless made public. That means closing every back door in search, profiles, displays, freshness all widgets and other areas so that no-one sees it unless set to public, which is one hell of a lot of work, and a large re-write of many bbpress functions.

    I could modify my private groups plugin which makes forums (but not content) visible, so that certain topics are shown, but again it is a heap of code. Beyond free help I’m afraid, but if you want to look at that route contact me via my website http://www.rewweb.co.uk

    #189185

    In reply to: Recent replies list

    kasperdalkarl
    Participant

    Currently it looks like this:

    <?php

    /**
    * Forums Loop
    *
    * @package bbPress
    * @subpackage Theme
    */

    ?>

    <?php echo do_shortcode(‘[bbpress_recent_replies_by_topic]’) ?>

    <?php do_action( ‘bbp_template_before_forums_loop’ ); ?>

    <ul id=”forums-list-<?php bbp_forum_id(); ?>” class=”bbp-forums nk-forum”>

    <?php while ( bbp_forums() ) : bbp_the_forum(); ?>

    <?php bbp_get_template_part( ‘loop’, ‘single-forum’ ); ?>

    <?php endwhile; ?>

    <!– .forums-directory –>

    <div class=”nk-gap-2″></div>

    <?php do_action( ‘bbp_template_after_forums_loop’ ); ?>`

    #189183
    kasperdalkarl
    Participant

    Hi there!

    I have been trying to following this guide to add a list of recent topics before the forum categories: https://www.daggerhart.com/bbpress-recent-replies-shortcode/

    I have put the code in the functions.php file, and <?php echo do_shortcode(‘[bbpress_recent_replies_by_topic]’) ?> in loop-forums.php

    After having done this the code isn’t visible, so I am wondering if I have made a mistake. Could anyone be so kind and shed some light on how to make this work?

    My forum can be found on http://www.talanrien.com/forums

    I am running WordPress 4.9.1 with Bbpress version 2.5.14

    As a bonus question I was also wondering if anyone know if it’s possible to ad a shoutbox/chatbox at the bottom of the forum?

    Thank you!

    Best wishes,
    Kasper

    brent0r
    Participant

    functions.php

    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' ;
    }

    It works perfectly when viewing the category page that lists all topics. When I click the topic however and view the post it displays the following in the breadcrumbs:
    › Forums › General › Mobile General › hi Reply To: test (3 weeks, 2 days ago)

    See how it adds the topic title with (the date) that has its link removed, to the end of the breadcrumb.

    Robin W
    Moderator

    can you post the whole of your code – so I can copy/paste into my file and check what it does on mine

    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)

    #189176
    Robin W
    Moderator
    #189163
    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' ;
    }
    adamorigin2
    Participant

    Hello everyone. I was wondering if there is a complete list anywhere for the bbPress plugin of all the functionalities available to the end-user, a general forum user on a wordpress site using bbPress. For instance, having a list of before and after of code and examples to demonstrate what is available and how it works.

    For example: the functionality of some of the quicktags is a little ambiguous in what they do. There are some code option for smileys but how many and what they are is unknown. There are options to address previous users in the forums. Ability to embed youtube by placing a link. I am not sure if this is all bbPress on the sites I use as they could be using multiple plugins but having a comprehensive list on what is available for bbPress would be quite handy. Maybe this already exists somewhere but I have not been able to find it as all advice answeres is catered towards the technical end of implementation not general users.

    If I could also make a request for such a user help list to be included in the bbPress plugin in something like a drop down or expandable Help List of all available functionality for general users.

    It would be great for end-users to be able to utilise this plugin to its full potential but its near impossible to know what that is without a fair bit of trial-and-error. Like I said – maybe this is listed somewhere but it would be great if it was included in the actual plugin design.

    Thanks.

    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); ?>)

    #189146

    In reply to: access control

    Steve
    Participant

    Thanks for the link. I will check out your plugin. It may be what I need. Though still wondering about access control.

    I am mostly confused by the “FORUM ACCESS” that is described here,
    https://codex.bbpress.org/step-by-step-guide-to-setting-up-a-bbpress-forum/#5-%c2%a0forum-visibility-and-access

    It talks about viewing and posting permissions but doesn’t say WHERE it is. It is very frustrating.

    Anybody know if these settings really exist and WHERE they are. Thanks.

    brent0r
    Participant

    When I use your code above, I get the 3 last posts without a link on the date/time.

    When I am not using your 3 last posts code (different site) from above, bbpress naturally links the last post.
    How would I best go about removing just the link from a single last post in that example?

    I’ve figured that I could use your code as above but change to ($count == 1). I’m obviously not experienced with writing code but to me it seems an excessive way to go about it.

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

    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.

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

    brent0r
    Participant

    I’ve managed to find a solution, I will add styling later to both topic title and date.
    <a href="<?php bbp_forum_last_reply_url(); ?>"><?php bbp_forum_last_topic_title() && bbp_forum_last_topic_title(); ?> (<?php bbp_forum_last_active_time(); ?>)</a>

    I’d still love to find a way to display 3 last posts rather than just one.

    #189091

    In reply to: Freshness Link

    brent0r
    Participant

    Is it possible to post your final, working code used?

    #189089

    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

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

    brent0r
    Participant

    On the forums index under Last Post I have:

    “Title Of the Thread That Was Updated Most Recently”
    “17 hours, 11 minutes ago”

    I am wanting to put the two on a single line.
    eg. “Title of the Thread (7 hours, 11 minutes ago)”

    The area of the loop-single-forum file is as follows:

    <li class="bbp-forum-freshness">
    
    		<?php do_action( 'bbp_theme_before_forum_freshness_link' ); ?>
    
    		<?php bbp_forum_freshness_link(); ?>
    
    		<?php do_action( 'bbp_theme_after_forum_freshness_link' ); ?>
    
    		<p class="bbp-topic-meta">
    
    			<?php do_action( 'bbp_theme_before_topic_author' ); ?>
    
    			<span class="bbp-topic-freshness-author"><?php bbp_author_link( array( 'post_id' => bbp_get_forum_last_active_id(), 'size' => 14 ) ); ?></span>
    
    			<?php do_action( 'bbp_theme_after_topic_author' ); ?>
    
    		</p>
    	</li>
    

    I’ve tried editing this quite a bit but all attempts have failed. Any tips or feedback on how I can display the Thread Title (time posted) on a single line would be greatly appreciated.

    Thank you!

    tylertervooren
    Participant

    Thanks, Robin. I think I’m using a few of your plugins as well. 🙂

    The way I approached this plugin is that it’s only use is to print the url of the user profile. As you can see, no surrounding a tag and no anchor text. That means you can put it anywhere inside of your own links, which is probably even easier than trying to specify that with a shortcode attribute.

    So, if the logged in/logged out part were added, it would still break, just in a different way. 🙂

    The idea is that, if you need to check for logged in/logged out status, you probably need to do it for multiple elements of your site. In that case, a separate plugin that does that is more useful and will work in harmony with this one.

    Anyway, that was my thought process. Happy to hear other thoughts.

Viewing 25 results - 4,651 through 4,675 (of 32,518 total)
Skip to toolbar