Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 1,351 through 1,375 (of 32,481 total)
  • Author
    Search Results
  • #225899
    Robin W
    Moderator

    I appreciate your frustration, but not sure ‘fault’ is the correct word.

    bbpress has changed something – but the ‘fix’ when it comes may not ‘fix’ you, as your site is adding a no-js class (from either the ‘Publisher’ theme or a plugin) which then isn’t overwritten as is normal practice by a test within your theme or the plugin.

    you could try adding this to the custom css of your theme

    .no-js {
    display : inline !important
    }

    to override the bbpress setting

    #225897
    Robin W
    Moderator

    Untested, but find
    wp-content/plugins/bbpress/templates/default/bbpress/form-topic.php

    transfer this to your pc and edit

    change line 31

    from

    <?php if ( bbp_current_user_can_access_create_topic_form() ) : ?>

    to

    <?php if ( bbp_current_user_can_access_create_topic_form() && (bbp_get_forum_id() != '2927') ) : ?>

    and save

    where 2927 is the forum you don’t want to show the form for

    then create a directory on your theme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

    where %your-theme-name% is the name of your theme

    Then transfer the file you saved above and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/form-topic.php

    bbPress will now use this template instead of the original

    If you want multiple forums, you could create and array and test against that

    #225894
    Robin W
    Moderator

    so do you want to hide the new topic form every time this particular forum displays (easier), or just for this particular shortcode on a page (more difficult) ?

    #225886
    Editor Mike
    Participant

    My dashboard takes me here when I click for latest updates.

    Releases

    But that is not up to date, how do we know what is in an update before we install it?

    #225871
    bradm413
    Participant

    bbPress Version 2.6.9
    WP version 5.8.2
    site: https://branchtheworld.com

    I have searched and haven’t found an exact case like what I’m looking for. I would like to hide the “New Topic” form that displays when using this shortcode:

    [bbp-single-forum id=$forum_id] – Display a single forums topics. eg. [bbp-single-forum id=32]

    See screenshot here:
    screenshot

    Is this something I’ll need to do with custom coding, or is there a plugin or another simple way to achieve this?

    #225855
    Robin W
    Moderator

    your theme/developer has added the ‘no-js’ class to the very top, hence why the other codes are not working.

    can you try this snippet

    add_action( 'wp_footer', 'rew_supports_js' );
    
    function rew_supports_js() {
    	echo '<script>document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/g, '') + " js ";</script>';
    }

    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

    #225835

    In reply to: Forum Width

    Robin W
    Moderator

    The width is governed by a div with the class rt-container, but it is not clear what craetes that.

    Try this in the custom css part of your theme

    .rt-container {
    	width: 1500px !important;
    }
    #225824
    dusemedia
    Participant

    That plugin works fine for the WP Classic Editor but not for the BBPress Teeny editor.

    The paste as plain text code in the documentation above works fine for the regular BBPress TinyMCE editor but not for the BBPress Teeny editor.

    #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

Viewing 25 results - 1,351 through 1,375 (of 32,481 total)
Skip to toolbar