Search Results for 'is_bbpress'
-
AuthorSearch Results
-
April 20, 2024 at 5:36 am #240056
In reply to: emails link to private forum after login
itsmifredParticipantyes Robin,that was a mistake. Sorry for this confusion. They both work similar.
I also tried to put forums public + snippet to redirect visitors to login.
But the result is exactly the same. After login there is no redirect to the topic.
here is the snippet if you are curious :
/** * Redirect bbPress pages for visitors */ function yzc_redirect_bbpress_to_login_page() { if ( ! is_user_logged_in() && ( function_exists( 'is_bbpress') && is_bbpress() ) ) { // Set Redirection Url $redirect_url = 'https://www.website.com/login'; wp_redirect( $redirect_url ); exit(); } } add_action( 'template_redirect', 'yzc_redirect_bbpress_to_login_page' );
Do you think possible to redirect to private topic after login ?
regards
February 24, 2023 at 5:13 pm #234453In reply to: “Create account” link on forum pages?
webcreations907ParticipantYou could use the below which should add your registration link to that form.
Add to your
functions.php
file in your theme.if(!function_exists('dnk_add_registration_link')){ function dnk_add_registration_link(){ if( function_exists('is_bbpress') && is_bbpress() ){ echo '<p>Don\'t have an account? <a href="'.esc_attr( wp_registration_url() ).'">Register</a></p>'; } } } add_action( 'login_form','dnk_add_registration_link' ,10 );
October 22, 2022 at 12:25 am #232257In reply to: Template in Block Themes?
codejp3Participant@robin-w or another mod – can you please delete:
https://bbpress.org/forums/topic/template-in-block-themes/#post-232249 (#post-232249)
https://bbpress.org/forums/topic/template-in-block-themes/#post-232250 (#post-232250)
https://bbpress.org/forums/topic/template-in-block-themes/#post-232256 (#post-232256)
They had issues and take up a lot of wasted space.Seriously done this time! No more changes/revisions! It is what it is!
Posting a much cleaner revision of the code above.
- This one will work with either the BBPress Style Pack plugin template (looks great!) or the default BBPress template (looks horrible!).
- It will optionally include the required ‘template-canvas.php’ only if it’s missing.
- It will also only affect BBPress pages, not the rest of the site.
- It will also only affect FSE Block themes.
- If using default BBPress templates, it includes checks for if on forum root index page and loads extras/archive-forum.php (to prevent double-listing of the forum index), and loads extras/page-front-forums.php for “the rest of bbpress” (to prevent “nothing found” errors)
// function to include the wp-includes/template-canvas.php file if needed function fse_bbpress_template( $template ) { if ( is_bbpress() ) { $template = ABSPATH . WPINC . '/template-canvas.php'; } return $template; } // function to include the bbpress forum template file if needed function fse_bbp_theme_compat( $template ) { if ( is_bbpress() ) { // BBPress Style Pack Plugin Forums Index Template if ( defined( 'BSP_PLUGIN_DIR' ) ) { $template = BSP_PLUGIN_DIR . '/templates/bbpress.php'; } else { // Default BBPress // if current page is bbpress forum root page, load archive-forum to prevent double-listing of index if ( isset( get_queried_object()->name ) ) { if ( get_queried_object()->name == 'forum' ) { $template = WP_CONTENT_DIR . '/plugins/bbpress/templates/default/extras/archive-forum.php'; } // else, load page-front-forums or the rest of bbpress is broken with empty pages } else { $template = WP_CONTENT_DIR . '/plugins/bbpress/templates/default/extras/page-front-forums.php'; } } } return $template; } // main function for handling which theme file needs to be included if ( ! function_exists( 'fse_bbpress_support' ) ) { function fse_bbpress_support() { // get current theme dir $theme_dir = get_template_directory(); /* * Detect if FSE theme or traditional. * FSE Block themes require a theme.json file. * Use that to check instead of theme name or parent theme name. * Perhaps a better method is available, but this works for now */ if ( file_exists( $theme_dir . '/theme.json' ) ) { // include wp-includes/template-canvas.php only if needed if ( !basename( get_page_template() ) == 'template-canvas.php' ) { add_filter( 'template_include', 'fse_bbpress_template' ); } // include either the BSP template, or default BBPress template add_filter ( 'bbp_template_include_theme_compat', 'fse_bbp_theme_compat' ); } } } add_action( 'after_setup_theme', 'fse_bbpress_support' );
One issue with EVERY default BBPress template is that the header/footer/sidebar are trying to be pulled from template files that don’t exist in block themes. They’re being included, but don’t look right. I’m not sure of the best solution for that, other than to use the BBPress Style Pack Plugin which takes care of that and looks great.
October 15, 2022 at 4:16 pm #232166In reply to: Template in Block Themes?
codejp3ParticipantUsing the clues in this topic, this is what I have working for ANY FSE Block theme with the wonderful style-pack plugin:
function fse_bbpress_template( $template ) { $template = ABSPATH . WPINC . '/template-canvas.php'; return $template; } function fse_bbp_theme_compat( $template ) { $template= BSP_PLUGIN_DIR.'/templates/bbpress.php'; return $template; } if ( ! function_exists( 'fse_bbpress_support' ) ) { function fse_bbpress_support() { // gt current theme dir $theme_dir = get_template_directory(); // Detect if FSE theme or traditional. // FSE Block themes require a theme.json file. // Use that to check instead of theme name or parent theme name. // Perhaps a better method is available, but this works for now. $fse_theme = false; if ( file_exists( $theme_dir.'/theme.json' ) ) { $fse_theme = true; } if ( !$fse_theme ) { return; } // disabled because it doesn't seem to be needed, regardless of style pack // $bsp_style_settings_theme_support['twentytwentytwo_activate'] setting // template-canvas.php seems to be included by default //add_filter( 'template_include', 'fse_bbpress_template' ); add_filter ( 'bbp_template_include_theme_compat' , 'fse_bbp_theme_compat' ); } } add_action( 'after_setup_theme', 'fse_bbpress_support' );
and this little helper function helped me figure out what template was getting loaded in the first place:
function fse_bbpress_print_template() { if ( is_bbpress() ) { //echo at the bottom of the page visibly echo get_page_template(); // or echo the template silently as an HTML comment // echo '<!-- ' . get_page_template() . ' -->'; } } // DISABLE THIS ACTION HOOK AS SOON AS POSSIBLE! DO NOT LEAVE IT ACTIVE WHEN DEBUGGING IS DONE! add_action( 'bbp_template_after_forums_loop', 'fse_bbpress_print_template' );
I’ve tried this on a few different FSE Block themes, and BBPress is displaying properly, and the style tweaks from the wonderful Style-Pack plugin are being applied.
Like I said, it’s working regardless of the $bsp_style_settings_theme_support[‘twentytwentytwo_activate’] setting within the BSP plugin, but it uses the template from the plugin so it would still need to be installed an active, even without any styling tweaks applied.
It’s not a permanent solution, but perhaps aspects of this could be applied to the BSP plugin, or your own custom solution.
July 7, 2022 at 1:41 pm #230255In reply to: @mentions for bbpress
saltywdParticipantHello Robin, Thanks for the quick reply. I have that plugin but it doesnt seem to work at all. I cant even see that it has any settings anywhere. I do have active right now, WP with Avada Theme, BBPress, bbp Style pack, bbpress notify, GD bbpress Attachments, and Ultimate Member and a few of its extensions for bbpress as it is a private forum.
on bbp style pack there is a check box to make @mentions help, but says you need buddypress or bbp-mentions-email-notifications which I have tried that plugin and it doesnt work either.
Would love to use your plugin but i cant get it to work at all.
I see on GIST there is some code for a bp-custom.php file which includes this
<?php /** You could put this in the bp-custom.php file * @see https://codex.buddypress.org/themes/bp-custom-php/ */ function custom_bbpress_maybe_load_mentions_scripts( $retval = false ) { if ( function_exists( 'bbpress' ) && is_bbpress() ) { $retval = true; } return $retval; } add_filter( 'bp_activity_maybe_load_mentions_scripts', 'custom_bbpress_maybe_load_mentions_scripts' );
February 2, 2022 at 5:50 am #227151In reply to: Trying to remove bbPress causes Critical error
ollietubb1ParticipantI think this is the problem? … don’t recall adding it but assume it is safe to remove as I am removing bbPress for now at least, what do you think?
add_filter(‘body_class’, ‘modify_body_classes’, 20);
function modify_body_classes( $classes ) {
if( is_bbpress() ) {
$remove_classes = array(‘et_right_sidebar’, ‘et_left_sidebar’, ‘et_includes_sidebar’);
foreach( $classes as $key => $value ) {
if ( in_array( $value, $remove_classes ) ) unset( $classes[$key] );
}
$classes[] = ‘et_full_width_page’;
}
return $classes;
}February 2, 2022 at 4:38 am #227149In reply to: Trying to remove bbPress causes Critical error
Robin WModeratorok, it is a function in your child theme’s function file – line 28
Call to undefined function is_bbpress() in /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-content/themes/Divi-Child-Theme/functions.php:28
So who had created that file? as either they or you will need to amend whatever that part of the file is trying to do.
February 2, 2022 at 4:31 am #227143In reply to: Trying to remove bbPress causes Critical error
ollietubb1ParticipantHi Robin,
Thanks for sticking with me here. I have error logs on the server so I tried again to disable bbpress and below is the log. I disabled and deleted Divi Mega Pro as I realised I didn’t use that in the end but it didn’t solve it.
Let me know what you think.
Thanks,
Ollie[Wed Feb 02 08:22:26.842483 2022] [proxy_fcgi:error] [pid 3110766] [client 2a00:23c6:6f4f:d001:20eb:9d22:835a:c06c:0] AH01071: Got error ‘PHP message: PHP Warning: Undefined variable $force in /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-content/plugins/divi-mega-pro/class.divi-mega-pro.admin.core.php on line 208’, referer: https://wbc1.otiscreative.co.uk/wp-admin/plugins.php
[Wed Feb 02 08:22:33.374828 2022] [proxy_fcgi:error] [pid 3109704] [client 2a00:23c6:6f4f:d001:20eb:9d22:835a:c06c:0] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught Error: Call to undefined function is_bbpress() in /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-content/themes/Divi-Child-Theme/functions.php:28\nStack trace:\n#0 /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-includes/class-wp-hook.php(309): modify_body_classes()\n#1 /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-includes/plugin.php(189): WP_Hook->apply_filters()\n#2 /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-includes/post-template.php(836): apply_filters()\n#3 /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-includes/post-template.php(595): get_body_class()\n#4 /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-content/themes/Divi/header.php(29): body_class()\n#5 /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-includes/template.php(770): require_once(‘…’)\n#6 /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-includes/template.php(716): load_template()\n#7 /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-content/themes/Divi/in…’, referer: https://wbc1.otiscreative.co.uk/wp-admin/plugins.php?plugin_status=all&paged=1&s
[Wed Feb 02 08:22:38.838643 2022] [proxy_fcgi:error] [pid 3133583] [client 2a00:23c6:6f4f:d001:20eb:9d22:835a:c06c:0] AH01071: Got error ‘PHP message: PHP Warning: Undefined variable $force in /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-content/plugins/divi-mega-pro/class.divi-mega-pro.admin.core.php on line 208’, referer: https://wbc1.otiscreative.co.uk/wp-admin/plugins.php?plugin_status=all&paged=1&s
[Wed Feb 02 08:24:39.400052 2022] [proxy_fcgi:error] [pid 3109701] [client 2a00:23c6:6f4f:d001:20eb:9d22:835a:c06c:0] AH01071: Got error ‘PHP message: PHP Warning: Undefined variable $force in /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-content/plugins/divi-mega-pro/class.divi-mega-pro.admin.core.php on line 208’, referer: https://wbc1.otiscreative.co.uk/wp-admin/plugins.php
[Wed Feb 02 08:25:12.226569 2022] [proxy_fcgi:error] [pid 3110766] [client 2a00:23c6:6f4f:d001:20eb:9d22:835a:c06c:0] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught Error: Call to undefined function is_bbpress() in /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-content/themes/Divi-Child-Theme/functions.php:28\nStack trace:\n#0 /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-includes/class-wp-hook.php(309): modify_body_classes()\n#1 /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-includes/plugin.php(189): WP_Hook->apply_filters()\n#2 /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-includes/post-template.php(836): apply_filters()\n#3 /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-includes/post-template.php(595): get_body_class()\n#4 /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-content/themes/Divi/header.php(29): body_class()\n#5 /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-includes/template.php(770): require_once(‘…’)\n#6 /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-includes/template.php(716): load_template()\n#7 /home/storm/sites/wbc1-otiscreative-co-uk/public/wp-content/themes/Divi/in…’January 23, 2022 at 5:06 am #226928Robin WModeratorThe link you showed is for version 1 of bbpress, which is no longer relevant.
changing the header is theme specific, you’d be looking at finding the header.php file in the theme, creating a child theme and then yu would use something like
is_bbpress()
in thee code to check if tis was a bbpress page
eg
if (is_bbpress()) { ?> <div id="pg-70016-0" class="panel-grid panel-has-style" data-style="{"class":"banner row","background_image_attachment":false,"background_display":"tile","row_stretch":"full-stretched-padded","cell_alignment":"flex-start"}" data-ratio="1" data-ratio-direction="right"> <div class="banner row siteorigin-panels-stretch panel-row-style panel-row-style-for-70016-0" data-stretch-type="full-stretched-padded"> <div id="pgc-70016-0-0" class="panel-grid-cell" data-weight="1"> <div id="panel-70016-0-0-0" class="so-panel widget widget_custom_html panel-first-child panel-last-child" data-index="0" data-style="{"background_image_attachment":false,"background_display":"tile"}"><div class="textwidget custom-html-widget"><img alt="Herman" height="96" width="96" data-src="https://356259.smushcdn.com/255537/wp-content/uploads/learn-press-profile/1/bd882ec1e4a6fe8b6b83e4bb85be5c26.jpg?lossy=1&strip=1&webp=1" class="avatar avatar-96wp-user-avatar wp-user-avatar-96 photo lazyloaded" src="https://356259.smushcdn.com/255537/wp-content/uploads/learn-press-profile/1/bd882ec1e4a6fe8b6b83e4bb85be5c26.jpg?lossy=1&strip=1&webp=1"><noscript><img alt="Herman" src="https://356259.smushcdn.com/255537/wp-content/uploads/learn-press-profile/1/bd882ec1e4a6fe8b6b83e4bb85be5c26.jpg?lossy=1&strip=1&webp=1" class="avatar avatar-96wp-user-avatar wp-user-avatar-96 photo" height="96" width="96" /></noscript> <div class="pmpro_logged_in_welcome_wrap"> <h3 class="pmpro_member_display_name"> Welcome, <a href="https://frenchtasticpeople.com/membership-account/">Herman</a> </h3> </div> <div class="media-12 columns"> <h1 class="page-title"> Bonjour </h1> <div class="row"> <div class="media-10 small-12 media-offset-1 columns"> <p class="text-3x text-center"> <i class="fas fa-sync-alt"></i> Update your account easily <i class="fas fa-search"></i> Browse the entire course library <i class="far fa-hand-pointer"></i> Choose any lesson you want for free <br> <i class="fas fa-download"></i> Download resources <i class="fas fa-tools"></i> Practice your French skills in the lab <i class="fas fa-user-headset"></i> Get premium support </p> <div class="dashboard-quick-links"> Quick Nav Links: <ul class="button-link-list"> <li class="quick-nav-item nav-item-1"> <a href="https://frenchtasticpeople.com/courses/" title="French courses that makes it easy for you to practice your French anytime, from anywhere and at a very affordable cost.">Course Library</a></li> <li class="quick-nav-item nav-item-2"> <a href="https://frenchtasticpeople.com/user-profile/" title="French courses that makes it easy for you to practice your French anytime, from anywhere and at a very affordable cost.">Enrolled Courses</a></li> <li class="quick-nav-item nav-item-3"> <a href="https://frenchtasticpeople.com/files/" title="French courses that makes it easy for you to practice your French anytime, from anywhere and at a very affordable cost.">Work Files</a></li> <li class="quick-nav-item nav-item-4"> <a href="https://frenchtasticpeople.com/course-category/core-vocabulary/" title="French courses that makes it easy for you to practice your French anytime, from anywhere and at a very affordable cost.">Core Vocabulary</a></li> <li class="quick-nav-item nav-item-5"> <a href="https://frenchtasticpeople.com/course-category/extended-french-vocabulary/" title="French courses that makes it easy for you to practice your French anytime, from anywhere and at a very affordable cost.">Extended Vocabulary</a></li> <li class="quick-nav-item nav-item-6"> <a href="https://frenchtasticpeople.com/course-category/basic-french-vocabulary-videos/" title="French courses that makes it easy for you to practice your French anytime, from anywhere and at a very affordable cost.">Vocab Video Tutorials</a></li> <li class="quick-nav-item nav-item-7"> <a href="https://frenchtasticpeople.com/course-category/french-grammar-glossary/" title="French courses that makes it easy for you to practice your French anytime, from anywhere and at a very affordable cost.">Grammar Glossary</a></li> <li class="quick-nav-item nav-item-8"> <a href="https://frenchtasticpeople.com/course-category/free-french-grammar-course-challenge/" title="French courses that makes it easy for you to practice your French anytime, from anywhere and at a very affordable cost.">Grammar Bootcamp</a></li> <li class="quick-nav-item nav-item-9"> <a href="https://frenchtasticpeople.com/course-category/most-used-french-verbs-part-1/" title="French courses that makes it easy for you to practice your French anytime, from anywhere and at a very affordable cost.">French Verbs (1)</a></li> <li class="quick-nav-item nav-item-10"> <a href="https://frenchtasticpeople.com/french-course-outlines" title="French courses that makes it easy for you to practice your French anytime, from anywhere and at a very affordable cost.">Course syllabuses</a></li> <li class="quick-nav-item nav-item-11"> <a href="https://frenchtasticpeople.com/french-course-guidelines/" title="French courses that makes it easy for you to practice your French anytime, from anywhere and at a very affordable cost.">Course Guidelines</a></li> <li class="quick-nav-item nav-item-12"> <a href="https://frenchtasticpeople.com/buy-amazon-french-books/" title="French courses that makes it easy for you to practice your French anytime, from anywhere and at a very affordable cost.">Amazon</a></li> <li class="quick-nav-item nav-item-13"> <a href="https://frenchtasticpeople.com/french-course-outlines" title="French courses that makes it easy for you to practice your French anytime, from anywhere and at a very affordable cost.">Manage Account</a></li> <li class="quick-nav-item nav-item-14"> <a href="https://frenchtasticpeople.com/french-course-guidelines/" title="French courses that makes it easy for you to practice your French anytime, from anywhere and at a very affordable cost.">Edit Profile</a></li> <li class="quick-nav-item nav-item-15"> <a href="https://frenchtasticpeople.com/lab/" title="French courses that makes it easy for you to practice your French anytime, from anywhere and at a very affordable cost.">Practice Lab</a></li> </ul> </div> </div> </div> </div></div></div> </div> </div> </div> <?php }
August 6, 2021 at 12:06 pm #222458In reply to: Forum url changes
pawanahluwaliaParticipantThanks!
However, is_bbpress() only seems to be true if you are on the root forum page.
How can I test for any forum page?
I tried
echo get_permalink();
on a forum page, but it does not display anything. It does display it on the root forum page, but it does not match the root forum page permalink. It again shows the highest Forum ID permalink instead.
Presumably the page is being created in code and is overwriting the content of the current forum page.
Any further suggestions?
August 6, 2021 at 10:58 am #222455In reply to: Forum url changes
Robin WModeratorI’d suspect that because each forum is not an real individual wordpress page (ie not in dashboard>pages) , then retrieving the page_link might well return a ‘virtual’ ID, and this might be the top forum – not proven, just a hunch.
My initial suggestions would be that you try get_permalink instead of get_page_link() – this retrieves the full url of the current displayed page, and should in theory get you what you want.
If you need the existing get_page_link() for your other pages, you could try wrapping it in an if… eg:
if (is_bbpress()) { get_permalink etc. } else { get_page_link() }
Let us know if that helps
June 14, 2021 at 11:48 pm #221224Topic: is_bbpress not working
in forum TroubleshootingbobdobbsParticipantI’m trying to detect requests for the bbpress forum index page.
Initially I tried ‘bbp_is_forum_archive()’.
This doesn’t return true from the forum archive page.I decided to test if any bbpress conditional tags were working, so I tested ‘is_bbpress’, because the function calls many (maybe all?) of the other conditionals.
However, ‘is_bbress’ doesn’t return true either.
However, on any page in my site, whether bbpress is on that page or not, this condition returns true:
‘if ( ! is_bbpress() )…’What could be happening here?
This is my function and the hook I’m using:
add_action('init', 'test_bbpress'); function test_bbpress() { if ( is_bbpress() ) { wp_die("got to the forums page") ; }
}
April 14, 2021 at 11:56 am #220019Robin WModeratorSorry, I’m being brain dead this afternoon.
Spectate is a capability shared by many roles, so the code above is rubbish !
Try this
function forum_user_is_spectator(){ if ( is_bbpress() && is_user_logged_in() ) { $user_ID = get_current_user_id() ; $role = bbp_get_user_role( $user_id ); if ($role == bbp_get_spectator_role()){ wp_enqueue_script( 'spectator-js', get_template_directory_uri() . '/js/spectator.js', array(), false, true); } } }
April 14, 2021 at 10:39 am #220016Robin WModeratoryou 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); } } }
April 14, 2021 at 9:49 am #220015haddlyapisParticipantHi 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
February 25, 2021 at 1:53 pm #218772In reply to: Changing Discussion Sidebar
Robin WModeratoreither
or
and use the logic
is_bbpress()
December 18, 2020 at 11:09 am #216794In reply to: apply js file only to the bbp forum
haddlyapisParticipantPerfect. Thx Robin!!
The following now works/* only run forum script in forum area */ add_action( 'wp_print_scripts' , 'deregister_forum_script'); function deregister_forum_script(){ if ( !is_bbpress() ){ wp_deregister_script('forum-js'); }}
This ticket is now closed. thx!
December 7, 2020 at 1:07 pm #216458mllapanParticipantThanks, but I found this
is_bbpress
function, and solved it.add_filter( 'the_content', 'post_ads_1_paragraph' ); function post_ads_1_paragraph( $content ) { $ad_code = '<div class="advert" style="display: none;">Reklama1</div>'; if ( is_single() && ! is_admin() && ! is_bbpress() ) { return prefix_insert_after_1nd_paragraph( $ad_code, 1, $content ); } return $content; } function prefix_insert_after_1nd_paragraph( $insertion, $paragraph_id, $content ) { $closing_p = '</p>'; $paragraphs = explode( $closing_p, $content ); foreach ($paragraphs as $index => $paragraph) { if ( trim( $paragraph ) ) { $paragraphs[$index] .= $closing_p; } if ( $paragraph_id == $index + 1 ) { $paragraphs[$index] .= $insertion; } } return implode( '', $paragraphs ); }
December 4, 2020 at 5:08 pm #216407In reply to: apply js file only to the bbp forum
Robin WModeratoris_bbpress()
December 1, 2020 at 3:24 pm #216313In reply to: Any shortcodes in footer breaks on pages of bbpress
archuxParticipantThe function is_bbpress() is for any page of bbpress
Does not matter, it is account or forum or topic… on all pages…
Footer is built with visual composer…If i use a shortcode to display forum index, the footer works fine. as soon i click into form:
https://<domain>/forums/forum/<forum name>/ footer breaks
https://<domain>/forums/topic/<topic name>/ footer breaks
https://<domain>/forums/user/<user name>/ footer breaksIt becomes as: [vc_row full_width=”stretch_row” css=”…” ….]…….[/vc_row]
Looks like on those page the WordPress function do_shortcode is disabled/unactivated…
Do this make more clear on what pages and what happens with footer?
December 1, 2020 at 2:13 pm #216305Topic: Any shortcodes in footer breaks on pages of bbpress
in forum TroubleshootingarchuxParticipantHi
This is a major issue with bbpress and I could not find a resolution to it. I found couple of similar requests but no one have full resolution.
Basically, if page can be recognized as is_bbpress() true than the footer shortcodes breaks.
How to fix that? Is there some patch?
October 26, 2020 at 4:32 am #215448In reply to: Customization
Robin WModeratorthis still works as far as I know
so you would use
!is_bbpress()
against the my posts – so that will only show on non bbpress pages
May 27, 2020 at 10:15 am #211465Topic: Load scripts when using shortcode
in forum InstallationzandercentParticipantbbpress doesn’t load the the necessary scripts (reply.js etc) when embedding a topic as a shortcode. This is because of the conditional checks on line 158 of bbpress-functions.php
if ( bbp_use_wp_editor() && is_bbpress() ) {
May 20, 2020 at 5:41 am #211205In reply to: Threaded replies not working
Carlos FariaParticipantThanks @mudit-kumawat. I would add this, as admin users will still show the admin bar, so with your code we will have two divs with the same id:
// Add adminbar blank div to fix BBPRESS jQuery issue function add_admin_bar_div() { if( is_bbpress() && ! current_user_can('administrator') ){ echo '<div id="wpadminbar" style="display:none;"></div>'; } } add_action('wp_footer', 'add_admin_bar_div',15);
February 24, 2020 at 3:46 pm #208911In reply to: User Statistics
ChuckieParticipantThanks, so something like this:
// Actually build all of this HTML function build_html() { $this->sort_users(); $data = $this->stats_builder(); $HTMLOutput = ""; if (is_user_logged_in()) { if ( is_bbpress() && current_user_can( 'spectate' ) ) { foreach( $data as $key => $html ) { $HTMLOutput .= "<div class='bbpas-" . $key . "' id='bbpas-" . $key . "'>" . $html . "</div>"; } } } return $HTMLOutput; }
Yes?
-
AuthorSearch Results