Search Results for 'code'
-
AuthorSearch Results
-
May 24, 2015 at 4:05 am #162417
In reply to: My Forum isn’t displaying correctly
Robin W
ModeratorNo, do you have any idea why i can’t see topics below Forum names?
What you are seeing is the list of forums, you then click a forum to see the topics for that forum.
if you want each forum to have then topics below it, then use shortcodes within a page
[bbp-single-forum id=$forum_id]
[bbp-single-forum id=$forum_id]
[bbp-single-forum id=$forum_id]see
https://codex.bbpress.org/shortcodes/
or use the shortcodes from
https://wordpress.org/plugins/bbp-style-pack/ in a page
Also i was wondering how i can order Forums by some hierarchy?
If not using the shortcodes above, then use dashboard>forums>all forums and edit a forum. On the right hand side you’ll see ‘parent’ and ‘order’ boxes that let you build a hierarchy
May 23, 2015 at 9:18 pm #162411In reply to: Minimum Topic & Reply Length
Chad R. Schulz
ParticipantI know this is an old post. However, I’ve been screwing around with various javascript suggestions from other forums and came up with a solution that works (no problems yet discovered). I’m not exactly a code ninja, so if anyone can help to streamline the code let me know.
Just insert the following lines into a custom javascript for your theme (if you need guidance on this there’s a lot of help available all over wordpress.org and other forums).
jQuery(function($) { var forum_input = $( '#bbpress-forums textarea' ); var forum_button = $( '#bbpress-forums .submit' ); var forum_limit = 50; var forum_class = $( '<div class="forum_limit_info"><span>' + forum_limit + '</span> characters needed</div>' ).insertAfter( forum_input ); forum_button.hide(); forum_class.show(); forum_input.bind( 'keyup', function() { var forum_length = $(this).val().length; var chars_left = forum_limit - forum_length; $( '.forum_limit_info span' ).html( chars_left ); if (forum_input) ( chars_left > 0 ) ? forum_class.show() : forum_class.hide(); if (forum_button) ( chars_left > 0 ) ? forum_button.hide() : forum_button.show(); }); });Basically this function hides the submit button and displays a countdown text counter until the minimum length is reached and then the button appears and the counter disappears.
There are ways of hard-coding a minimum into php but I believe you have to edit core files and then insert these modified php files into a child theme. I couldn’t figured out how to insert a simple php function that would do what I wanted in a clean and simple way. So javascript it is.
The
forum_limitsetting can be anything you want it to be, just change it. And you can customize your topics and replies minimums separately, if needed, with separate javascript functions usingtextarea#bbp_reply_content,textarea#bbp_topic_contentinstead of#bbpress-forums textarea.For my CSS stylings I chose to put a
:beforemessage on the left and the character count on the right using these:.forum_limit_info { text-align: right; font-size: 13px; color: red; line-height: 1.2; margin: 5px 5px 0px; } .forum_limit_info:before { float: left; content: '(Minimum Length: 50)'; color: blue; }CSS Styling is theme dependent and can basically be however you want/need it to be–very flexible.
I also created a similar javascript function for my site’s commenting system. Here’s that code as well:
jQuery(function($) { var comment_input = $( '#commentform textarea' ); var comment_button = $( '#entry-comment-submit' ); var comment_limit = 25; var comment_class = $( '<div class="comment_limit_info"><span>' + comment_limit + '</span> characters needed</div>' ).insertAfter( comment_input ); comment_button.hide(); comment_class.show(); comment_input.bind( 'keyup', function() { var comment_length = $(this).val().length; var chars_left = comment_limit - comment_length; $( '.comment_limit_info span' ).html( chars_left ); if (comment_input) ( chars_left > 0 ) ? comment_class.show() : comment_class.hide(); if (comment_button) ( chars_left > 0 ) ? comment_button.hide() : comment_button.show(); }); });Good luck to all,
Chad
May 23, 2015 at 5:16 pm #162407In reply to: bbPress causes Category pages to show full posts
juggledad
Participant@robkk: Just to clarify something, the
OR function_exists('is_bbpress')was added (with some other code, to get around a bug that bbpress doesn’t seem to want to acknowledge or fix. see https://bbpress.trac.wordpress.org/ticket/2723May 23, 2015 at 4:12 pm #162406In reply to: BBPress OP background different color
Robkk
Moderatoryou can use something like this.
#bbpress-forums .bbp-body .topic-author { background: #f5f5f5; }May 23, 2015 at 3:57 pm #162404In reply to: Searching by user
Robkk
Moderatorthis has something to search by user.
its not a plugin more of a file to put in a folder called bbpress in your child theme and some PHP code snippets but i will test it out to see if it works.
May 23, 2015 at 11:06 am #162388In reply to: Can’t get small avatar picture to show on website
Robkk
Moderatorhmmm that is odd. i did not find a css issue, so it must be something else.
as a test try this to see if the avatars render correctly in the area if there is correct code.
function rkk_topic_av() { echo bbp_get_topic_author_link( array( 'size' => '48' , 'type' => 'avatar')); } add_action('bbp_theme_before_topic_title','rkk_topic_av');then give me the results then we will look over it more.
May 23, 2015 at 10:55 am #162385In reply to: Rewrite Forum Post Title?
PinkishHue
ParticipantYou should be able to control this in Yoast SEO by changing the meta title settings, or it may be something you have to do in your theme / a custom plugin.
See info here re: using Yoast and the different settings:
http://kb.yoast.com/article/146-yoast-wordpress-seo-titles-metas-template-variablesIt looks like you want to make sure the meta title is set to just use this Yoast variable:
%%title%%May 23, 2015 at 10:45 am #162382In reply to: Importing Facebook comments as replies
PinkishHue
ParticipantHmm, this sounds a bit complicated as bbpress replies are not technically ‘comments’, they are a separate post type, the same as topics, that are simply connected to their parent topic (as far as I know anyway).
The first thing I would try is to copy the code that displays comments on a regular post, and add this to the template that displays my topics. That way, if comments are attached to the topic, they will display when viewing the topic on the front end.
You want to find the template ‘content-single-topic.php’
This should be at wp-content/themes/your-theme/bbpress/
(If it’s not, read up on theming here: https://codex.bbpress.org/theme-compatibility/)
Then add this code somewhere in that file:
<?php wp_list_comments(); ?>If no comments appear when you view a topic, then I would check in my mysql database to see how the comments are being saved – perhaps they are saving to the database but without being assigned to a specific post (topic). You may need to enable comments for the ‘topic’ post type.
I hope that helps, it is a bit complicated as I said.
May 23, 2015 at 10:28 am #162380In reply to: Release: bbPress Advanced Statistics
Robkk
Moderatorthis should do it.
function rk_show_advstats() { echo do_shortcode( '[bbpas-activity]' ); } add_action( 'bbp_template_after_forums_index', 'rk_show_advstats' ); add_action( 'bbp_template_after_topics_index', 'rk_show_advstats' ); add_action( 'bbp_template_after_single_topic', 'rk_show_advstats' ); add_action( 'bbp_template_after_single_forum', 'rk_show_advstats' );add this to your plugin description or installation.section on your plugins page.
it seems it would be the most useful function for your plugin.
May 23, 2015 at 9:37 am #162375In reply to: bbPress causes Category pages to show full posts
Robkk
Moderatorok thanks for reminding me …again.
i have been losing track on these topics lately.
What i found is that this bug is because of your theme and not really bbPress. So i recommend contacting your theme developers about this especially since they want to support bbPress.
in the
bfa_post_parts.phpfile in your functions folder, under thebfa_post_bodycopyfunction you will seeOR function_exists('is_bbpress')This is what is causing your issue.
the way i figured out to fix it is to remove this and create my own bbpress.php off of the index.php file from your theme.
this is all the code i used to create the file. So you can copy and paste this into your theme into a bbpress.php file and all should work …hopefully.
I also left the widget areas there if you want them still there user theme/replace them or just remove them.
<?php list($bfa_ata, $cols, $left_col, $left_col2, $right_col, $right_col2, $bfa_ata['h_blogtitle'], $bfa_ata['h_posttitle']) = bfa_get_options(); get_header(); extract($bfa_ata); global $bfa_ata_postcount; ?> <?php /* If there are any posts: */ if (have_posts()) : /* Postcount needed for option "XX first posts full posts, rest excerpts" */ ?> <?php if ($bfa_ata['widget_center_top'] <> '') { echo bfa_parse_widget_areas($bfa_ata['widget_center_top']); } ?> <?php while (have_posts()) : the_post();?> <?php /* Post Container starts here */ if ( function_exists('post_class') ) { ?> <div <?php if ( is_page() ) { post_class('post'); } else { post_class(); } ?> id="post-<?php the_ID(); ?>"> <?php } else { ?> <div class="<?php echo ( is_page() ? 'page ' : '' ) . 'post" id="post-'; the_ID(); ?>"> <?php } ?> <?php bfa_post_headline('<div class="post-headline">','</div>'); ?> <div class="post-bodycopy clearfix"><?php the_content(); ?></div> </div><!-- / Post --> <?php endwhile; ?> <?php if ($bfa_ata['widget_center_bottom'] <> '') { echo bfa_parse_widget_areas($bfa_ata['widget_center_bottom']); } ?> <?php endif; /* END of: If there are no posts */ ?> <?php get_footer(); ?>May 22, 2015 at 1:35 pm #162366In reply to: bbpress under page/post
Robin W
Moderatoryou can have a page and then put at the bottom the shortcode
[bbp-single-topic id=$topic_id] – Display a single topic. eg. [bbp-single-topic id=4096]
May 22, 2015 at 4:19 am #162358In reply to: Forum & Thread Titles Duplicated
Robin W
ModeratorSorry, been busy with other things – thanks for the reminder.
Having taken a second look, I think boith are coming form your theme, not bbpress.
I can’t hide the first one, as it is also used by other post enturies on the site, so suggest you lose the blue one, for which you need to put the following in your style.css
see
.entry h1 { visibility: hidden !important; }You might need to check that this doesn’t affect anything else – I can’t see that it did – worse case is that you would not see a blue title, so if you have any others in the site this might affect them.
May 22, 2015 at 1:07 am #162355In reply to: Remove “You Must Be Logged In” Alert
Hunniemaid
ParticipantMake a folder in your theme folder labeled “bbpress”. You will then want to go to /wp-content/plugins/bbpress/templates/default/bbpress and copy the reply-form.php and paste it into the bbpress folder you made in your theme folder.
Open the file, scroll down towards the bottom, you will see where it says “You must be logged in”. Delete that section of code.
<div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply"> <div class="bbp-template-notice"> <p><?php is_user_logged_in() ? _e( 'You cannot reply to this topic.', 'bbpress' ) : _e( 'You must be logged in to reply to this topic.', 'bbpress' ); ?></p> </div> </div>May 21, 2015 at 4:24 pm #162350In reply to: Goal tracking in Google Analytics
usr79223992
ParticipantI figured it out.
1st way: count clicks of “submit” button://custom function function custom_trackEvent_newTopic () { echo ' <script> addListener(document.getElementById(\'bbp_topic_submit\'), \'click\', function() { ga(\'send\', \'event\', \'forum\', \'btn_click_new topic\'); }); function addListener(element, type, callback) { if (element.addEventListener) element.addEventListener(type, callback); else if (element.attachEvent) element.attachEvent(\'on\' + type, callback); } </script> '; } add_action ('bbp_theme_after_topic_form_submit_button', 'custom_trackEvent_newTopic') ;2nd way: count actual topic creation
This would be more precise, but I didn’t figure it out yet. Actually this should work:function custom_trackEvent_newTopic () { window.ga('send', 'event', 'forum', 'new topic'); } add_action ('bbp_new_topic', 'custom_trackEvent_newTopic') ;…but it doesn’t.
Fatal error: Call to undefined function ga() in /…/themes/…/functions.php on line 1594
Somehow the function can’t be referenced that way. 🙁
May 21, 2015 at 4:18 pm #162349Topic: Lost password widget defaults to (nearly) invisible?!
in forum TroubleshootingEvan100
ParticipantThis had got my head spinning. I have a new bbpress install, and have set up a login widget with a ‘Lost Password’ URI. I’ve also got a lost password page, with the [bbp-lost-pass] shortcode.
When I go direct to the page, or click on the lost password link, I can see only an empty input box, and a big ‘Reset My Password’ button. Do I have to do something else to set up the widget?
The page contents are mostly hidden in the css. The legend (which says ‘Lost Password’) is disabled (bbpress.css):
.bbp-login-form fieldset legend { display: none; }And the label for the input box is hidden in the template (form-user-lost-pass.php):
<label for="user_login" class="hide"><?php _e( 'Username or Email', 'bbpress' ); ?>: </label>So, presumably some JavaScript somewhere should magically make all this appear, but it’s not firing, or I’ve just messed up. Any ideas? Note that I also have a lost password form in Woocommerce, but disabling Woocommerce doesn’t affect this. Thanks.
May 21, 2015 at 2:20 pm #162347Topic: Remove “You Must Be Logged In” Alert
in forum Requests & Feedbackitsmeitsb
ParticipantHello,
WP 4.2.2
BB 2.5.7Looking to find where I can just remove the “You Must Be Logged In” prompts all together. I’ve already got the login/register stuff added to my sidebar, I don’t need the prompts to direct people.
These are the specific things I’m speaking of. Can I just block them somehow in the css or is there somewhere I can simply delete the code to remove them all together?
Thanks for your help.
May 21, 2015 at 6:39 am #162339In reply to: Subscribe to forum link
Evan100
ParticipantStephen – I don’t know if this has changed since your post, but this isn’t great on bbpress 2.5.6, since it also affects the text for the topic subscribe/unsubscribe. Instead of seeing
Favorite | Subscribe, you getFavorite (Subscribe). To fix this, you need to post-filter the args, and checkbefore:function sa_after_get_forum_subscribe_link_parse_args($args) { if(empty($args['before'])) { $args['before'] = ' ('; $args['after'] = ')'; } return $args; } add_filter( 'bbp_after_get_forum_subscribe_link_parse_args', 'sa_after_get_forum_subscribe_link_parse_args');May 20, 2015 at 5:57 pm #162327PinkishHue
ParticipantThanks Stephen 🙂
Will definitely keep an eye on developments. For now I have used CSS to hide all but the most recent revision, here’s the code if anyone else needs it:
.bbp-topic-revision-log li { display:none; } .bbp-topic-revision-log li:last-child { display:block; }May 20, 2015 at 4:04 pm #162324Topic: Remove – You may use these HTML tags and attributes
in forum Installationvcherednichenko
ParticipantRobkk
Moderatorit is displaying like this because bbPress thinks your forums is a blog posts because of some code that should be only for blog posts.
create a bbpress.php file
if you need any more help with this reply back
May 20, 2015 at 8:57 am #162302In reply to: Goal tracking in Google Analytics
usr79223992
ParticipantI went through the documentation of adding actions (https://codex.bbpress.org/step-by-step-guide-to-setting-up-a-bbpress-forum-part-4/) and then I looked up the places within the code for the following 3 events:
– user registration
– topic creation
– reply creation
I see, that I could add code before and after the “submit” button, but that’s not exactly what I need.
I need to add an function call for ga.js directly to the button.Example (this is the code line for the “submit new topic” button):
<button type=”submit” tabindex=”<?php bbp_tab_index(); ?>” id=”bbp_topic_submit” name=”bbp_topic_submit” class=”button submit”><?php _e( ‘Submit’, ‘bbpress’ ); ?></button>
this must become:
<button type=”submit” tabindex=”<?php bbp_tab_index(); ?>” id=”bbp_topic_submit” name=”bbp_topic_submit” class=”button submit” onClick=”_gaq.push([‘_trackEvent’, ‘Forum’, ‘New Topic’]);”><?php _e( ‘Submit’, ‘bbpress’ ); ?></button>How can I achieve this?
May 19, 2015 at 4:09 pm #162290In reply to: force revision logs
Robkk
Moderatoruse this CSS to hide the checkbox for users to turn off logging their specific topic or rpely.
label[for="bbp_log_reply_edit"], label[for="bbp_log_topic_edit"], input#bbp_log_reply_edit, input#bbp_log_topic_edit { display: none !important; }May 19, 2015 at 2:22 pm #162286In reply to: How to change the post order?
Robkk
Moderatoradd this to your child theme functions.php or install the plugin below.
function bbp_reverse_reply_order( $query = array() ) { $query['order']='DESC'; return $query; } add_fiter('bbp_has_replies_query','bbp_reverse_reply_order');May 19, 2015 at 2:12 am #162269Topic: force revision logs
in forum ShowcaseGrantAdmin
ParticipantHi this is my first post here, I know my way around editing code but not a strong coder.
I am wanting to edit bbpress so as to turn off the option for revision logs and have it as a default so all post edits must be recorded.
Can anyone please guide me in doing this?
I heave read around the forums and it seems everyone is wanting to do the opposite of this with their logs, but I need it as my wordpress/bbpress install is for official activities.
thanks
May 18, 2015 at 9:16 pm #162265Topic: How to Uninstall and remove role capabilities
in forum Troubleshootinggreenhoe
ParticipantI would like to know how to completely uninstall bbpress, I’ve looked it up and followed the instructions on many other pages and thought I had it all but under the user profiles we have at the very bottom a section called “Additional Capabilities” and next to it you can see the user role. Here is a screenshot of it

I have tried running this and it doesn’t work, I have role plugins to view all my roles and it doesn’t show me any of the bbpress roles so I’m really sure why this is still showing up
$wp_roles = new WP_Roles(); $wp_roles->remove_role("bbp_role"); $wp_roles->remove_role("bbp_blocked"); $wp_roles->remove_role("bbp_keymaster"); $wp_roles->remove_role("bbp_moderator"); $wp_roles->remove_role("bbp_participant"); $wp_roles->remove_role("bbp_spectator"); -
AuthorSearch Results