<?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?
Okay I added echo and it works <?php echo bb_get_avatar( $topic->topic_last_poster, '16');?>
16 = is the size (in px) of the avatar you want for people who want to know.
Thank you!
bb_get_avatar( $topic->topic_last_poster, '16')
http://bbpress.org/plugins/topic/user-photo-for-bbpress/
Hi, I’m trying to display the avatar of the person who started the forum topic on the mainpage, in the place of the last posters name, in the latest discussions area.
I’ve tried using the way it displays in profiles
<?php if ( $avatar = bb_get_avatar( $member->ID ) ) : ?>
<div id=”useravatar”><?php echo $avatar; ?></div>
<?php unset($avatar); endif; ?>
It does not work. I’ve tried pulling it like in a post
<?php post_author_avatar_link(); ?>
Nothing. One more
<?php
if (function_exists(‘bb_get_photo’))
bb_get_photo($user->ID);
?>
No joy there either. I tried using this function
<img src=”<?php echo USERPHOTO_URL . $profileuser->userphoto_image_file . “?” . rand() ?>” alt=”<?php _e(“Full size image”, ‘user-photo’); ?>” />
and it almost does it…
http://localhost.wordpress.com/wp-content/uploads/userphoto/?29089
but as you can see it does not grab the users avatar, (1.jpg) although it’s pointing to the right place.
has anyone ever gotten avatars showing on the mainpage with the user photo plugin? I am aware other plugins exist for avatars but they do not suit my needs, apart from this one hickup, user photo is the best for wordpress/bbpress shared avatars. The guy who made it has long since left
Maybe I wasn’t clear – basically I have a script that I wrote myself that I have put in header.php so that it gets loaded on every page. However, this script needs the jquery script to load as well or it won’t work. BBPress has jquery built-in but it only loads it on certain pages. I wanted to see what defines where the jquery script that is built into BBpress is called…
But I can use this technique to do the same thing, just the opposite way around, so thanks for the help! I did it like this:
<?php if ( in_array( bb_get_location(), array( 'login-page', 'register-page' ) ) ) echo "<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'></script>n"; ?>
I tried to use bb_enqueue_script( 'jquery' ); in there but couldn’t get that to work!