Search Results for 'code'
-
AuthorSearch Results
-
November 26, 2021 at 9:08 am #225804
In reply to: Best way to extend member profiles?
Robin W
Moderatorbuddypress has profile fields –
November 25, 2021 at 8:25 am #225795In reply to: Can I get the latest reply ID by topic ID?
Robin W
Moderatorbbp_get_topic_last_reply_id( $topic_id)
November 25, 2021 at 4:47 am #225780In reply to: HTML editor doesn’t appear on bbpress 2.6.7
Robin W
ModeratorThere is a temporary fix, either
1. use code
if( !function_exists( 'bbpress_browser_supports_js' ) ){ function bbpress_browser_supports_js() { echo '<script>document.body.classList.remove("no-js");</script>'; } add_action( 'wp_footer', 'bbpress_browser_supports_js' ); }
Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
or
2. install and activate
November 24, 2021 at 10:56 am #225767pannenkoek
ParticipantOh wait wrong code and not able to edit original post… here is the good one
jQuery("form.bbp-login-form").find(".bbp-submit-wrapper").append( '<button class="button" onclick="location.href=\'http://LINK-TO-REGISTER-PAGE\'" type="button">Registreer</button>' );
November 24, 2021 at 10:38 am #225764pannenkoek
ParticipantAnd then I stumbled on to the same problem. I came up with the following solution.
Create a page and add the shortcode [bbp-register] to display the register screen.
Then add the following code to your functions.php
function add_bbp_register_button() { ?> <script type="text/javascript"> jQuery('.bbp-submit-wrapper').append( '<button onclick="location.href=\'http://LINK-TO-REGISTER-PAGE\'" type="button">Register</button>' ); </script> <?php } add_action('wp_footer', 'add_bbp_register_button');
cheers
November 24, 2021 at 9:19 am #225759In reply to: forum appears in google search
Robin W
ModeratorNovember 23, 2021 at 2:30 pm #225728In reply to: Editor buttons missing since 2.6.8 upgrade
Robin W
Moderatorthis is a temporary fix, the bbpress authors are looking at a permanent one
if( !function_exists( 'bbpress_browser_supports_js' ) ){ function bbpress_browser_supports_js() { echo '<script>document.body.classList.remove("no-js");</script>'; } add_action( 'wp_footer', 'bbpress_browser_supports_js' ); }
Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
November 23, 2021 at 1:51 pm #225727In reply to: HTML editor doesn’t appear on bbpress 2.6.7
Robin W
Moderatoras far as I understand, the issue is detailed in changeset 7190 – yes?
so it is basically to hide the ‘generate passwword’ in form-user-passwords.php if the user’s browser does not support js or it is disabled.
If so, at the moment all bbpress pages end up with a no-js class as bbpress sets ‘no-js’ as the default, which means that the quicktags do not display on the topic and reply forms as they need js but the css thinks it is no-js, and the visual editor does not work for the same reasons.
At the moment you only test for js using the script technique in form-user-passwords.php viz
<script type="text/javascript"> document.body.className = document.body.className.replace( 'no-js', 'js' ); </script>
so I would suggest 1 of 2 approaches
1. putting this test in more generally so it runs on any bbpress page (as usefully suggested by @webcreations907) maybe by adding to the main function, or adding a filter in \includes\core\filters.php to run the script
so something like :
add_filter ('bbp_body_class' , bbp_test_js) ; function bbp_test_js ($classes) { ?> <script type="text/javascript"> document.body.className = document.body.className.replace( 'no-js', 'js' ); </script> <?php return $classes ; }
so that others could disable it
2. changing the class to bbp-no-js should work, if you do this in the bbp_body_class function and the form-user-passwords.php and in css, then I can no reason why it would not work if that is the sole intention of this.
November 23, 2021 at 12:55 pm #225721In reply to: HTML editor doesn’t appear on bbpress 2.6.7
John James Jacoby
Keymaster@robin-w – any suggestions on improvements bbPress should make?
I was thinking of renaming
no-js
tobbp-no-js
to try and avoid an issue with other plugins or themes already doing something with that class, but I’m not sure that solves this specific problem.November 23, 2021 at 12:48 pm #225719In reply to: Topic or forum (un)subscription hook
John James Jacoby
KeymasterThere is also…
do_action( 'bbp_add_user_subscription', $user_id, $object_id, $type );
…and…
do_action( 'bbp_remove_user_subscription', $user_id, $object_id, $type );
…if you need something a bit more lower-level, that isn’t tied directly to the request handler.
November 22, 2021 at 4:55 pm #225538In reply to: HTML editor doesn’t appear on bbpress 2.6.7
Robin W
Moderator@mr18 – then suggestion is to either use this in a child theme functions file, which will not lose settings on a main theme update, or use code snippets, which does not change on a theme update.
November 22, 2021 at 4:17 pm #225537In reply to: HTML editor doesn’t appear on bbpress 2.6.7
lisabeavers
ParticipantI used code snippits and the first chunk of code you gave me and it appears to have worked! Thank you!
November 22, 2021 at 3:29 pm #225533In reply to: HTML editor doesn’t appear on bbpress 2.6.7
webcreations907
Participant@robin-w if you remove the
no-js
in php, then it doesn’t allow the reason for adding it which would be to test if the browser supports javascript/jquery.Just an example
Say you have a slider(JS dependent) that you only want to show if the browser supports js, then adding.no-js .my-slider{display:none;}
would hide the slider if the browser didn’t support it, while if the browser supports JS then theno-js
would be removed by JS and the slider would be displayed. Because the only way the class was removed was with JS which would verify the browser supports JS.So if you remove it with PHP then there is no test and the slider is shown regardless if the browser supports JS or not. Not sure what the percentage of browser users that have it disabled, sure it’s a very very small amount.
You can see that in theme TwentyTwentyOne in
template-functions.php
the theme does it the same way I mentioned above in earlier post.Just wanted to mention it, hopefully it gets updated shortly and a fix gets out for it.
November 22, 2021 at 2:28 pm #225532In reply to: HTML editor doesn’t appear on bbpress 2.6.7
Robin W
Moderator2.6.8 does not fix.
so use either
add_filter ('bbp_body_class', 'rew_unset_no_js') ; function rew_unset_no_js($classes) { if (in_array ('single-forum', $classes) || in_array ('single-topic', $classes)) { if (($key = array_search('no-js', $classes)) !== false) { unset($classes[$key]); } } return $classes ; }
or if that doesn’t work
add_filter ('bbp_body_class', 'rew_unset_no_js') ; function rew_unset_no_js($classes) { if (($key = array_search('no-js', $classes)) !== false) { unset($classes[$key]); } return $classes ; }
Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
November 22, 2021 at 1:37 pm #225530In reply to: Topic or forum (un)subscription hook
Robin W
Moderatoras far as I know this action is fired on ANY subscribe/unsubscribe
// Do additional subscriptions actions do_action( 'bbp_subscriptions_handler', $success, $user_id, $object_id, $action, $object_type );
November 21, 2021 at 11:44 pm #225484In reply to: HTML editor doesn’t appear on bbpress 2.6.7
webcreations907
ParticipantThat’s good, glad that worked out for you.
You could also put it in
bbpress.php
in the plugin itself, then when the fix comes out and the plugin is updated it would get rid of it.For others looking for a solution, I tried to edit my post above but couldn’t, when I mentioned
functions.php
I mean thefunctions.php
file that is within your current active WordPress theme.November 21, 2021 at 11:36 pm #225483In reply to: HTML editor doesn’t appear on bbpress 2.6.7
KevinPlusPlus
ParticipantWebcreations907,
This code snippet added to my functions.php does then show the Text / Visual tabs and allow switching between them.
Not sure if that’s the permanent solution, but that does get things working without modifying the plugin code itself.
Kevin
November 21, 2021 at 11:20 pm #225482In reply to: HTML editor doesn’t appear on bbpress 2.6.7
webcreations907
ParticipantWhen
no-js
is used, it’s usually removed using javascript or jquery to check if the browser supports it as some people turn it off in there browser preferences.Try adding the below code to your
functions.php
or code snippet plugin, etc.if( !function_exists( 'bbpress_browser_supports_js' ) ){ function bbpress_browser_supports_js() { echo '<script>document.body.classList.remove("no-js");</script>'; } add_action( 'wp_footer', 'bbpress_browser_supports_js' ); }
Make sure to clear any caches and check to see if it works for you.
November 21, 2021 at 2:20 pm #225477In reply to: Error: Are you sure you wanted to do that?
artmuns
Participantthe error is when the βnonceβ does not validate.
I suppose I could try using translation to make it a friendly message but would rather try and fix it.
function my_nonce_message ($translation) { if ($translation === 'Are you sure you want to do this?') { return 'Please try again.'; } return $translation; } add_filter('gettext', 'my_nonce_message');
November 21, 2021 at 1:18 pm #225476In reply to: Error: Are you sure you wanted to do that?
Robin W
Moderatorthe error is when the ‘nonce’ does not validate.
https://codex.wordpress.org/WordPress_Nonces
not sure what you can do about it, not my speciality π
November 21, 2021 at 12:30 pm #225472In reply to: HTML editor doesn’t appear on bbpress 2.6.7
Robin W
Moderator@jjj Moving the ‘no-js’ class to the bottom of the ‘bbp_body_class’ function does not fix, as the quicktags toolbar is still not shown.
the following filter fixes, but I’m not entirely sure what the introduction of then ‘no-js’ class to the function is doing, but I can’t see that the patch has any unintended consequences as it only runs on the relevant pages.
add_filter ('bbp_body_class', 'rew_unset_no_js') ; function rew_unset_no_js($classes) { if (in_array ('single-forum', $classes) || in_array ('single-topic', $classes)) { if (($key = array_search('no-js', $classes)) !== false) { unset($classes[$key]); } } return $classes ; }
or if that doesn’t work
add_filter ('bbp_body_class', 'rew_unset_no_js') ; function rew_unset_no_js($classes) { if (($key = array_search('no-js', $classes)) !== false) { unset($classes[$key]); } return $classes ; }
Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
FOR THOSE USING BBP-STYLE-PACK – I’ll issue a revised version incorporating this shortly until fixed in bbpress.
November 20, 2021 at 1:59 pm #225465In reply to: HTML editor doesn’t appear on bbpress 2.6.7
Robin W
Moderatorok, in my testing
working :
function bbp_enable_visual_editor( $args = array() ) { $args['tinymce'] = true; $args['quicktags'] = false; return $args; } add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );
not working
function bbp_enable_visual_editor( $args = array() ) { $args['tinymce'] = true; return $args; } add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );
November 19, 2021 at 8:53 pm #225453In reply to: Subforum Function Stopped Working
TreeTrail
ParticipantThis topic has been resolved! We discovered what was causing this problem. It was not any custom code or plugin update issue. It was simply that I had changed the bbPress Forum > Visibility from “public” to “private”. Evidentially this prevents a plugin (like bbPress Toolkit) or custom code (like ours) from accessing the information.
November 19, 2021 at 2:25 pm #225444In reply to: HTML editor doesn’t appear on bbpress 2.6.7
John James Jacoby
KeymasterCan you please post the code snippet you are using to enable the visual editor?
In my testing, it is working OK using these snippets:
November 19, 2021 at 1:10 pm #225438In reply to: There is an error! disallowed_keys
John James Jacoby
KeymasterThis is a deprecated argument that only appears when
WP_DEBUG
is turned on.The debug log itself is nothing to worry about. π
bbPress will address this once its minimum version is (legitimately) raised to 5.5.
Thank you for letting us know here π
-
AuthorSearch Results