Search Results for 'code'
-
Search Results
-
Hi,
I’m trying to add some detail to search results associated with replies to topics. By default, it would seem that if a search finds a hit in a particular topic post, it includes the name of the topic and the relevant forum in the header for the particular search result:
In contrast, a hit on a reply to a particular topic does not include any topic or forum information:I thought I might be able to solve my problem by modifying the loop-search-reply.php template to include what looked like it might be the relevant code from the loop-search-topic.php template:
<div class="bbp-topic-title-meta"> <?php if ( function_exists( 'bbp_is_forum_group_forum' ) && bbp_is_forum_group_forum( bbp_get_topic_forum_id() ) ) : ?> <?php esc_html_e( 'in group forum ', 'bbpress' ); ?> <?php else : ?> <?php esc_html_e( 'in forum ', 'bbpress' ); ?> <?php endif; ?> <a>"><?php bbp_forum_title( bbp_get_topic_forum_id() ); ?></a> </div><!-- .bbp-topic-title-meta --> <?php do_action( 'bbp_theme_after_topic_title' ); ?>
but it seems that was a little naive of me. This block of code certainly includes what could be the required information:
but what I thought would be inserted as the forum name turns out to be the topic name.
Looking at the above code, I can see why this might be—the relevant text, ‘bbpress’, in the code block above appears to be just some placeholder text, and is the same placeholder text used to reference the topic name. I had thought that the text replacement might be a little more context sensitive than it appears to be.
So my question is, can anyone tell me how that text (‘bbpress’ in the above code segment, which is taken directly from the default loop-search-topic.php template) gets replaced, or more specifically I guess, can anyone tell me where to inject a function or the like to set this or some other piece of placeholder text (I appreciate that it may need to be different to the placeholder text being used for the topic name) to the relevant forum name?
Thanks
Topic: Changelog v 2.6.5?!
Got a notification in my WP plugins admin page there’s an update of bbBress (Version: 2.6.5
– 5 days ago)Following the changelog link, gets me here https://codex.bbpress.org/releases/
there is no mention of 2.6.5 (even 2.6.4 is still TBA)…..
so without knowing even the most basic things as to what might have changed I cannot in good faith update the plugin
PS: hmm, seems i need to click on “blog” next to the 2.6.4 “TBA” release …..
perhaps someone should update the https://codex.bbpress.org/releases/ page at some pointHello all.
I’ve been editing the bbPress 2.6.5 plugin a bit, in order to fit my use.As of now, I just wanna track down the topic_id and the author_id.
That’s pretty simple, given the set of functions available for the community.So I managed to write this little code here:
global $author_id; global $id_of_topic; $id_of_topic = bbp_get_topic_id(); $author_id = bbp_get_topic_author_id($id_of_topic);
The ID of the Topic is successfully retrieved, let’s say it’s “18446744073709551615”,
but once I pass that variable to bbp_get_topic_author_id(), the output of $author_id is 0.Now that’s pretty weird considering that if I pass the number 18446744073709551615 directly into that function, everything goes fine, I retrieve the author_id successfully.
One thing I noticed tho, is that printing out $id_of_topic, once with %d and once with %u (just after I call bbp_get_topic_id() ), I get two different values.
– %d = 0
– %u = 18446744073709551615Pretty weird.. How can I somehow pass the %u to bbp_get_topic_author_id()?
Thanks in advance! 🙂
Topic: Subforum list spacing issue
Theme – Aardvark
Hey guys, I’m having an issue with how my theme is interacting with the bbpress subforum list. I added the bbpress style pack plugin because of a issue I was having with the search bar, but it resulted in all the subfourms piling up on one another. The issue arises because the subforums have a box background (which I like), but the background overlaps with the other subforums. You can see the issue I’m having here.
http://www.podfolk.com/forums/
Does anyone know any code I can put into the style or functions file to resolve the issue?
I have a problem with the way breadcrumbs are being displayed on my search results screen.
First of all, I have the following (amongst other things) in my functions.php file:
/** Just a simple breadcrumb trail, but, importantly, don't double up when we're at the root **/ function mycustom_breadcrumb_options() { // Home - default = true $args['include_home'] = false; // Don't need breadcrumbs if we're at the root if ( apply_filters( 'bbp_no_breadcrumb', is_front_page() ) ) { // Forum root - default = true $args['include_root'] = false; // Current - default = true $args['include_current'] = false; } return $args; } add_filter('bbp_before_get_breadcrumb_parse_args', 'mycustom_breadcrumb_options' ); /** Search only the specified forum **/ function my_bbp_filter_search_results( $r ){ //Get the submitted forum ID $forum_id = sanitize_title_for_query( $_GET['bbp_search_forum_id'] ); //If the forum ID exits, filter the query if( $forum_id && is_numeric( $forum_id ) ){ $r['meta_query'] = array( array( 'key' => '_bbp_forum_id', 'value' => $forum_id, 'compare' => '=', ) ); } return $r; } add_filter( 'bbp_after_has_search_results_parse_args' , 'my_bbp_filter_search_results' );
I have a search box on the forum home page and on the index page for each individual forum. For general navigation around my forum the breadcrumbs are presented as one might expect and search results are confined to those relevant to the current forum (or all forums from the home page).
The breadcrumbs on the Forum ‘home page’ show simply as
Forums
and on individual forum index pages asForums > ForumName
, where ‘ForumName’ is the name of the current forum, etc. A search request from the Forum home page returns results as expected, with the breadcrumbs displayed asForums > Search > Search Results for 'search string'
. However, while a search from one of the individual forum index pages returns the refined search results as expected, the breadcrumbs are always displayed asForums > Search > Search Results for 'search string'
, they don’t include the name of the forum that has been searched (i.e.Forums > ForumName > Search > Search Results for 'search string'
.I think I can see that the search is actually being applied to all forums, then refined by the relevant function in the
functions.php
file, so I think I can see why I might have to do a little extra work to get the relevant forum name displayed in the breadcrumb, but can anyone suggest how I might do this? It would seem that I should be able to add a little more code to mymycustom_breadcrumb_options()
function, but what exactly…?Thanks for any assistance anyone can offer.
(WordPress 5.4.1, bbPress 2.6.5, website: digitalconcepts.net.au/forum – Please note, this part of the website is ‘hidden’ from the home page, you need to navigate there via the above direct URL)