The class appeared in the code!
Moment, now I will figure out why the css does not catch it… and finally give the picture the result !…
ok try this for topics in a forum
add_filter ('bbp_get_topic_freshness_link' , 'rew_check_freshness2', 10 , 5 ) ;
function rew_check_freshness2 ($anchor, $topic_id, $time_since, $link_url, $title) {
$last_active = get_post_meta( $topic_id, '_bbp_last_active_time', true );
$diff = strtotime('now') - strtotime($last_active) ;
if ($diff<86400) {
$anchor = '<span class="fresh">'.$anchor.'</span>' ;
}
return $anchor ;
}
#bbp-topic-8191 > li.bbp-topic-freshness in code
#bbpress-forums .bbp-topic-freshness a { in css
this is a small box with a time stamp (see pic. above) white background now
ok, that’s where it should be, and it should work.
where are you putting the code ?
ahh – think I have misunderstood now I re-read, given the post you attached to, I thought your question was regarding the freshness columm, but now I don’t know.
my code adds a class in the freshness column
<li class="bbp-forum-freshness">
<span class="fresh"><a href="http://gos.rewweb.co.uk/forums/topic/eferwer/" title="EFERWER">8 hours, 14 minutes ago</a></span>
so can you explain exactly what you want to turn green?
try this
add_filter ('bbp_get_forum_freshness_link' , 'rew_check_freshness', 10 , 6 ) ;
function rew_check_freshness ($anchor, $forum_id, $time_since, $link_url, $title, $active_id) {
$last_active = get_post_meta( $forum_id, '_bbp_last_active_time', true );
$diff = strtotime('now') - strtotime($last_active) ;
if ($diff<86400) {
$anchor = '<span class="fresh">'.$anchor.'</span>' ;
}
return $anchor ;
}
This adds an extra span class called ‘fresh’ if the last active is less than 24 hours.
you can then style this in css eg
.fresh {
background-color : green ;
}
the easiest was is to create a page with the same permalink as your forum slug, so in your case ‘forums’
so create a page called ‘forums’
in the content put the html you want and follow with the shortcode [bbp-forum-index] if you are using blocks, wordpress has a shortcode block type ‘sh’ in type and it will appear.
and publish – check that it appears as http://mysite.com/forums
and that should work
in which case you would hook to
$subject = apply_filters( 'bbp_subscription_mail_title', '[' . $blog_name . '] ' . $topic_title, $reply_id, $topic_id );
in bbpress 2.6.6\includes\common\functions.php line 1124 and 1291
ok,
the default display order is freshness, followed by author – you have it the other way around.
try changing the line above
add_action( 'bbp_theme_after_topic_author', 'rew_freshness_display_image');
to
add_action( 'bbp_theme_after_forum_freshness_link', 'rew_freshness_display_image');
you don’t need stylepack, it’s just that the answer is different if you do !
I’ll come back with code when I get a moment 🙂
Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
Code Snippets
add_action( 'bbp_theme_after_topic_author', 'rew_freshness_display_image');
function rew_freshness_display_image ($forum_id = 0) {
// Verify forum and get last active meta
$forum_id = bbp_get_forum_id( $forum_id );
$active_id = bbp_get_forum_last_active_id( $forum_id );
$link_url = $title = '';
if ( empty( $active_id ) )
$active_id = bbp_get_forum_last_reply_id( $forum_id );
if ( empty( $active_id ) )
$active_id = bbp_get_forum_last_topic_id( $forum_id );
if ( bbp_is_topic( $active_id ) ) {
//then reset forum_id to the forum of the active topic in case it is a sub forum
$forum_id = bbp_get_topic_forum_id($active_id);
$link_url = bbp_get_forum_last_topic_permalink( $forum_id );
$title = bbp_get_forum_last_topic_title( $forum_id );
} elseif ( bbp_is_reply( $active_id ) ) {
//then reset forum_id to the forum of the active topic in case it is a sub forum
$forum_id = bbp_get_reply_forum_id($active_id);
$link_url = bbp_get_forum_last_reply_url( $forum_id );
$title = bbp_get_forum_last_reply_title( $forum_id );
}
$anchor = '<a class="rew_freshness_display_image" href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '"><img src="http://mysite.com/wp-content/uploads/2013/06/Brauhaus-2.jpg">' . '</a>';
echo '<p>'.$anchor.'</p>' ;
}
and change the <img src="http://mysite.com/wp-content/uploads/2013/06/Brauhaus-2.jpg" /> to the image you want – make sure it is sized right !!
GD bbPress Tools
It has option to quote reply or topic. This is the shortcode I refer to.
If you mean blockquote then yes, but it shows asa quote shortcode. See linked discussion.
well that’s embarassing, I hadn’t spotted that the shortcode is wrong.
It is one shortcode with parameters so should read
bsp Profile
[bsp-profile] will show ‘My Profile’ in a clickable link to the profile
[bsp-profile label=’This is the label’] will show ‘This is the label’ in a clickable link to the profile
[bsp-profile label=’Edit My Profile’ edit=’y’] will show ‘Edit My Profile’ in a clickable link to the edit section of profile
so you can have anything as the label eg label=’hello mother’
Sorry
The two shortcodes are, I assume they can work independently so does not need to work in conjunction with[bsp-profile] ?
[Profile label=’This is the label’]
[Profile label=’This is the label’]
there are 6 shortcodes in style pack, can you clarify which 2 you mean?
Image didn’t help me 🙁
No problem and any time you spend with this is great news for us all.
The [bsp-profile] now works perfectly for both single names and double spaced names and for myself, job done.
I did try the other two shortcodes and alas for myself they do not work at all, when either is placed in the menu or onto a page as a shortcode, then the shortcode is shown in menu, not the result of the shortcode,
please see image link for clarity and I assumed the remaining two shortcodes would work the same as [bsp-profile] i.e, just add and it works?
forum layout
[Profile label=’Edit My Profile’ edit=’y’]
sorry, I’d left a line of test code in which caused the user not to be selected, fixed in 4.7.7
I have also corrected the shortcode to do what it said in the documentation – so the default is ‘my profile’
so
[bsp-profile] will show ‘My Profile’ in a clickable link to the profile
[Profile label=’This is the label’] will show ‘This is the label’ in a clickable link to the profile
[Profile label=’Edit My Profile’ edit=’y’] will show ‘Edit My Profile’ in a clickable link to the edit section of profile
FYI – the shortcode produces the title My Profile which disappears when user logs out of account (which is great) and this new firmware seems to sit much better in my Top Menu, before it kept going to the Far Left and looked a little odd
😉 nearly there
Hi
My discussion is here:
https://github.com/EnlighterJS/Plugin.TinyMCE/issues/14
To summarize, I use EnlighterJS to display code blocks inside WordPress and bbPress. It is fantastic at what it does. However I have noticed odd behaviour if someone hits “Quote” and quotes a code block. You can see an example of what it looks like in the linked discussion.
It seems that the quote shortcut might nee some updating to cater properly for EnlighterJS code blocks. I can’t remember if this particular shortcode is part of bbPress or part of the bbPress GD Toolkit.
Thanks Robin.
Just installed and tested, shortcode [bsp-profile] creates https://uktechhub.com/forums/users/
No username at end ?
I tried three different browsers and cleared cache etc
I have plan to link bbpress to events manager plugin.
The path is [bbpress]⇒[WP calendar]⇒[events manager].
The participants look at topic in bbpress at first.
Next he visits WP calendar and then events manager booking-form at last.
How to send the bbpress topic title which he visited
to the next next page(booking-form in events managaer)?
Do I have to use filter or actions in events manager?
The code ongoing
add_filter('events-manager-hook', 'bbpress_title', 20);
function bbpress_title($topic_title,$topic_id){
global $my_global; // previous-topic title and topic title in the events manager
$topic_id = bbp_get_topic_id();
$topic_title['title']=$topic_id -> ???;
$my_global = get_topic_title();? ⇒ error!!
}
return $topic_title;
}
Or do you have any other plans?
Just making sure my last post did not get missed
SO the [bsp-profile] shortcode works for usernames when they do not have a space between them such as ‘billibob’ but fails when there is a space e.g. UK Sentinel ?
irstly I only included the fields Robin had supplied, I do not have a copy of Snitz to test either. So I commented out but didn’t remove any of the code so that it would stand out and you could update any of these as needed which you have done.
The forum ‘counts’ I think you may have incorrect in your post above:
* _bbp_topic_count – The number of topics that are ‘publicly’ visible
* _bbp_reply_count – The number of replies that are ‘publicly’ visible
* _bbp_total_topic_count – The total number of topics (includes topics that are are unapproved or hidden)
* _bbp_total_reply_count – The total number of replies (includes replies that are are unapproved or hidden)
A clearer explanation of each of these would be helpful and also are each of these fields in the FORUM_FORUM database table:
* F_TOPICS
* F_COUNT
* T_COUNT
* P_COUNT
The topic ‘counts’ is the same:ساخت استخر
* _bbp_reply_count – The number of replies that are ‘publicly’ visible
* _bbp_total_reply_count – The total number of replies (includes replies that are are unapproved or hidden)
Hello,
With Notepad ++ I added to the Po file a French translation for an expression contained in /plugins/bbpress/includes/topics/functions.php.
I then opened the Po file to validate the translation and generate the Mo file, they are up to date in languages / plugins / bbpress-fr_FR.po and also bbpress-fr_FR.mo.
The problem is that I do not see the translation of this expression on my site, all the others of the same Mo file are present.
I have looked at many expressions in this “functions.php” file and many of them have never been translated.
What is the problem ?
Thanks for your future answers.
Regards
Line 156 of functions.php :
// No topic title
if ( empty( $topic_title ) ) {
bbp_add_error( 'bbp_topic_title', __( 'Error: Your topic needs a title.', 'bbpress' ) );
}