you add action is right, and I’d have this as the function (not tested!)
function forum_user_is_spectator(){
if ( is_bbpress() && is_user_logged_in() ) {
$User_ID = get_current_user_id() ;
$Spectator = (!empty(current_user_can( 'spectate' )) ? 1 : 0) ;
if ($Spectator){
wp_enqueue_script( 'spectator-js', get_template_directory_uri() . '/js/spectator.js', array(), false, true);
}
}
}
Hi there,
Due to a high number of spambot registrations, any user who registers for the forum initially gets “Spectator” rights. Once I check (usually within 12-24 hours) that they are not spam, I change them to “Participant”.
Some people get annoyed that they cannot post immediately. And I would like to create a popup banner that appears when users login for the first time but cannot post. I am capable of the JS and the CSS, but not quite the PHP.
Basically, I want to enqueue a JS file if the user is a “spectator” and is “logged in”.
Could you please advise how to complete my function (hopefully just the commented parts), which will go in the functions.php file, and what add_action
arguments should be applied if I am wrong?
function forum_user_is_spectator(){
if ( is_bbpress() && is_user_logged_in() ) {
//$User_ID = get user ID
//$Spectator = find out if User Has Spectator rights
if ($Spectator){
wp_enqueue_script( 'spectator-js', get_template_directory_uri() . '/js/spectator.js', array(), false, true);
}
}
}
add_action('wp_enqueue_scripts', 'forum_user_is_spectator');
thx in advance
Having done a little digging in the CSS that “bbp style pack” creates, I THINK I have isolated the buttons to the class of
#bbpress-forums.button{
background-color:#9e9e9e
color: 000000
}
… which is the correct grey / black that the editor buttons SHOULD be. But it seems that something after that is picking up the theme colours, and setting it to those. (Unless there is some code earlier that is !IMPORTANT! that is setting it.
Also, “bbPress” seems to have a mind of it’s own, disregarding settings made within WordPress. For example, the editor has been set up with two rows of buttons … but “bbPress” will only display the default 12 or 13 buttons in one row, (and not even those match what’s been set up elsewhere in WordPress) The same plugin that sets up two rows of buttons has an option with “Don’t use visual editor in bbPress” Guess what … “bbPress” loaded the visual editor anyway.
Another plugin states “Switch this on to use the membership profile rather than the bbPress profile” Turn that on, and … rather than link to the profile, the link shows “#” so that it simply reloads the same page. And the big profile button (beside “Create Topic”) STILL jumps to the bbPress profile !!
OK, appreciate that some of those things are bbPress not accepting the settings of the other plugins … but it gets somewhat annoying when you bat your head against a brick wall all day!
that code has been moved to content-single-topic.
Can you just recheck your settings in
dashboard>settings>forums and look at subscriptions and favorites are set – I have no reason to doubt except past experience 🙂
If so, you may need to upgrade in
dashboard>tools>forums>upgrade forums
On my post / pages, the Tiny MCE Visual Editor displays as it should, ie a row (or two) of grey and black icons, allowing user to select align right / align left / justify etc. (I mention that in case anyone thinks I’m referring to the ‘basic’ buttons as shown on this forum posting options) As such, I don’t think it’s the theme / plugins causing the problem.
However, once “bbPress” fires up, the buttons go crazy, and ‘inherit’ the CSS styles from the theme. (The vendor who created the “WP-Edit” plugin says in an article that some themes are DESIGNED so that the buttons change to the theme colours; I want to keep the default colours)
In another post, RobinW suggested the “bbpress-pack” which has done a great job getting the forum set up the way I want … but it doesn’t redress the button problem.
I am using:
Theme: dashscroll
Plugins: ARMember (membership plugin)
bbPress
WP-Edit (to change the buttons on the editor)
I THINK there is code I can place somewhere that effectively filters this settting so that it doesn’t take effect … but what I need to filter for, or the code to use I have no idea.
NB: The “Visual” and “Text” buttons also seem to be inheriting the font size / padding of theme as it is also displacing the text on said buttons.
https://atomz.pro/tec-tocc/Forums/forum/atomz-apps/product-directory/
Because of different html code (using tabs in html) the space is not the same in one widget! And the items do not vertically align correctly. See image and link


BBpress Forum
I am just a bbpress user who helps out here – I have no power to change code. I can log a defect, but I’ll only do that if I can also see an issue
Its in a test install local host install…
Will set up a demo for you tomorrow. Please change the code as line 797 in the same file. As the list elements do not align vertically.
Please change forum widget li a code at line 550 from
<a class="bbp-forum-title" href="<?php bbp_forum_permalink( $widget_query->post->ID ); ?>">
<?php bbp_forum_title( $widget_query->post->ID ); ?>
</a>
to
<a class="bbp-forum-title" href="<?php bbp_forum_permalink( $widget_query->post->ID ); ?>"><?php bbp_forum_title( $widget_query->post->ID ); ?></a>
Because it leads to unwanted spaces and tabs in the html and there is no filter to strip them out.
make it the same and consistent as widget_display_topics where li a at libe 797 is done the correct way.
When using both widgets in a same sidebar below each other the li a elements do not align in a vertical way.
Thank you
This simply allows you to create a page with some other content as well, for instance
Welcome to our forums - debate is free here, but please be kind to each other
[bbp-forum-index]
By default the forum can be reached on the forums page which is not actually a page.
However, you can also create a page with the shortcode [bbp-forum-index] .
What is the shortcose for if the forum page already exists?
Thank you
ok, so if you are happy to move them to a different forum, then contact me via
Contact me
and I’ll give you some code
Thanks, but I Just found #16 here:
Layout and functionality – Examples you can use
With this in place I can just add the backlink in the forums description then. I need to hide the breadcrumb then via CSS on the forum page and also in the page I used the forum shortcode.
Maybe in future we can build a better solution for this matter. But also my use case might be kinda special.
I think the answer is #16 in this article:
Layout and functionality – Examples you can use
So thank you! 🙂
I just noticed there is an issue with the < vs. gt;
it needs to be < in the code.
There are two “Activities” sessions, one is in the personal profile (all right in this one) and the other is in the groups profile, in the “home” menu, I really want to remove this, because it confuses people who access the groups a lot, why people they don’t go in the forum menu, they stay in the home menu and it confuses them, I just want to know, how do you remove it, because I don’t see anything on the forum helping about it or on the internet, is there a file I have to modify? any code? something?
This business of having activities (home button) in the groups, is very bad, confuses the members a lot and on the internet there is nothing saying to remove it (only from groups) I want to leave it in the personal profile
View post on imgur.com
the single Forums breadcrumps root is the forum itself, but I need go a step further behind to the page I used the shortcode
Or I would like to replace the root with this page. I would even be able to pay for a custom development here, any recommendations?
Hi which file do I need to edit which is associated with the shortcode [bbp-single-view id=’popular’]
? I would like to use this feature but I would like to customise the way it looks. I think it is the file ‘loop-topics.php’ but my changes are not showing up so not sure…
Thanks
$users= get_users () ;
if ( $users ) :
foreach ( $users as $user ) :
$user_data = get_userdata( $user->ID );
//whatever you want here
endforeach ;
endif ;
add_action ('bbp_theme_before_topic_title' ,'rew_display_forum' ) ;
function rew_display_forum () {
$topic_forum_id = bbp_get_topic_forum_id();
$forum_title = bbp_get_forum_title( $topic_forum_id);
$forum_url = bbp_get_forum_permalink( $topic_forum_id );
echo '<a class="rew-forum-name" href="'.$forum_url.'">'.$forum_title.': </a>' ;
}
hmm… that’s not easy as you rightly say the hierarchy is
content-archive-topic
loop-topics
loop-single-topic
This last one is also used by forums, so you can’t just change that.
In this last you could hook an action to ‘bbp_theme_before_topic_title’ eg put this in your child theme functions file
add_action ('bbp_theme_before_topic_title' ,'rew_display_forum' ) ;
function rew_display_forum () {
$topic_forum_id = bbp_get_topic_forum_id();
$forum_title = bbp_get_forum_title( $topic_forum_id);
echo '<div class="rew-forum-name">'.$forum_title.'</div>' ;
}
and then as the shortcode displays in a ‘page’ class and the forums in a ‘forum’ class, we can add css to hide the forum title unless we are in a page
so in your custom css area put
.rew-forum-name {
display :none ;
}
.page .rew-forum-name {
display : inline-block ;
}
that should work
Hi everyone. In this moment I am using the “last topics” box in the main page of my website:
La comunidad con el mejor contenido sobre gaming y eSports
I am using the shortcode [bbp-topic-index]
Now is all OK, the topic title appears OK etc.
But I want to implement something like this in this shortcode: Forum name: Topic title
I want the Forum name before Topic title (only in the “last topics shortcode”)
How I can do it? Maybe I need to modify the loop-topics.php file?
Thanks in advance.
Regards.
AdriĂ Calendario.
This is probably because in the bbpress plugin there is a template called content-search.php. Many themes also now have a template file called content-search.php. Since the bbPress templates don’t necessarily need to be in a bbPress folder, the bbPress plugin is choosing the template from your theme before the template that is actually in bbPress.
To fix copy content-search.php from the bbPress plugin templates and place it in a child theme in a folder called bbpress.
Functions files and child themes – explained !
So create a directory on your child theme called ‘bbpress’
ie wp-content/themes/%your-theme-name%/bbpress
where %your-theme-name% is the name of your theme
find
wp-content/plugins/bbpress/templates/default/bbpress/content-search.php
Make a copy of this file, and put in in the directory called bbpress that you created above, so you end up with
wp-content/themes/%your-theme-name%/bbpress/content-search.php
bbPress will now use this template instead of the original
$topic_url = bbp_get_topic_permalink( bbp_get_reply_topic_id( $reply_id ) );
$forum_permalink = bbp_get_forum_permalink( $forum_id );
two examples of what you might be after
I’m working on a pre-defined list option at the moment – probably about a week and I’ll release some code
Thank you for your advice.
Your code works well.
I do appreciate it every time.