The easiest way is to install the GD attachments plugin – and in the settings note something like a class = ”my-class” rel = ”prettyPhoto”
In addition, your WP must have a lightbox mechanism on board – there are many lightbox plugins in the repository. This script will to command light box style when you click on the picture.
But I went the other way – I added a class with a new relay through the filters – and the lightbox mechanism is already built into my bbp-theme. This also works.
Found it. Download the plugin: bbpress do shortcodes
But where can you enable shortcodes? I also have this problem with the polls.
For anyone looking for a solution, it’s as simple as calling
<?php
echo '<pre>';
print_r(bbp_get_moderators(bbp_get_forum_id()));
echo '</pre>';
?>
Or you could echo bbp_get_moderator_list(bbp_get_forum_id());
for a simple list of moderators. Remember to put it inside the loop!
I could get the code to set on the thumbnails in the topic index page using GD bbPress Attachments.
function action_bbp_topic_row_actions() {
$medias = get_attached_media( 'image', bbp_get_topic_id() );
foreach($medias as $media){
the_attachment_link( $media->ID,false );
}
}
add_action( 'bbp_theme_before_topic_title', 'action_bbp_topic_row_actions', 10, 0 );
Add other method.
I have succeeded to set the images on topic index page.
but I have no idea to change images to thumbnails.
Do you have any ideas for thumbnails?
function action_bbp_topic_row_actions() {
if ( have_posts() ) while ( have_posts() ) : the_post();
$medias = get_attached_media( 'image', bbp_get_topic_id() );
foreach($medias as $media){
the_attachment_link( $media->ID );
}
endwhile;
}
add_action( 'bbp_theme_before_topic_title', 'action_bbp_topic_row_actions', 10, 0 );
Hello,
I’m trying to get a list of the current forum’s moderators, I have this argument that filters all the users and lists me all the moderators from all the other forums.
$args = array( 'role' => 'bbp_moderator');
The above code lists all of the moderators from all the forums, I only want the moderators of the current forum, any parameters or snippet that could help me?
The bbress Support 7 years ago. Topic Thumbnails?
add_action( 'bbp_theme_before_topic_title', 'assylumn_insert_thumbnail' );
function assylumn_insert_thumbnail() {
echo('<a href="http://www.mysite.com/wp-content/uploads/2013/09/picture.jpg">') ;
echo('<img class="bbp-topic-thumbnail" width="100%" style="max-width: ' . get_option('thumbnail_size_w') . 'px; max-height: ' . get_option('thumbnail_size_h'). 'px; vertical-align:middle;" src="http://www.mysite.com/wp-content/uploads/2013/09/picture.jpg"/>' .'</a>');
}
I did not know how to get the url in each topic pictures using plugin, GD bbPress Attachments.
Please show me other code to get the url in the topic pictures.
yes, strtotime(‘now’) will pick up gmt, so needs adjusting, you night want to look at
$now = date_create( date_i18n( 'Y-m-d H:i:s' ) );
So, the final css looks like this (you must put “a”)
#bbpress-forums .bbp-topic-freshness .dayfresh a {
background-color : #f4ffe8 ;
border: 1px dashed;
color: #475656;
}
also 86400 looks a lot – captures the 2nd day. Perhaps need to set 23 hours. But these are little things ))
Thanks to Robin for the great code!))
I think this is a useful find for those who visit the forum once a day and immediately see how many topics have been updated in the last day.
Colored blocks are very noticeable – it’s better than straining and peering at the date numbers.
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’]