For those saying they have the same thing, please can you be more specific to help identify the problem?
So versions and theme being used plus the steps you take to produce the error (imagine you’re talking someone on the phone through how to get the same problem you did so they can see it too, imagine they’re not good at this stuff so you have to be really obvious about everything).
Also, are you using bbpress shortcodes in a page to display your forums or not?
You absolute STAR!!!! Just using bbp_get_user_id( 0, true, false ) worked perfectly as in echo '<a href="'.$link.'?pmaction=newmessage&to='.bbp_get_user_id( 0, true, false ).'">
Thanks x 1000
It is caused by a CSS problem.
.reply a {
display: inline-block;
position: absolute;
right: 0;
bottom: -2px;
height: 20px;
padding: 6px 10px 2px;
font-family: 'BebasNeueRegular',sans-serif;
font-size: 14px;
font-size: .875rem;
font-style: normal;
border-bottom: 2px solid rgba(0,0,0,0.1);
}
When I turn off position: absolute; the name appears.
Another guess… bbp_get_user_id( 0, true, false )
Which translates as:
bbp_get_user_id ([int $user_id = 0], [bool $displayed_user_fallback = true], [bool $current_user_fallback = false])
This is a complete guess based on the way it’s done for a reply which is this:
<a href="'.$link.'?pmaction=newmessage&to='.get_the_author_meta("ID").'"><span class="pm">Send for author a PM</span></a>
So I’m thinking get_user_meta("ID") maybe?
Hi,
Anyone know how to call the profile from the bbpress user profile to a custom page template? Tried a few pieces of code and searched this site but having no luck! Would appreciate any advice…
Hi,
I’m trying to integrate the Cartpauj PM plugin with my new install of bbPress.
I want to add a private message link to member’s profile page, so when they click the link it pre-poluates the ‘To’ field in the message.
I’m using…
<?php if($page = get_page_by_title('title of the page for messages'))
{
$link = get_permalink($page->ID);
echo '<a href="'.$link.'?pmaction=newmessage&to='xx'">
<span class="pm">Message
</a></span></a>';
} ?>
But I’m stuck at what ‘xx’ should be.
If I use .$user_ID.
echo '<a href="'.$link.'?pmaction=newmessage&to='.$user_ID.'">
It pre-popluates my user name correctly. Anyone help with what I need to use to pull in the ID of the profile the message link is attached to? I’ve tried '.bbp_displayed_user_field( 'ID' ).' – that pulls the correct ID number but places it outside of the clickable link
Anyone steer me in the right direction?
Thanks in advance
Yeah anyone with an update for the code? It’s not working on my theme either.
You have <?php bbp_forum_permalink(); ?> in your code, which I guess should be <?php bbp_last_topic_permalink(); ?> if you want to link to the topic.
Yes, you are correct, unfortunately there’s no easy way to do get hidden at the moment. However, I’ve just tried manually reverting the changes from 2.4 that are causing the problem and it looks like that works.
All I’ve done is revert the 3 changes here: https://bbpress.trac.wordpress.org/changeset/5060/trunk/includes/forums/functions.php
I’ve done it fast and dirty by editing core and replacing the new lines with the old ones which you really shouldn’t do if you can avoid it as it will be overwritten next update….but hopefully next udpate will fix the problem anyway. I can’t see it causing problems anywhere else and that code was only changed for best practice I think so should be OK.
I’ve done it using a filter in my functions.php but I’d be interested to know why the above method doesn’t work if anyone can explain please.
My code in case anyone needs it:
function add_clearfix( $classes ) {
$classes[] = 'clearfix';
return $classes;
}
add_filter( 'bbp_get_forum_class', 'add_clearfix' );
bbPress 2.4
WP 3.6.1
running on localhost
I need to add a class to bb_forum_class and since 2.1 I thought that this should work:
<?php bbp_forum_class('clearfix'); ?>
But it’s not adding the class, can anyone tell me what I’m doing wrong please?
I think the relevant bit of core for this is:
function bbp_get_forum_class( $forum_id = 0, $classes = array() ) {
$bbp = bbpress();
$forum_id = bbp_get_forum_id( $forum_id );
$count = isset( $bbp->forum_query->current_post ) ? $bbp->forum_query->current_post : 1;
$classes = (array) $classes;
// Get some classes
$classes[] = 'loop-item-' . $count;
$classes[] = ( (int) $count % 2 ) ? 'even' : 'odd';
$classes[] = bbp_is_forum_category( $forum_id ) ? 'status-category' : '';
$classes[] = bbp_get_forum_subforum_count( $forum_id ) ? 'bbp-has-subforums' : '';
$classes[] = bbp_get_forum_parent_id( $forum_id ) ? 'bbp-parent-forum-' . bbp_get_forum_parent_id( $forum_id ) : '';
$classes[] = 'bbp-forum-status-' . bbp_get_forum_status( $forum_id );
$classes[] = 'bbp-forum-visibility-' . bbp_get_forum_visibility( $forum_id );
// Ditch the empties
$classes = array_filter( $classes );
$classes = get_post_class( $classes, $forum_id );
// Filter the results
$classes = apply_filters( 'bbp_get_forum_class', $classes, $forum_id );
$retval = 'class="' . implode( ' ', $classes ) . '"';
return $retval;
}
As you said, expert can make the “shortcode” to override the password….
do you know the trick!
There is not an easy way to do this, as far as I know.
You could create a private WordPress page/post that is password protected and use a bbpress shortcode to display the forum on that page but anyone who has the direct link to that forum could skip the password.
Hey, I modified it a little to fit the needs of my forum…
I can’t show you the link as I’m working on localhost at the moment, but here is what I did.
Inside loop-single-forum.php, I removed this:
<?php do_action( 'bbp_theme_before_forum_freshness_link' ); ?>
<?php bbp_forum_freshness_link(); ?>
<?php do_action( 'bbp_theme_after_forum_freshness_link' ); ?>
And placed this in it’s place:
<a class="bbp-forum-freshness" href="<?php bbp_forum_permalink(); ?>">
<?php bbp_forum_last_topic_title(); ?></a>
(<?php bbp_forum_last_active_time(); ?>) by <span class="bbp-topic-freshness-author"><?php bbp_author_link( array( 'post_id' => bbp_get_forum_last_active_id(), 'size' => 14 ) ); ?></span>
Now the last step I need help with is…
Right now if a forum doesn’t have posts in it yet, it shows the time I created the forum. Which is very weird. So what I i need is a php if/else code that would check if there is a forum_last_topic if there is, it must show my code… if there isn’t, it must show the text “No topics yet”. How do I do this? I have very basic php knowledge
In strange, because i use this with no problems, are you sure u have add the code after freshenss in forum loop?? I have opened a new thread here because this metod of Freshness in forum do not work fine, it id discordant from topic Freshness..
Please write here a link of your forum…
Awesome! Thank you… One more question though.
After using your code, if there has been no posts made in a forum, it shows a random time (which seems to be the time I created the forum) and the topic title appears blank. How can I do this:
if the forum has posts, show the latest post title and time (the code you gave me), otherwise show “No topics posted yet”.
Hi, this is my solution:
<div class="bbp-forum-last-topic-name"><a href="<?php bbp_forum_last_topic_permalink(); ?>" title="<?php bbp_forum_last_topic_title(); ?>"><?php bbp_forum_last_topic_title(); ?></a></div>
Create a class in your bbpress css named bbp-forum-last-topic-name and give your personal style…
Put all code into <li class="bbp-forum-freshness"> </li>
Hello, I am new to wordpress. I’ve ran into issues as I’ve been building a site most have been fixed after 4-20min of searching and troubleshooting. But I have been searching for this one for about 3 hours by now and I have no clue what the issue is.
Basically registration to my site/forum doesn’t work. I put the right short codes for registration and password recovery. Once I click register it takes me to the page. I put in a user name, email, and click ”register”. Then I get taken to the sites WordPress login. No email sent, nothing. My site is koolhow.com. If anyone can help me out I would greatly appreciate it. It’s been driving me insane. :\
They are all in wp_posts just like topic & reply, forum is the post_type in wp_posts
Modify your query that you linked in your original post:
$query=”SELECT * FROM wp_posts WHERE post_type = 'forum' OR post_type = 'topic' OR post_type = 'reply' ORDER BY post_date DESC”;
As per https://bbpress.trac.wordpress.org/ticket/2298
Works for me. Likely related to incorrect database encoding. Are you/they able to use these characters in regular WordPress posts and/or pages?
So if you change the URL’s back to post name do these pages work correctly?
eg. http://ccnb.co.kr/?page_id=27 becomes http://ccnb.co.kr/오시는길
Just set your forums to ‘private’
https://codex.bbpress.org/getting-started-with-bbpress/#creating-your-first-forum
Visibility: decide whether your forum is public, private or hidden.
Public – Anyone can see these forums
Private – Only logged in registered users can see these forums
Hidden: Only Moderators/Admins can see these forums
I have this issue on my theme “The current user is being initialized without using $wp->init()”, what I have seen on my theme, I was reading on google, but most of the post sais “disable debug mode”, well as a coder I know it is just for hide the error but is not a solution
I hop you could give me a hand on how to solve that
The tracer error is
# Time Memory Function Location
1 0.0503 151124 {main}( ) ../index.php:0
2 0.0940 185304 require_once( ‘…./wp-admin/admin.php’ ) ../index.php:10
3 0.1142 194292 require_once( ‘…./wp-load.php’ ) ../admin.php:30
4 0.1364 202428 require_once( ‘…./wp-config.php’ ) ../wp-load.php:34
5 0.2221 247748 require_once( ‘…./wp-settings.php’ ) ../wp-config.php:44
6 10.5487 37383376include( ‘…./wp-content/themes/laredchina/functions.php’ ) ../wp-settings.php:293
7 11.1273 38559980 current_user_can( ) ../functions.php:452
8 11.1273 38560008 wp_get_current_user( ) ../capabilities.php:1281
9 11.1273 38560096 get_currentuserinfo( ) ../pluggable.php:54
10 11.1274 38560484 wp_set_current_user( ) ../pluggable.php:102
11 11.1276 38561280 do_action( ) ../pluggable.php:37
12 11.1355 38566692 call_user_func_array ( ) ../plugin.php:406
13 11.1355 38566708 bbp_setup_current_user( ) ../plugin.php:406
14 11.1356 38566816 _doing_it_wrong( ) ../sub-actions.php:147
15 11.1363 38568004 trigger_error ( ) ../functions.php:3041
Uppercase is probably caused by CSS somewhere in your theme, look for
text-transform:uppercase;
and change it to
text-transform: none;
To hide the [0,0] I think you need to write a function to modify bbp_list_forums but check what classes are around it and maybe you can hide it with CSS.
Just replying to myself on here, given the lack of interaction, with the solution to this.
Place the following code in your theme’s functions.php – this will allow mapping of a particular WLM membership level to the bbPress Participant level:
function map_bbpress_user_role(){
//get the user class
$cu = wp_get_current_user();
$cu_roles = $cu->roles; //get the user roles
if(in_array("administrator", $cu_roles)) return; //disregard if admin
$isplatinumplus = in_array("platinumplus", $cu_roles); //check if it has platinumplus role
$isblocked = array_search(bbp_get_blocked_role(),$cu_roles); //check if it has bbp_blocked role
if($isplatinumplus){ //if it has platinumplus role
$cu->add_role(bbp_get_participant_role()); //add aparticipant role
if($isblocked !== false){ //if it has bbp_blocked role
$cu->remove_role(bbp_get_blocked_role()); //remove it
}
}elseif($isblocked === false){ //if he is not platinumplus and dont have bbp_blocked
/*
* This part makes sure that only platinumplus roles have access to the forum
*/
$cu->add_role(bbp_get_blocked_role()); //add bbp_blocked
}
}
add_action('init','map_bbpress_user_role');
I used the Members plugin to create a platinumplus user role that then mapped to the WLM level of the same name, and the above code then mapped that role to the appropriate bbPress one. Obvs, any instances of ‘platinumplus’ have to be amended to the role you are intending to map.