Hi,
Just released the last version of bbMenu. bbMenu 1.2 has some several bug fixes and minor code improvements:
– bbMenu now uses the bb_admin_add_submenu hook
– Fixed a bug that caused bbMenu to crash on some servers (thanks box87)
– Some code cleanup and optimalisations (thanks box87)
– Some template changes. If bbMenu is deactivated, the header now adapts and wont crash
Note that bbMenu 1.2 is not compatible with bbPortal 1.2 and bbPress pre 0.8
This is also the last version I release using the prototype libary. The next version will be jQuery based and smaller in size.
You can download bbMenu 1.2 here:
http://www.bbportal.org/bb-downloads/bbmenu1.2.zip
vlp..
you said you want to show the favorites in the wordpress profile.
http://www.tasty.sk/forum/profile/username/favorites
this is the link to the bbpress profile page.
i am confused now
can you try to explain again what are you trying to do?
I change it, know there is no error, but no favorite forum shows up.
The deal is that my favorites dissaper, if I point my browser to http://www.tasty.sk/forum/profile/username/favorites, it redirects me to http://www.tasty.sk/user/username//favorites
It worked before, but probably I changed something so I thought maybe I create another favorites page
yup use it in wordpress.. if i understand you right.. you want to show it on the wordpress profile page right? the one which is
<you website.com>/wp-admin/profile.php
try changing the code to
<?php if ($topics): foreach ( $topics as $topic ) : ?>
..
..
..
..
..
<?php endforeach; endif; ?>
Figured I’d throw this out there… I made a tiny function to generate a “reply” link anywhere in the topic. I’m using it in the post meta area to let the user quickly go to the post reply box.
function geek_post_reply_link(){
global $topic;
echo '<a href="'.get_topic_link($topic->topic_id,get_page_number( $topic->topic_posts )) . "#postform".'">Reply</a>';
}
I couldn’t find anything else similar, so I thought I’d share.
So if I understand right, I should use this code as a WP plugin?
I tried that and I get an error:
Warning: Invalid argument supplied for foreach() in /home/tasty.sk/tasty.sk/www/wp-content/plugins/bbpress-favorites.php on line 30
It is shown in profile main page…it is possible to create another separate page for that?
hmmm nice, i miss a download button
(in the plugin list to download the latest files)
here is the hacked code.. this will show the favorites on profile page in the admin section of wordpress. I haven’t tested it but this is the basic idea.
please note that the wordpress must be integrated both ways before you can do this. visit this for more
add_action('show_user_profile',
'my_plugin_show_favorites');
function my_plugin_show_favorites() {
$topics = get_user_favorites( $user->ID, true );
?>
<br clear="all" />
<table width="99%" border="0"
cellspacing="2" cellpadding="3">
<tr>
<th><?php _e('Topic'); ?></th>
<th><?php _e('Posts'); ?></th>
<th><?php _e('Freshness'); ?></th>
<th><?php _e('Remove'); ?></th>
</tr>
<?php foreach ( $topics as $topic ) : ?>
<tr<?php topic_class(); ?>>
<td><a href="<?php topic_link(); ?>">
<?php topic_title(); ?></a></td>
<td class="num"><?php
topic_posts();
?></td>
<td class="num"><small><?php
topic_time();
?></small></td>
<td class="num">[<?php
user_favorites_link(
'',
array('mid'=>'x'),
$user_id
);
?>]</td>
</tr>
<?php endforeach; ?>
</table>
<div class="nav">
<?php favorites_pages(); ?>
</div>
<?php
}
Actually, it would be fairly easy to do.
All we need to do is hook into the header or footer.
My initial idea was javascript popups but those are bad because they stop all webpage loading at that point. If we hook the header we can insert a z-indexed hover div with the information.
The service would be passed a user_id, the message, and an action url. Optionally instead of a user_id, it could be the term “administrator” or “moderator” where it would alert all at that level.
The box would have a close button to ignore it and all the messages would then be accessible as a list under your profile under a new tab.
You’d have an option to be emailed anytime an alert was generated but typically you can keep that off unless you don’t visit the site often.
I was going to do this for my “report this post” plugin but I really needed the report feature right away so I got lazy and just used email.
Sounds like I have a new plugin to code next weekend.
Can you link us to it?
The login functions that logs you into bb redirect you to the forums. It may be possible to change that behaviour but I’m not immediately sure how – probably using an action or filter, possibly the action bb_user_login.
Remember that the date will be relative to worldwide visitors unless you list the timezone (which will be meaningless to people far outside the timezone).
What I do on some code is list the freshness in plain english but make the title of the element the original time.
ie.
<span class=timetitle title="<?php echo date("r",strtotime($topic->topic_time)); ?>"><?php topic_time(); ?></span>
Then when you mouse over the “3 days ago” it will show you the original time (in mysql format which can be changed). Then use CSS to make a light underline so the user knows it has some kind of function.
http://uk3.php.net/manual/en/function.date.php
Don’t have access to the code right now so not sure where in bbPress you need to edit.
Looking quickly at the code, I can’t believe this a no action hook when a post is spammed or a user is bozoed. Bad planning. So we can’t make a plugin for that directly. But we could periodically scan for both situations, or check after every post is done.
Actually what I want is more fancy, an internal popup alert system when certain actions have occurred so email isn’t even needed and is just optional. As you are browsing your site, you’d find out instantly if something like that happened and given a link to look at/take care of it. Plugin authors would be able to add to the alert queue instead of just emailing. Both mods and admin could be alerted individually based on situations.
A really neat trick would be not to have a physical template at all but pass it data. My entire template just consists of
<? bb_get_header();bb_list_plugins();bb_get_footer(); ?>
Which seems silly to have a physical file.
I guess I could try to hook it after the init and bypass the bb_load_template entirely.
I’m pretty sure you can call any file using the bb_load_template() function, so you can keep your files all neatly bundled up in your plugin directory.
There are various was you can work out where your plugin is located, and if your template file has a predictable location relative to that, it should be easy to refer to it in the bb_load_template() function.
Look for blank lines or spaces before the starting <?php and after the ending ?> as they can cause that problem.
What is the code to change the Freshness of post format to the Date – Hours – Minutes ?
Yup! Solved it… and a nice way too…
To have a custom template attached to a view, ie.
/forums/view/listplugins
function view_listplugins($view) {
if ($view=="listplugins") {bb_load_template( 'list-plugins.php'); exit();}
} add_action( 'bb_custom_view', 'view_listplugins' );
function view_listplugins_filter( $views ) {
global $views;
$views['listplugins'] = "List Plugins Used";
return $views;
} add_filter('bb_views', 'view_listplugins_filter');
Now the question is, will this work in the trunk since they completely changed how views are done…
THE ANSWER IS YES! WOOHOO!
http://bbpress.nfshost.com/forums/view/list-plugins
So we have a way to attach any custom page to bbpress.
The only catch is it will show up in the views list.
But you can filter the views list for admin/mods, etc.
I think I can make my “my-views” plugin work with the trunk with this “feature”.
s010, that’s very clever.
Unfortunately it doesn’t work.
Not certain if slugs would translate either,
ie. /action/listplugins
I think the shortest shortcut is a universal loader could be made for all future extensions, ie.
/forums/option/listplugins
where option is really option.php in the bbpress root and it just passes to the template listplugins.php
This would have to be made in the the bbpress core of course.
ooooh I just had an idea… where is the hook for bbpress’s internal 404…
er, no i guess that won’t work either…. BUT
take a look at view.php in the bbpress root
you can hook bb_custom_view
basically since there will not be any view name, it won’t do the mysql call, then after you catch it on the do_action(‘bb_custom_view you can exit() after your own custom page load.
ie. /forums/view/listplugins
Let me try to code something working…
this is what i think can be done.. very hacky and very primitive
create a plugin which filters ‘bb_template’ for template ‘front-page.php’. check for $_GET == listplugins. if so return list-plugins.php
that will load list-plugins.php is the user goes to
go to <bbinstall>/index.php?action=listplugins
here is the plugin
add_filter(‘bb_template’,’my_plugin_change_template’);
function my_plugin_change_template($template) {
return ( ‘listplugins’ == $_GET ) ? ‘list-plugins.php’ : $template;
}
kapish?
From within a plugin I wanted to attach a new template/page name within the bbpress structure but I cannot figure out how to do it?
For example:
Let’s say I want to have a custom page called “list-plugins”
http://bbpress.nfshost.com/forums/list-plugins
The only way I was able to do this was to create new file in the bbpress root like this and save it as list-plugins.php
<?
require('./bb-load.php');
$bb_db_override = false;
do_action( 'bb_index.php_pre_db', '' );
do_action( 'bb_index.php', '' );
bb_load_template( 'list-plugins.php');
?>
Then that would load list-plugins.php in my template folder.
But can’t I attach a fake template name to bbpress via it’s rewrite system without having a physical file?
That sort of thing is usually when you’re not closing divs or li and each successive one falls into the previous, but that should show up in FF and IE too. I looked for that but couldn’t see it, so I can’t help you. Maybe have a look around for Safari bugs that could cause this?
It does indeed require a deeper level of integration. You want to load bb when you load wp, so open wp’s wp-config.php and add the following line:
require_once('./bbpress/bb-load.php');
where /bbpress/ should be the subdirectory of wordpress that bb is in. If that works you should now be able to call any bb function from wp.
That got me thinking… why reinvent the wheel when I can just use the bbcode plugin.
What I did was change the current quote plugin to insert the quote with
Quote:
instead of the other syntax, as well as strip out any blockquotes from the original post that you are quoting, which eliminates the multiple levels of quoting.
So here’s my new bb_quote_message() function:
function bb_quote_message() {
global $bbdb, $topic;
$post_id = (int)$_GET['quote'];
if ($post_id) {
$row = $bbdb->get_row("SELECT * FROM $bbdb->posts WHERE post_id={$post_id} AND topic_id={$topic->topic_id} AND post_status=0");
$row->post_text = preg_replace( '(<p>|</p>)', '', $row->post_text );
$ret = preg_replace("/<blockquote>((.|[nr])*?)</blockquote>/", "",$row->post_text);
if ($row) echo htmlentities('
', ENT_COMPAT, 'UTF-8');
}
}
So far it works great… except it’s annoying that the cursor isn’t positioned at the end of the textbox… I’m gonna look for some javascript to fix that.
Just remember some people use the bbcode plugin so it would have to peacefully get along with that.