Search Results for 'code'
-
AuthorSearch Results
-
August 7, 2017 at 5:04 pm #186077
In reply to: bbp-forum-index issues
lhexy
Participantafter add the code,
function bbp_increase-forum-per-page( $args = array() ) {
$args[‘posts_per_page’] = get_option( ‘_bbp_forums_per_page’, 100 );
return $args;
}
add_filter( ‘bbp_before_has_forums_parse_args’, ‘bbp_increase-forum-per-page’ );I got an error
/clickandbuilds/…/wp-content/themes/…./functions.php on line 207
As a result, I cannot open any page. Please help.
August 6, 2017 at 8:20 pm #186062Topic: Removing the plugin trashed my website (HELP!)
in forum TroubleshootingSimonScott
ParticipantI was removing the BBPRESS plugin from my wordpress install, following these instructions:
But after I deleted, the screen locked up, and now my website will not load.
Please try http://www.kambocleanse.com
Can anybody help me – can pay $$$ to get my site back up.
Thanks
Simon
inbox@simon-scott.comAugust 6, 2017 at 3:27 am #186060In reply to: Cant access forum
Robin W
ModeratorSuspect you are using php 7.1
so 3 fixes
1. downgrade to a lesser version of php
2. upgrade to bbpress 2.6rc3
3. in bbpress 2.5.13 in includes/forums/functions.php
change line 1851 from
$meta_query = $posts_query->get( ‘meta_query’ );
to
$meta_query = $posts_query->get( ‘meta_query’, array() );
and change line 1796 from$post_stati = $posts_query->get( 'post_status' );to
$post_stati = $posts_query->get( ‘post_status’ ); if (!is_array($post_stati)){ $post_stati = array($post_stati); }August 5, 2017 at 12:49 pm #186056In reply to: Shortcode to add “Edit Profile” link
michent1
ParticipantI ended up having to dig this snippet backup for a new project and made some tweaks.
@struth Updated to only output if user is logged in.
/** * Generate BBpress Edit Profile Link in a shortcode * * @param $atts, text|class * @example [bbp_edit_profile text="Edit My Profile" class"my-link-style"] * @return string|void * */ function bbp_edit_profile_link( $atts ) { //If user isn't logged in, return nothing if(!is_user_logged_in()) { return; } else { extract( shortcode_atts( array( 'text' => "", // default value if none supplied 'class' => "" //Style class for link ), $atts ) ); if ( $text ) { $current_user = wp_get_current_user(); $user = $current_user->user_login; return '<a class="' . $class . '" href="/forums/users/' . $user . '/edit">' . $text . '</a>'; } } } add_shortcode( 'bbp_edit_profile', 'bbp_edit_profile_link' );August 4, 2017 at 5:51 pm #186053In reply to: Remove Settings Capability for Editors
Robin W
Moderatorkicked it round some more, and got to this as a better answer
add_filter( 'bbp_get_caps_for_role', 'rew_moderator', 10, 2); function rew_moderator ($caps, $role) { if ($role == bbp_get_moderator_role() ) { $caps['edit_others_forums'] = true ; $caps['delete_forums'] = true ; $caps['delete_others_forums'] = true ; } return $caps ; } add_filter ('bbp_map_forum_meta_caps', 'rew_mod', 10,4) ; function rew_mod ( $caps, $cap, $user_id, $args) { switch ( $cap ) { case 'bbp_forums_admin' : if ( user_can( $user_id, 'moderate' ) ) { $caps = array( 'moderate' ); } case 'edit_forums' : case 'edit_others_forums' : if ( user_can( $user_id, 'moderate' ) ) { $caps = array( 'moderate' ); } } return $caps ; }August 3, 2017 at 7:14 pm #186039In reply to: Remove Settings Capability for Editors
Robin W
Moderatorok, I’ve been kicking this around for the last 3 hours!!
Capabilities are spread all over the files in bbpress, so it’s taken a while to get to something.
But I’ve learnt some good stuff along the way !!
This is close to a perfect solution, and seems workable
add_filter ('bbp_register_forum_post_type', 'rew_change') ; function rew_change () { $rew = array( 'labels' => bbp_get_forum_post_type_labels(), 'rewrite' => bbp_get_forum_post_type_rewrite(), 'supports' => bbp_get_forum_post_type_supports(), 'description' => __( 'bbPress Forums', 'bbpress' ), 'capabilities' => bbp_get_topic_caps(), 'capability_type' => array( 'forum', 'forums' ), 'menu_position' => 555555, 'has_archive' => bbp_get_root_slug(), 'exclude_from_search' => true, 'show_in_nav_menus' => true, 'public' => true, 'show_ui' => current_user_can( 'moderate' ), 'can_export' => true, 'hierarchical' => false, 'query_var' => true, 'menu_icon' => '' ) ; return apply_filters( 'rew_change', $rew ); } add_filter( 'bbp_get_caps_for_role', 'rew_moderator', 10, 2); function rew_moderator ($caps, $role) { if ($role == bbp_get_moderator_role() ) { $caps['edit_others_forums'] = true ; $caps['delete_forums'] = true ; $caps['delete_others_forums'] = true ; $caps['publish_forums'] = true ; $caps['read_private_forums'] = true ; $caps['read_hidden_forums'] = true ; $caps['edit_forums'] = true ; } return $caps ; }The line
'capabilities' => bbp_get_topic_caps(),should say
'capabilities' => bbp_get_forum_caps(),and my 2nd filter should then make that work, but for whatever reason it doesn’t.
But as it gives the topic permissions which for a moderator are what you want for forums, it should be fine.
August 3, 2017 at 4:38 pm #186038Topic: tinyMCE has not selected tab for participants
in forum TroubleshootingJC
ParticipantHello all, I’m using WordPress 8.0 and bbPress2.5.13.
I have added this function to add the visual tab to the editor:
function enable_visual_editor( $args = array() ) { $args['tinymce'] = true; return $args; } add_filter( 'bbp_after_get_the_content_parse_args', 'enable_visual_editor' );When I signed in as admin is everything OK, the editor tab is selected by default and I can start to type. However, when I do as a participant no tabs are selected and I have to select one of them in order to start to type. This is not intuitive at all for participants that want to write a post in the forum and eventually they will leave.
Why is happening that? Can anyone give me support? Thank you in advance 🙂
August 3, 2017 at 4:07 pm #186036Robin W
Moderatortry this in the additional css of the theme
dashboard>appearance>customise>additional css
.entry-header, .entry-content, .entry-summary, .entry-meta { max-width: 604px; }and amend max width to whatever you want
August 3, 2017 at 3:55 pm #186035In reply to: Forum Root Slug & Page Name Problems
Robin W
Moderatoryou need to get bbpress to use the correct theme template
see
item 8
August 3, 2017 at 1:00 pm #186027In reply to: group forum slug
Georgio
ParticipantIf you find a solution, i take ! I need similare slug
Just a workaround:
//This function changes the text wherever it is quoted
function change_translate_text( $translated_text ) { if ( $translated_text == 'x' ) { $translated_text = 'y'; } return $translated_text; } add_filter( 'gettext', 'change_translate_text', 20 );Give it a try only if you have slugs that are not ordinary words. Unfortunately I cannot use it for forum, since everytime a user writes “forum” it will be translated.
August 3, 2017 at 12:33 pm #186025In reply to: Threaded Replies not working
mrapino
ParticipantI’d say this is an appropriate article on how to properly enqueue jQuery:
Also, if you know what script is inserting itself above jQuery, and you have control over how it is enqueued, make sure you enqueue to the footer:
wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer );Make sure your ‘$in_footer’ is TRUE:
wp_enqueue_script('script-handle', plugins_url('js/script.js' , __FILE__ ),'','1.0',true);August 3, 2017 at 12:10 pm #186023In reply to: Threaded Replies not working
mrapino
Participantdwinn,
I just checked your website, and you have an error in the console:
Uncaught ReferenceError: jQuery is not defined at (index):17jQuery not being define can have very negative effects on a website.
Hope this helps!
August 3, 2017 at 12:08 pm #186022In reply to: Threaded Replies not working
mrapino
ParticipantRobin,
As far as Release 2.6 Candidate 3, the line of code in reply.js on/near line 18 is still the same:
reply.parentNode.appendChild(respond);I changed it to:
reply.parentNode.appendChild(respond, reply);Which seemed to do the trick.
However, I am unsure what else would be affected by this change, as I am unfamiliar with the core code of this plugin.
Please submit any or all of my comments about this here. My issue is fixed, and I hope it helps others.
Cheers!
August 3, 2017 at 11:36 am #186018In reply to: Threaded Replies not working
Robin W
ModeratorI wish a plugin developer would chime in here, but that doesn’t seem likely.
I’m not sure how often they visit, but looks like you done some great stuff here.
I’ve made a note of this thread and I’ll post a trac ticket (bug report) shortly
Can you just confirm what version of bbpress you are using, and if not bbPress 2.6 Release Candidate 3, can you just check that the code is not improved in this – you’ll do this much faster than me.
August 3, 2017 at 3:53 am #186001In reply to: group forum slug
Robin W
Moderatorsilly question, but why not just change it in
Dashboard>settings>forums>etc.
and you are using a buddypress hook, not a bbpress one – bbpress is bbp_init and all your code refers to buddypress.
August 3, 2017 at 1:29 am #185998In reply to: Threaded Replies not working
mrapino
ParticipantActually, I figured out what line 18 does.
I made a change. Instead of commenting it out, I edited it to be:
reply.parentNode.insertBefore(respond, reply);I added “reply” as the second argument being called.
After I did this, the response box, where you put your comment now moves to right under the post where you click reply.
Check it out, and let me know if oyu get it working.
Cheers!
August 3, 2017 at 1:19 am #185997In reply to: Threaded Replies not working
mrapino
ParticipantHey there … I got mine working.
There is a file in the bbPress plugin folder
plugins > bbpress > templates > default > js > reply.js
On line 18, there is a line of code that is throwing a JavaScript error every time the “reply” link is clicked.
reply.parentNode.insertBefore(respond);I basically commented this line of code out, and threaded replies are working again.
I have no idea if this line is needed, but it got rid of the error, and there are no new errors to speak of.
I wish a plugin developer would chime in here, but that doesn’t seem likely.
I hope this helps you.
If anyone else reading this know what this line does, and why it was causing the error, please let us know.
August 2, 2017 at 8:08 pm #185993Topic: group forum slug
in forum TroubleshootingGeorgio
ParticipantHi,
I am trying to change the group forum slug. E.g.
from
‘mysite.com/groups/mygroup/forum’
to
‘mysite.com/groups/mygroup/discussion’I am using this code:
function gi_rename_group_slug() { global $bp; if (isset($bp->groups->current_group->slug) && $bp->groups->current_group->slug == $bp->current_item) { $bp->bp_options_nav[$bp->groups->current_group->slug]['forum']['slug'] = 'discussion'; } } add_action('bp_init', 'gi_rename_group_slug');Unfortunately, nothing happens. What is the error? Thanks in advance.
—-
WP 4.8
bbpress 2.5.12August 2, 2017 at 4:48 pm #185992In reply to: Forum category with subforum not displaying topics
Robin W
Moderatorit’s do-able but would require some code
in essence you need to hook to an action
‘bbp_template_after_topics_loop’
install bbp-style-pack
and then code to [bsp-display-topic-index show=’5′ forum =’10’] with a list of forum ID’s for each category.
I’m out of time to attempt this before my holidays, but above to remind me if you want to bump this topic in a few weeks time, I’ll see if I can fund some time to code
August 2, 2017 at 4:20 pm #185991In reply to: Adding Widgets and Sidebars to all forum pages
Robin W
ModeratorIt’s all tied up with the theme’s page code
This all gets very code oriented, hence suggestion to go to theme provider
however if you’re a bit into code try
August 2, 2017 at 3:19 pm #185989Topic: Forum category with subforum not displaying topics
in forum Troubleshootingsapstudent
ParticipantHi Team,
Here is my situation. I have bbpress installed in my site(sapstudent.com/community). I am displaying it under ‘Community’ page using following two short codes.
[bbp-forum-index]
[bbp-topic-index]Here SAP HANA, SAP Data Services & SAP BO Business Intelligence are categories, everything else are forums.
Now when I click on lets say ‘SAP HANA'(https://www.sapstudent.com/community/forum/sap-hana), it only displays forums under this category, however I would like to have recent topics below forums section as I have in ‘Community’ page.
The other issue I have is, if I use both [bbp-forum-index], [bbp-topic-index] shortcodes on my main forum page, I am getting two search boxes(one above forum list and other one above topics list). To avoid this, I have disabled ‘Allow forum wide search’.Ideally how can I disable seachbox for [bbp-topic-index] shortcode, so that I will have only one search box on my main page which is above forum list.
August 2, 2017 at 1:47 pm #185984In reply to: Adding Widgets and Sidebars to all forum pages
cobitts15
ParticipantOkay so I copied the code from my page.php and made a bbpress.php
<?php get_header(); ?> <div class="content"> <!-- Sidebar With Content Section--> <?php $ultimate_kickoff_wrapper = 'container'; $ultimate_kickoff_theme_option = get_option('ultimate_kickoff_admin_option', array()); if(isset($ultimate_kickoff_theme_option['enable-boxed-style']) && $ultimate_kickoff_theme_option['enable-boxed-style'] == 'wide-style'){ $ultimate_kickoff_wrapper = 'container-fluid'; }else{ $ultimate_kickoff_wrapper = 'container'; } if( !empty($ultimate_kickoff_content_raw) ){ echo '<div class="vc-wrapper '.esc_attr($ultimate_kickoff_wrapper).'">'; while ( have_posts() ){ the_post(); if( has_shortcode( get_the_content(), 'vc_row' ) ) { echo ultimate_kickoff_content_filter(get_the_content(), true); } } echo '</div>'; echo '<div class="pagebuilder-wrapper">'; ultimate_kickoff_show_page_builder($ultimate_kickoff_content_raw); echo '</div>'; }else{ echo '<div class="'.esc_attr($ultimate_kickoff_wrapper).'">'; $default['show-title'] = 'enable'; $default['show-content'] = 'enable'; echo ultimate_kickoff_get_default_content_item($default); echo '</div>'; } ?> </div><!-- content --> <?php get_footer(); ?>My theme options aren’t showing when I try to edit the forum.
August 2, 2017 at 12:31 pm #185981In reply to: Adding Widgets and Sidebars to all forum pages
Robin W
Moderatorok, you’ll need to be using the right template – see
item 8
August 2, 2017 at 12:19 pm #185980In reply to: Adding Widgets and Sidebars to all forum pages
cobitts15
ParticipantI tried using short code to call the forum and at first glance it works, but if you click on the test group and topics I made it goes back to full width.
Thanks for the reply
August 2, 2017 at 1:07 am #185957In reply to: Threaded Replies not working
mrapino
ParticipantHello … I opened the Chrome dev console, and hitting the reply link gives me a JavaScript error:
reply.js:18 Uncaught TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present. at Object.moveForm (reply.js:18) at HTMLAnchorElement.onclick ((index):242)Is this a known bug?
-
AuthorSearch Results