I tried sending a post using a non-admin user, with the TEXT editor and thus 3 hrefobjects and it still simply went through the system. Just thought I mention.
Step by step guide to setting up a bbPress forum – Part 1
item 3 method 2 and you can put introductory text before the shortcode
I tried the code above and I get all the buttons.
But it is missing the Insert Image button.
Thanks for this plugin. Sorry if this is a dumb question – but suppose I add this as a a plugin, how do I actually use it to present data on a page? A shortcode?
I’m having the same issue with bbPress email notifications coming through as HTML code. I’m using the BuddyBoss theme and platform and have reached out to their support for help, but haven’t found a solution yet.
@avaiya Did you ever find a solution to this? If so, what was it?
untested, but this might do it
add_filter( 'bbp_get_reply_author_display_name' , 'rew_reply_change_to_login', 10 , 2 ) ;
function rew_reply_change_to_login ($author_name, $reply_id) {
// Get the author ID
$author_id = bbp_get_reply_author_id( $reply_id );
$author_name = get_the_author_meta( 'user_login', $author_id );
return $author_name ;
}
add_filter( 'bbp_get_topic_author_display_name' , 'rew_topic_change_to_login', 10 , 2 ) ;
function rew_topic_change_to_login ($author_name, $topic_id) {
// Get the author ID
$author_id = bbp_get_topic_author_id( $topic_id );
$author_name = get_the_author_meta( 'user_login', $author_id );
return $author_name ;
}
let me know
Ok yes, starting with I’m completely new to this and I need to redesign my Father in laws, forum website. This would be my first time doing this and he said that there is no hurry as he heard from my wife that I know how to code but the thing is I’m only at the basics of C# so not sure if any use here but on to the point.
So he is not able to connect to the old website host site because I dont think it really exists anymore and/or was transferred to another host service. But he has a backup from the old database that used phpBB and he is not really willing to part with everything that was stored in that forum as it contains over 10 years of garthered info on the matter which is central to the forum. So I don’t feel that copying every post would be really a good way as there are around 200k posts on it.
So I have a wordpress site setup with BBpress and have the basics and the serviceprovider has the database on phpmyadmin. I’m looking to use the backup to somehow have the posts etc showup without messing with the actual site but im ok even if it wipes the new design.
I have tried using bbPress import tool but to no avail. I have not found any info considering this. So the old site is still active but I have no access to the old database but I have the old backup. The import tool did not make much sense to me but I tried.For example I am not sure do I use the root name when typing in the database name in the import tool so I have tried to look for a deeper explanation.Also I dont know how the old posts would show up in bbPress.
I dug into this a bit further
The moderation in bbpress is looking for ‘<href…’ so if you just post links ie
you post this
https://bbpress.org/forums/topic/posts-with-3-or-more-links/
not this
<a href="https://bbpress.org/forums/topic/posts-with-3-or-more-links/">some link</a>
then no check is done – it is looking for links not urls
There is some capability in the code via
$reply_content = apply_filters( 'bbp_new_reply_pre_content', $reply_content );
to take out more than 2 links, but there is not an easy way to put 3 urls into moderation
untested but try
if ( current_user_can( 'subscriber' ) ) {
add_action('wp_before_admin_bar_render', 'rew_admin_bar_remove_wp_profile', 0);
add_action('admin_bar_menu', 'rew_add_bbp_profile', 999);
}
function rew_admin_bar_remove_wp_profile() {
global $wp_admin_bar;
/* **edit-profile is the ID** */
$wp_admin_bar->remove_menu('edit-profile');
}
function rew_add_bbp_profile($wp_admin_bar) {
$current_user = wp_get_current_user();
$user=$current_user->user_nicename ;
$user_slug = get_option( '_bbp_user_slug' ) ;
if (get_option( '_bbp_include_root' ) == true ) {
$forum_slug = get_option( '_bbp_root_slug' ) ;
$slug = $forum_slug.'/'.$user_slug.'/' ;
}
else {
$slug=$user_slug . '/' ;
}
$profilelink = '/' .$slug. $user . '/edit' ;
$wp_admin_bar->add_node( array(
'parent' => 'user-actions',
'id' => 'bbp-edit-profile',
'title' => 'Edit Profile',
'href' => $profilelink,
) );
}
Thank you so so so much! This code is working great. Just one last thing. How can I make this code run only when the user role is Subscriber? -Hiro
This works:
// Redirect Registration Page
function my_registration_page_redirect()
{
global $pagenow;
// Standard Registration Redirect
if ( (strtolower($pagenow) == 'wp-login.php') && (strtolower($_GET['action']) == 'register') ) {
wp_redirect( home_url('/register/') );
}
// Redirection after successful registration
if ( (strtolower($pagenow) == 'wp-login.php') && (strtolower($_GET['checkemail']) == 'registered') ) {
wp_redirect( home_url('/registration-complete/') );
}
}
add_filter( 'init', 'my_registration_page_redirect' );
It was suggested:
https://codex.wordpress.org/Plugin_API/Filter_Reference/registration_redirect
But I tried:
add_filter( ‘registration_redirect’, ‘my_redirect_home’ );
function my_redirect_home( $registration_redirect ) {
return ‘https://www.publictalksoftware.co.uk/registration-complete’;
}
I used the “Snippets” plugin and it did not seem to work.
This code will change the WordPress profile to bbpress profile
add_action('wp_before_admin_bar_render', 'rew_admin_bar_remove_wp_profile', 0);
function rew_admin_bar_remove_wp_profile() {
global $wp_admin_bar;
/* **edit-profile is the ID** */
$wp_admin_bar->remove_menu('edit-profile');
}
add_action('admin_bar_menu', 'rew_add_bbp_profile', 999);
function rew_add_bbp_profile($wp_admin_bar) {
$current_user = wp_get_current_user();
$user=$current_user->user_nicename ;
$user_slug = get_option( '_bbp_user_slug' ) ;
if (get_option( '_bbp_include_root' ) == true ) {
$forum_slug = get_option( '_bbp_root_slug' ) ;
$slug = $forum_slug.'/'.$user_slug.'/' ;
}
else {
$slug=$user_slug . '/' ;
}
$profilelink = '/' .$slug. $user . '/edit' ;
$wp_admin_bar->add_node( array(
'parent' => 'user-actions',
'id' => 'bbp-edit-profile',
'title' => 'Edit Profile',
'href' => $profilelink,
) );
}
Put this in your child theme’s function file – or use
Code Snippets
Hi Robin,
Using your prompt I hacked something that removes the action altogether and just uses the if statement. On the loop-single-forum.php file I started with this:
<?php $forum_id = bbp_get_forum_id();
if (( $forum_id == 40250) ){
?>
<li class="bbp-forum-info-40250">
<?php
}
else {?>
<li class="bbp-forum-info">
<?php
}?>
where I set the CSS selector ‘bbp-forum-info-40250’ width to 100%. At the end of the template I then added this:
<?php $forum_id = bbp_get_forum_id();
if (( $forum_id == 40250) ){
?>
<?php
}
else {?>
<li class="bbp-forum-topic-count"><?php bbp_forum_topic_count(); ?></li>
rest of the normal template follows
</li>
<?php
}?>
where nothing appears for forum id 40250 and the rest of the template displays as normal for all other forums. So now my first forum description is 100% width without topic counts/views/freshness, whilst the rest of the forums display as normal.
If interested you can see the result here.
agree line 2, and line 4 should be
$user_id = $user->ID ;
On the login widget it has a register button. But it has no ID, so I had no choice but to use .user-submit like this:
/* Main buttons */
#bbp_user_edit_submit,
#bbp_topic_submit,
#bbp_reply_submit, #bbp_topic_content-tmce,
#bbp_topic_content-html,
#bbp_reply_content-tmce,
#bbp_reply_content-html,
#bbp_search_submit,
.user-submit {
text-shadow: none;
font-style: normal;
background: #d35438 !important;
color: #000 !important;
text-align: center;
border-radius: 4px;
-moz-border-radius:4px;
-webkit-border-radius:4px;
border: white 1px solid;
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
}
/* Main buttons - hover */
#bbp_user_edit_submit:hover, #bbp_topic_submit:hover, #bbp_reply_submit:hover,
#bbp_topic_content-tmce:hover,
#bbp_topic_content-html:hover,
#bbp_reply_content-tmce:hover,
#bbp_reply_content-html:hover,
#bbp_search_submit:hover,
.user-submit:hover {
color: #fff !important;
-moz-box-shadow: inset 0 0 20px #000 !important;
-webkit-box-shadow: inset 0 0 20px #000 !important;
box-shadow: inset 0 0 20px #000 !important;
}
It would be nice for consistency that this button have an official ID along with any other buttons missing the ID.
Understood. I know some php and know c++ and this tool looked not too much code. But then I don’t know the mechanics of BBPress and don’t really know how to debug properly except by trial and error for php.
I might just try the tool on my staging site.
This code (untested) should subscribe all current users to forum ID 3
$list = get_users();
if (empty (get_option ('rew_done')) {
foreach ($list as $user) {
$user_id = $user=>ID ;
$forum_id = 3 ;
bbp_add_user_forum_subscription( $user_id, $forum_id ) ;
}
update_option ('rew_done' , 'done' ) ;
}
Put this in your child theme’s function file – or use
https://en-gb.wordpress.org/plugins/code-snippets/ and load a page, then remove it
bbp style pack
lets you add an ‘edit profile’ to the menu see
dashboard>settings>bbp style pack>login
and also has a shortcode that you can put into a text widget in the sidebar
[bsp-profile’ label=’Edit Profile’ edit=’y’]
see
dashboard>settings>bbp style pack>shortcodes
There are lots of discussions about this.
Pretty much all plugins are three versions of wp out of date. I don’t know which are stable to use. Since they are exposing source code I wonder if they can be updated?
Or is there a known up to date way to do this?
Welp.. I figured it out. Here is the code that I placed in my theme’s function.php file so that all avatars are rendered correctly:
function jb_get_bp_user_avatar($avatar, $id_or_email, $size, $default, $alt)
{
if (is_numeric($id_or_email)) {
$id = (int) $id_or_email;
$user = get_user_by('id', $id);
} elseif (is_object($id_or_email)) {
if (!empty($id_or_email->user_id)) {
$id = (int) $id_or_email->user_id;
$user = get_user_by('id', $id);
}
} else {
$user = get_user_by('email', $id_or_email);
}
if ($user && is_object($user)) {
$avatar = bp_core_fetch_avatar(array('item_id' => $user->ID));
}
return $avatar;
}
add_filter('get_avatar', 'jb_get_bp_user_avatar', 10000, 5);
Yeah, but in forums like phpBB, if you close a topic you are locking the topic. This is indicated to the user by a icon. I added some styling which I had gleaned from the internet:
#bbpress-forums .status-closed > li.bbp-topic-title > a.bbp-topic-permalink:before {
content: "[Locked]";
text-shadow: 1px 1px 0 #ffffff;
color: #ff0000;
margin-right: 5px;
font-size: 16pt !important;
}
This gives me a lock symbol but the look and feel of this symbol is not as nice as the paper clip which is visible for topics with attachments (using the GD Attachments plugin).
then yes the code I sent is fine and works and is enough !!
not quite sure what you are trying to achieve – where are you putting this code ?
I found a way to put it in a plugin 🙂
I Thought I would have to hook into ‘plugins_loaded’ like so:
add_action( 'plugins_loaded', 'bbpress_overwrite' );
function bbpress_overwrite() {
add_filter ('bbp_before_has_search_results_parse_args', 'rew_amend_search') ;
}
function rew_amend_search ($args) {
$args['post_type'] = bbp_get_topic_post_type() ;
return $args ;
}
But for some reason this was enough: ?
add_filter ('bbp_before_has_search_results_parse_args', 'rew_amend_search') ;
function rew_amend_search ($args) {
$args['post_type'] = bbp_get_topic_post_type() ;
return $args ;
}