Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 1,301 through 1,325 (of 32,432 total)
  • Author
    Search Results
  • #225804
    Robin W
    Moderator

    buddypress has profile fields –

    User Extended Profiles

    #225795
    Robin W
    Moderator

    bbp_get_topic_last_reply_id( $topic_id)

    #225780
    Robin W
    Moderator

    @oscowordpress1

    There 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

    Code Snippets

    or

    2. install and activate

    bbp style pack

    #225767
    pannenkoek
    Participant

    Oh 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>' );

    #225764
    pannenkoek
    Participant

    And 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

    #225759
    Robin W
    Moderator
    #225728
    Robin W
    Moderator

    this 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

    Code Snippets

    #225727
    Robin W
    Moderator

    @johnjamesjacoby

    as 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.

    #225721

    @robin-w – any suggestions on improvements bbPress should make?

    I was thinking of renaming no-js to bbp-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.

    #225719

    There 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.

    #225538
    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.

    #225537
    lisabeavers
    Participant

    I used code snippits and the first chunk of code you gave me and it appears to have worked! Thank you!

    #225533
    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 the no-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.

    #225532
    Robin W
    Moderator

    2.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

    Code Snippets

    #225530
    Robin W
    Moderator

    as 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 );
    #225484
    webcreations907
    Participant

    That’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 the functions.php file that is within your current active WordPress theme.

    #225483
    KevinPlusPlus
    Participant

    Webcreations907,

    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

    #225482
    webcreations907
    Participant

    When 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.

    #225477
    artmuns
    Participant

    the error is when the β€˜nonce’ does not validate.

    https://codex.wordpress.org/WordPress_Nonces

    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');
    #225476
    Robin W
    Moderator

    the 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 πŸ™‚

    #225472
    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

    Code Snippets

    FOR THOSE USING BBP-STYLE-PACK – I’ll issue a revised version incorporating this shortly until fixed in bbpress.

    #225465
    Robin W
    Moderator

    ok, 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' );
    #225453
    TreeTrail
    Participant

    This 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.

    #225444

    Can you please post the code snippet you are using to enable the visual editor?

    In my testing, it is working OK using these snippets:

    Enable Visual Editor

    #225438

    This 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 πŸ™

Viewing 25 results - 1,301 through 1,325 (of 32,432 total)
Skip to toolbar