Hi everyone,
I want to remove the last post date from my bbpress forum and topic pages:
I want only this to show up:
Freshness
[AVATAR IMAGE] Username
Basically i want to get rid of the date. I tried using CSS with this code:
li.bbp-forum-freshness a,
li.bbp-topic-freshness a{
display: none;
}
But it hides both the date and the username.
So, how can i hide only the date and leave the username?
Please help.
Hi,
I have a section of my site where I list recent forum posts on the page (among other things) What I’d like to do is add another section that’s more specific, i.e. listing recent posts to a specific forum.
Is it possible to modify the code below to look in specific forums?
$args = array('post_type' => 'topic', 'posts_per_page' => 5);
$forum_topics = new WP_Query($args);
Hi,
I saw somwhere a topic about Forums, Topics and Replies somwhere in the forum and want to confirm that it exists even in just releases 2.2.3. In admin and on frontend bbpess post types labels don’t get translated (tested on 2 different sites, translated in 2 different tools, my language uses extended latin chars).
Another issue is with the User profile rules (permalinks, line 873 in bbpress.php). It’s possible to filter rewrite rules for user favorites and subscriptions but topics and replies (and it’s pagination) are hardcoded, even if there are functions available to use instead (and filter if needed)
I want to change the output of the “Code” editor button of the bbpress plugin to use my custom shortcode for posting code in the forums. How can I do this? I’m unable to find any reference to the buttons in any of the templates.
Ah in that case, I think thats great. Since the author is the primary content creator of the thread, all things considering, I think it will work well.
You should considering polishing up that code and releasing it as a bbPress plugin on the WordPress.org plugin repository 🙂 You’d have to dynamically hook into the user edit page and maybe a few other changes, but the base of the work there is probably done.
So here is how I would do it (I think) if I wanted something easy yet half way elegant.
I’d create a /login page in WordPress that has a custom page template (page-login.php) that contains some custom stuff. It still breaks the process up into two parts, which is not ideal, but its the easiest way without putting in some time to get around that.
Essentially, it would be something like this. First ask for the customer ID. They enter that in and submit it. If it’s valid then reload the page and show the bbPress login.
if ( isset( $_GET['cid'] ) && !empty( $_GET['cid'] ) ) {
// cid (customer ID) is present, show the bbPress login form
echo 'Please enter your username and password to complete the login process';
echo do_shortcode('bbp-login');
} elseif ( $_GET['error'] == true ) {
// cid entered was not valid
echo 'The customer ID you entered is not valid.';
} else {
// cid is absent so show the form to validate it
// do your custom form here that asks for the customer ID. Then if the customer ID
// is correct/valid reload this page like /login?cid=123456 which will show
// the bbPress login form.
}
Another option would be on the first form to ask for the username. Then you could take that and have it auto fill in on the login form using the WordPress login form function (wouldn’t be able to use the bbPress shortcode for this).
Jared, thanks for the feedback. The more I thought about it, about a thousand different ways to do it popped into my head as well (spun my brain into a scrambled egg). At this point, I’ve basically started to write the custom login from the ground up. I’m going to create a shortcode out of it at the end.
I just started it but so far I just have the basic connection and query going:
function restrictForum(){
$db_name = 'dbname';
$con = mysql_connect("URL","username","password*");
mysql_select_db("$db_name")or die("cannot select DB");
$cust_no = $_POST['custno'];
$sql = "SELECT * FROM customer_data WHERE customer_number = $cust_no";
echo('Customer #');
}
I previously had this small bit into a shortcode that just checked if the user was logged in then provided the bbpress login form if they weren’t:
function restrictForum(){
if(!is_user_logged_in()){
echo('You must login to access the forum');
echo do_shortcode('[bbp-login]');
}
}
add_shortcode('forum-login-restrict','restrictForum');
The thing that makes inline images tough is non-admin users cannot use the tag and shortcodes are not an option.
Currently there is an issue on trac (#1916) that would make it where img tags do not get filtered out. Once that’s done it would open the gate for plugins to handle inline images pretty easily.
That’s interesting, but not quite the approach he was asking about (from my understanding).
I think he was referring to the google rich snippets that show up if the page supports the appropriate meta (http://yoast.com/push-rel-author-head/)
You could use a good chunk of the code that is posted above (the part where it sets up a field for google+), then on topic pages get the topic user’s ID, and use that to put in the line above.
I think the only way to do what you want wil be using a completely custom login form that you pass to your own server for validation. You won’t be able to use the WordPress login form (or the function that generates it) at all.
There are about a dozen different ways you can take this based on the 5 minutes I’ve thought about it. Really just depends if you’re going for elegant, easy, or some where in between. It’s going to take custom code regardless.
Thanks guys – what ended up working was putting BOTH of those codes in the css. One or the other alone didn’t do anything. CSS is weird haha. Anyway, problem solved, looking forward to the next update!
I got it to work in firefox by adding this when I had the same problem at appglobe.com:
#bbpress-forums .bbp-user-section ul.bbp-topics {
float: left !important;
width:100% !important; /*forgot this one on my last post @mamasaywhat */
}
Try that or the code above by Jared Atcihison and it should work in firefox.
the bad tweak :
function bbp_filter_blog_editable_roles( $all_roles = array() ) {
// Loop through bbPress roles
foreach ( array_keys( bbp_get_dynamic_roles() ) as $bbp_role ) {
// Loop through WordPress roles
foreach ( array_keys( $all_roles ) as $wp_role ) {
// If keys match, unset
if ( $wp_role == $bbp_role ) {
//unset( $all_roles[$wp_role] );
}
}
}
return $all_roles;
}
bbpress/core/capabilities/
And then Moderators are back……. I’m sure i missed something but plugins like “members” don’t do the trick. And i just want basic forum moderation works now.
I will never understand why endusers have to put their hands in the mess of bbpress and hack/tweak it just to use this plugin >:( I can’t trust in your plugin every updates are hell.
Then, don’t work as a dirty pig, and update the doc when you change such important things like roles! It just a little more repectfull for end users.
It’s a Firefox problem. All other browsers should show it correctly. Will be addressed in 2.3.
Until then, this should fix it.
.bbp-user-section {
overflow: auto;
}
Oh, I see I forgot a “{” in my first code….it should be:
#bbpress-forums .bbp-user-section ul.bbp-topics {float: left !important;}
Try this at the bottom of your CSS file:
#bbpress-forums .bbp-user-section ul.bbp-topics
float: left !important;
}
The following is what I use at AppGlobe:
/* Add Google+ profile URL as profile contact method */
function appglobe_add_google_profile( $contactmethods ) {
$contactmethods['google_profile_url'] = 'Google Profile URL';
return $contactmethods;
}
add_filter( 'user_contactmethods', 'appglobe_add_google_profile', 10, 1);
/* Remove nofollow, and ad author to the profile link */
function appglobe_switch_nofollow_for_author($str) {
$str = preg_replace(
'~<a ([^>]*)\s*(["|\']{1}\w*)\s*nofollow([^>]*)>~U',
'<a ${1}${2}${3}>', $str);
return str_replace(array(' rel=""', " rel=''"), 'rel=author', $str);
}
add_filter( 'bbp_get_topic_author_link', 'appglobe_switch_nofollow_for_author' );
And then in your user-profile.php (create a bbpress folder in your theme root, and copy it over) you can add this:
<?php if( bbp_get_displayed_user_field( 'google_profile_url' ) ) : ?>
<h2 class="author-subtitle">Google Profile</h2>
<?php if( bbp_get_user_role(bbp_get_displayed_user_id()) == 'bbp_keymaster' || bbp_get_user_role(bbp_get_displayed_user_id()) == 'bbp_moderator') : ?>
<a rel="me" class="bbp-user-url" href="<?php esc_url(bbp_displayed_user_field( 'google_profile_url' )); ?>"><?php bbp_displayed_user_field( 'google_profile_url' ); ?>
</a>
<?php else : ?>
<a rel="me nofollow" class="bbp-user-url" href="<?php esc_url(bbp_displayed_user_field( 'google_profile_url')); ?>"><?php bbp_displayed_user_field( 'google_profile_url'); ?>
</a>
<?php endif; ?>
Since I beleave only the first rel=me link on a page counts there would be best to use topic lead:
add_filter( 'bbp_show_lead_topic', '__return_true' );
…by doing so each page will be considered authored by the topic creator even if its paged.
To all those smart coding guys out there, please can someone help me with the bbP functions needed to complete the code below. I think there are two bbP functions needed – see square brackets [??…]. Or maybe someone has a better way of doing it.
I’m trying to integrate BP1.6.1, the new bbP2.2.2 forums and WordPress SEO1.3.1.1 so that the WordPress SEO (meta) page titles are shown when a bbP Topic is being shown within a BP page (just like they are shown for native bbP forum pages).
I’ve hooked functions into ‘bp_modify_page_title’ before and managed to extract ‘_yoast_wpseo_title’ before. So I’m part way there I guess.
I also understand that I need to change the priority from 10 to 16 (or more) in line below (in buddypress>bp-core>bp-core-filters.php), to make bp_modify_page_title filter execute after, and hence overrule, WPSEO title which has priority 15 (in worpress-seo>frontend>class-frontend.php).
add_filter( ‘wp_title’, ‘bp_modify_page_title’, 16, 3 );
add_filter( 'bp_modify_page_title', 'new_page_title', 10, 4 );
function new_page_title( $new_page_title, $title, $sep, $seplocation ) {
global $bp, $bbp;
/** If bbP Topic is being shown within a BP page then replace title with title input via Yoast WordPress SEO plugin */
if ( [?? a bbp function that is true when bbP Topic is being shown within a BP page] && bp_is_active( 'groups' ) && !empty( $bp->groups->current_group ) ) {
[?? a bbp function that loads the bbP Topic Post ID to $topic->ID];
$new_page_title= get_post_meta( $topic->ID, _yoast_wpseo_title, true);
}
return $new_page_title;
}
If you can help please, and I can then get this to work, I’ll post the result back again so others can benefit.
Many thanks.
If you know CSS you can easily add some styles to your to style sheet. If you use the default templete, it could look like this:
.bbPress.forum .entry-title {
/*Styles to add icon image to the left of this element goes here*/
}
Well, this is the logs from the time I activated the plugins:
20121207T212805: www.conatu.net/wp-admin/admin-ajax.php
PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 77824 bytes) in /hermes/bosoraweb064/b1399/ipg.conatunet/wp-includes/class-simplepie.php on line 3743
20121207T212805: www.conatu.net/wp-admin/admin-ajax.php
PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 77824 bytes) in /hermes/bosoraweb064/b1399/ipg.conatunet/wp-includes/class-simplepie.php on line 3743
20121207T212806: www.conatu.net/wp-admin/admin-ajax.php
PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 77824 bytes) in /hermes/bosoraweb064/b1399/ipg.conatunet/wp-includes/class-simplepie.php on line 3743
20121207T213434: www.conatu.net/wp-admin/admin-ajax.php
PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 77824 bytes) in /hermes/bosoraweb064/b1399/ipg.conatunet/wp-includes/class-simplepie.php on line 3743
20121207T213434: www.conatu.net/wp-admin/admin-ajax.php
PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 77824 bytes) in /hermes/bosoraweb064/b1399/ipg.conatunet/wp-includes/class-simplepie.php on line 3529
20121207T213436: www.conatu.net/wp-admin/admin-ajax.php
PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 77824 bytes) in /hermes/bosoraweb064/b1399/ipg.conatunet/wp-includes/class-simplepie.php on line 3529
And btw, from where can I make forums?
I’m having the exact same problem. And like ffalder I can’t code, but usually Google my way out of a problem. But this time no luck.
From my research it seems lots of people are having the same problem.
I think the main issue here is the breadcrumbs.
1) You create a custom ‘forum home page’ using short codes (or whatever means you like) to be your default page that users see as the homepage of your forum.
2) A user try’s to get back to the ‘forum home page’ using the breadcrumbs by clicking the text “forums” in the breadcrumbs.
3) Unfortunately it just redirects to the forum slug chosen in Settings, not your actual ‘forum home page’. And that forum slug is always defaulted to an archives page.
4) So setting that slug to the same as your ‘forum home page’ does not work, because woprdpress overrides your ‘forum home page’ created in step 1 and defaults it to an archives page.
Sorry for re-hashing this, but it’s sometimes better to make it a little clearer. At least in my own head anyway.
I don’t know how simple this is or not, but one solution that comes to mind is to have an option in Settings that lets you decide where the ‘forums’ text link in the breadcrumbs will point to. If you can choose to have it point to your ‘forum home page’ then all would be solved right?
This person suggested changing the breadcrumbs in the core of the plugin, but obviously it’s not very desirable since it’s changes to the core. And I also cannot find the file that they edited. Think it might have been a mod to an old version: http://mysitemyway.com/support/topic/infocus-bbpress-20-root-slug
It should be possible with some custom code tweaks. Are you comfortable with a little PHP?
Since I wan’t only replies ( not created topics and replies) I’ve created a filter function:
function ag_force_replies_only( $query, $user_id ) {
if( bbp_is_single_user() ) { // Just in case
$query = bbp_has_replies( array(
‘post_type’ => array( bbp_get_reply_post_type() ),
‘post_parent’ => ‘any’,
‘posts_per_page’ => bbp_get_replies_per_page(),
‘paged’ => bbp_get_paged(),
‘orderby’ => ‘date’,
‘order’ => ‘DESC’,
‘author’ => $user_id,
‘show_stickies’ => false,
) );
}
return $query;
}
add_filter(‘bbp_get_user_replies_created’, ‘ag_force_replies_only’, 10, 2);
Now is shows replies only: http://appglobe.com/forums/users/martin/replies/
Have you followed the Import Forums guide on the Codex? If so; where did you get stuck?