Forum Replies Created
-
In reply to: How to change notice strings
Thanks for the suggestion. The weird thing is that adding a .mo and .po file and changing strings doesn’t work for the template notices. For example, I can change the string “Subscribed Forum Topics” to say “You are subscribed to these forum topics”, but I still can’t change the notice string “Registration complete. Check your email.”
To be clear, the notice strings are the ones that appear in the yellow box, and display error/confirmation messages.
In reply to: bbpress not working after upgrade wordpress3.5Here’s a quick thing you could try. Might work, might not.
In the wp-admin sidebar, go to Settings->Permalnks. Try messing around with the different permalinks options, see if that does anything. I would recommend the Post Name option. In my site, I have this set as a custom option:
/%category%/%postname%
Maybe the update to 3.5 messed with the permalinks option.
EDIT: I guess I skipped over the first post that says permalinks are fine, but it’s worth a try for anyone else having this problem.
In reply to: Remove "Edit this" link at top of topicsYou should double-check capabilities then. From the wp-admin sidebar, go to Users->User Role Editor. Then select the Participant role and see what capabilities that role has.
In reply to: Remove Freshness Date In Forum & Topic PagesThe filter passes the anchor tag HTML and the forum_id to your callback. To do this, you’ll have to change your filter, like so:
function remove_bbpress_forum_freshness_date( $anchor, $forum_id) {
}add_filter('bbp_get_forum_freshness_link', 'remove_bbpress_forum_freshness_date', 10, 2);
So you can see that your filter callback would be passed the anchor and the forum id.
In the bbPress code, it basically just gets the link for the forum, gets the title for the forum, gets the last active time for the forum, and constructs an anchor tag from all this information.
In your filter callback, you can do like is done in the bbPress code:
$forum_id = bbp_get_forum_id( $forum_id );
$active_id = bbp_get_forum_last_active_id( $forum_id );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 ) ) {
$link_url = bbp_get_forum_last_topic_permalink( $forum_id );
} elseif ( bbp_is_reply( $active_id ) ) {
$link_url = bbp_get_forum_last_reply_url( $forum_id );
}
As you can see, this code gets the ID of the last active item in the forum, be it topic or reply. It checks to see if the last active item was a topic or reply, and gets the appropriate url using the appropriate function.
With the url, you can then construct an anchor tag, and the link would say “View Post” (or “View Topic” if you want to get specific). Then you would return that from the filter callback.
For topics, it’s much easier since the last active will only be replies. The way you set up the filter and callback will be the same, just replacing forum with topic. To get the url, for View Post, do this:
$link_url = bbp_get_topic_last_reply_url( $topic_id );
In the code, it checks this to see if there have been any replies:
$time_since = bbp_get_topic_last_active_time( $topic_id );
if ( empty( $time_since ) ) {
// there are no replies, you can return "No Replies"
} else {
// make anchor tag linking to "View Post"
}I hope this clears things up a bit for you to try it yourself.
In reply to: Forum permalinks adding a "-2" at the endI see. Thanks for clearing that up.
In reply to: Forum permalinks adding a "-2" at the endThere’s no workaround to make it do hierarchical collision detection?
In reply to: Remove Freshness Date In Forum & Topic PagesCan you get more specific with your CSS? By that, I mean just targeting the date instead of the whole freshness block. For example, I see on my bbPress installation that the date in the forum freshness is in a child div of li.bbp-forum-freshness, which in CSS would be div.forums-topic-datetime.
If you are more comfortable with PHP and WordPress development the forum and topic freshness links do have filters:
bbp_get_forum_freshness_link
bbp_get_topic_freshness_linkBoth filters pass the link html and the forum/topic id to your callback function. You could then hook to these filters, and simply have your filter callback return an empty string.
In reply to: New Forum Meta dataAre you adding forum templates to your theme? If you are, take out the lines that output author metadata. If not, then you can use forum templates in your theme and not output author metadata.
In reply to: Templates and WP widgetYou are not using a unique page template yet?
What bbPress does is that it looks for certain template files in the theme’s directory. If it finds them, it uses them. If it doesn’t find them, then it uses default fallbacks. The template file for the forum front page is “forums.php”. You could add this file to your theme and have it not include a sidebar. When you install the bbPress plugin, it has twentyten-compatible template files that would be a good starting point to look at.
It will not override your front page. It will add new pages. When you install it, you can check the Forum Settings page to see the slugs for the pages it will add, and change them as necessary.
After some more digging around, I found that this only happens because is_404() returns true. As a workaround, I added this line before outputting headers:
$wp_query->is_404 = false;
I’d still like to know why it is setting is_404() as true.
add_filter('bbp_user_register_redirect_to', 'my_custom_redirect_function');
function my_custom_redirect_function($redirect_url) {
$forums_url = bbp_get_forums_url();
return $forums_url;
}
A filter is basically what it sounds: it passes the callback function a parameter, then you filter that parameter. Often, you do processing on the parameter and then return it, but in the code I posted, I’m ignoring the URL sent to the filter callback and returning the forums url.There’s a couple of filters that could be useful for you:
bbp_user_register_redirect_to
bbp_user_lost_password_redirect_toThese pass a URL to the filter callback that is where bbPress will redirect users after they register or use the lost password form. You simply return whatever URL you want it to redirect users to instead and that URL will be where users are taken. In my case, I send them back to the forum home using bbp_get_forums_url().
For editing their profile, the templates provided in the bbPress plugin directory can help. Look in bbp-themes/ or bbp-theme-compat/extras/ for single-user-edit.