To go deeper into that code a code that does “forumS” for more than one and “forum” for just one?
$tf = get_total_forums();
printf(__ngettext('Viewing %d forum', 'Viewing %d forums', $tf), $tf);
functions.bb-statistics.php isn’t automatically included. The statistics.php file (https://trac.bbpress.org/browser/tags/1.0.2/statistics.php#L5) does include that file as well.
Can someone simplify this code?
1. to show only the parent forums
BTW the code you have does work in front-page.php but does not in forum.php
Thanks! that works great. To go deeper into that code a code that does “forumS” for more than one and “forum” for just one?
<?php
require_once( BB_PATH . BB_INC . 'functions.bb-statistics.php' );
echo '<p>Viewing ', get_total_forums(), 'forums</p>';
?>
You put on the “jQuery please” tag?
Your code is much cleaner for my use.
I check a WP theme and I’m assuming it’s something like this…
<?php if (is_page()) { $highlight = "forum-link"; } else {$highlight = "current"; } ?>
<?php foreach ( $forums as $forum ) : ?>
<a class="<?php echo $highlight; ?>" href="<?php forum_link( $forum->forum_id ); ?>"><?php forum_name( $forum->forum_id ); ?></a>
<?php endforeach; ?>
but it’s not is_page(), it’s something else.
Okay I will have on my header the Forum Names as “Pages”
Installation – Troubleshooting – Themes – Plugins – etc
When I’m on the Troubleshooting page (https://bbpress.org/forums/forum/troubleshooting) the class of trouble shooting will be “selected”.
<li><a href="https://bbpress.org/forums/forum/installation">Installation</a></li>
<li><a href="https://bbpress.org/forums/forum/troubleshooting" class="selected">Trouble Shooting</a></li>
make sense?
Check this micro-plugin. It loads jquery in every page.
<?php
/*
Plugin Name: jQuery please
Plugin URI: http://www.the.url.com
Description: I really need jQuery
Version: 1.0
Author: Me
Author URI: http://www.the.url.com
*/
add_action('bb_init', 'jquery_please_initialize');
add_action('bb_head', 'jquery_please_js', 100);
function jquery_please_initialize()
{
bb_enqueue_script('jquery');
}
function jquery_please_js()
{ ?>
<script type="text/javascript">//<![CDATA[
// Your script goes here
//]]></script>
<?php
}
?>
if I delete a topic, then go back to the topic via the admin panel in order to ‘undelete’ the topic, it doesn’t work.
On clicking ‘undelete entire topic’ I am forwarded to a blank screen at a url in this format (had to break it up to fit on the page):
/bbpress/bb-admin/delete-topic.php?
id=2090&view=all&_wp_http_referer=/bbpress/topic.php
%3Fid%3D2090%26view%3Dall&_wpnonce=be30703be1
this is the case with no plugins installed and default template. Any ideas? I couldn’t find this issue anywhere on the forums already.
<p>Viewing <?php echo get_total_forums() ?> forums</p>
Hi, I’m making a navigation and was looking for help with highlighting the links, depending what page/forum you are on.
I have a homepage nav link like:
<a href="/forum">Mainpage</a>
how can I add class=”current” and highlight the link when on the mainpage?
I also run a list of the forums in a similar style
<?php foreach ( $forums as $forum ) : ?>
<a class="forum-link" href="<?php forum_link( $forum->forum_id ); ?>"><?php forum_name( $forum->forum_id ); ?></a>
<?php endforeach; ?>
Is there a way to add class=”current” depending on what forum the user is browsing?
I know this can be done on wordpress, but I dont know the functions for bbpress yet, and good info is far and wide.
found it! there was a single space after the final ?> in the main quote.php file – damn!!
based on http://bbpress.org/plugins/topic/improved-spoiler/
instead only using css my mod using javascript based on spoiler plugin vbulletin
here is the php mod http://pastebin.com/ReTD7eJE
and this is the final look
http://i40.tinypic.com/2h5qlg8.png
you need to add this in your css template file
.spoilerbg {width:auto;height:auto;background:#e1e4f2;border:1px inset;padding:5px;}
the problem now, the Improved Spoiler Plugin doesnt build for nested spoiler like
the first spoiler will be broken, diffrent from vbulletin spoiler plugin
Yes, thank you! I edited to fit my needs.
with this code
<?php if ( bb_forums() ) : while ( $depth = bb_forum() ) : if( $depth > $last_depth ) : ?>
<?php echo str_repeat(" ",$depth) ?>
<?php else : ?></li>
<?php while( $depth < $last_depth ) : echo str_repeat(" ",$depth+1) ?>
<?php echo str_repeat(" ",$depth) ?></li>
<?php $last_depth--; endwhile; endif; if (bb_get_forum_is_category()) :
echo str_repeat(" ",$depth) ?><li class="forum_cat"><a href="<?php forum_link() ?>" title="<?php forum_description(array('before'=>'','after'=>'')) ?>"><?php forum_name() ?></a>
<?php else :
echo str_repeat(" ",$depth+1) ?><li class="forum_subforum"><a href="<?php forum_link() ?>" title="<?php forum_description(array('before'=>'','after'=>'')) ?>"><?php forum_name() ?></a>
<?php endif; $last_depth = $depth; endwhile ?>
</li>
</ul>
# 2. how do I make the current forum have a class=”selected”
in bbcode-button.js
var CSS=’#bbcode_buttons div {float:left; background:#999; border:1px solid #666; border-radius:2px; -moz-border-radius:2px; -webkit-border-radius:2px; color:#fff; padding: 0px 6px 1px 6px; margin: 1px 7px 2px 0;’
+’font: 1.2em times, serif; word-spacing: -1px; height: 16px; vertical-align:middle; line-height:16px;’
+’text-align:center; position:relative; cursor: pointer; cursor: hand;}’;
Two part question
1. Is there a code to imitate wp_list_pages(‘title_li=’) with the forum names?
result in…
<li><a href="http://bbpress.org/forums/forum/installation">Installation</a></li>
<li><a href="http://bbpress.org/forums/forum/troubleshooting">Trouble Shooting</a></li>
etc etc…
2. How do you add class=selected to current forum page?
No good 
but… from your other related thread…
<?php echo bb_get_avatar( $topic->topic_last_poster, ’16’);?>
works bro! I owe you a few beers, thankyou!
I placed just the backup back
Otherwise i put
RewriteRule ^attachments/([^/]+)/download/([0-9]+)/inline/?$ /?bb_attachments=$1&bbat=$2&inline [L,QSA]
RewriteRule ^attachments/([^/]+)/download/([0-9]+)/?$ /?bb_attachments=$1&bbat=$2 [L,QSA]
oke now i modified the htaccess with that. Is that what you meant?
in .htaccess add
RewriteRule ^attachments/([^/]+)/download/([0-9]+)/inline/?$ /?bb_attachments=$1&bbat=$2&inline [L,QSA]
RewriteRule ^attachments/([^/]+)/download/([0-9]+)/?$ /?bb_attachments=$1&bbat=$2 [L,QSA]
in bb-attachments.php line 234 edit like this
if ($attachment->status==0) {
$output.=" "."<a href='".$uri."attachments/$attachment->post_id/download/$attachment->id/'>".$attachment->filename."</a> "." ";
}
in bb-attachments.php line 289
if (file_exists($fullpath)) { // it's been resized, so it's likely on AWS, show directly
$aws=$bb_attachments['aws']['url'].$file->id.'.'.$file->filename;
$replace="<a class='bb_attachments_link' href='".$uri."attachments/".$match[1]."/download/".$match[2]."'><img src='$aws' /></a>";
if (is_bb_feed()) {$replace=wp_specialchars($replace);}
$text=str_replace($match[0],$replace,$text);
}
in bb-attachments.php line 298
http://pastebin.com/gDG523R2
so now your attachments have permalink like this
example.com/attachments/*postid*/download/*attachmentid*/
and embed image url
example.com/attachments/*postid*/download/*attachmentid*/inline/
Related thread : http://bbpress.org/forums/topic/on-attachment-file-permalink
function get_post_img(){
global $bbdb;
$topic_id_ft = get_topic_id(); //topic id for getting text of first post of the topic
$first_post = (int) $bbdb->get_var("SELECT post_id FROM $bbdb->posts WHERE topic_id = $topic_id_ft ORDER BY post_id ASC LIMIT 1");
$content = substr(strip_tags(strip_shortcodes(get_post_text($first_post))),0);
preg_match('/[img](.*?)[/img]/i', $content, $matches);
$src = $matches[1];
echo $src;
}
modified from here http://bbpress.org/forums/topic/show-a-snippet-of-the-post-under-the-topic-title#post-39260
Okay based on my question, this might work
<?php
if (function_exists('bb_get_photo'))
bb_get_photo($topic->topic_last_poster);
?>
try it?