Forum Replies Created

Viewing 15 replies - 316 through 330 (of 407 total)
  • @robin-wDONE

    @jb510 & @kckc – If you’re comfortable raw-editing the plugin files, you can make these changes too and “beta test them” before they’re rolled-out in the next plugin release.

    The approach I listed above seemed like overkill for such a simple task, so I walked away for a while and thought about it.

    It can actually be accomplished using the default bbPress ajax without having to deal with any custom JS file generations by just including the expected CSS selectors within the button rendering.

    It’s simplified enough that I don’t have to add a new branch on GitHub. I’m just going to post the changes here, you can apply them locally and test them out and roll them out in the next release when you’re happy that it’s working right.

    Change #1:

    In /includes/functions.php, replace the entire bsp_subscribe_button() function (lines 335-356) with:

    // Actually display/render the subscription button
    function bsp_subscribe_button() {
        
    	global $bsp_style_settings_buttons;
            
            // setup the button with custom description if set
            if ( ! empty( $bsp_style_settings_buttons['subscribe_button_description'] ) ) $args['subscribe'] = $bsp_style_settings_buttons['subscribe_button_description'];
            if ( ! empty( $bsp_style_settings_buttons['unsubscribe_button_description'] ) ) $args['unsubscribe'] = $bsp_style_settings_buttons['unsubscribe_button_description'];
    
            // setup remaining required arguments
            $args['user_id'] = bbp_get_user_id( get_current_user_id(), true, true );
            $args['object_id'] = bbp_get_forum_id();
            $args['object_type'] = 'post';
            
            // render the button with arguments
            bbp_user_subscribe_link( $args );
    
    }
    
    
    // Apply filter to the subscription button to make sure the class and descriptions are applied
    function bsp_subscribe_button_filter( $html, $args ) {
        
        global $bsp_style_settings_buttons;
        
        // change "Subscribe" text within the html only if needed
        if ( ! empty( $bsp_style_settings_buttons['subscribe_button_description'] ) ) {
                if ( $args['subscribe'] !== $bsp_style_settings_buttons['subscribe_button_description'] ) {
                        $html = preg_replace('/'.$args['subscribe'].'/', esc_attr( $bsp_style_settings_buttons['subscribe_button_description'] ), $html);
                }
        }
        
        // change "Unsubscribe" text within the html only if needed
        if ( ! empty( $bsp_style_settings_buttons['unsubscribe_button_description'] ) ) {
                if ( $args['unsubscribe'] !== $bsp_style_settings_buttons['unsubscribe_button_description'] ) {
                        $html = preg_replace('/'.$args['unsubscribe'].'/', esc_attr( $bsp_style_settings_buttons['unsubscribe_button_description'] ), $html);
                }
        }
        
        // setup the class for the link
        if ( $bsp_style_settings_buttons['button_type'] == 2 ) $class = $bsp_style_settings_buttons['Buttonclass'];
        else $class = 'bsp_button1';
    
        // apply the class to the link html
        $pattern = '/class="subscription-toggle"/' ;
        $replace = 'class="subscription-toggle '.$class.'"';
        $html = preg_replace( $pattern, $replace, $html );
        
        // return the customized link html
        return $html;
    
    }
    add_filter( 'bbp_get_user_subscribe_link', 'bsp_subscribe_button_filter', 10, 2 );

    Change #2:

    At the bottom of /css/styles.php just before the “custom css” generation, add this:

    /*----------------------  button fixes to work with default bbPress buttons and override theme values that make buttons look wrong --------------------------*/
    
    /* override bbpress floating subscription link to the right */
    #bbpress-forums div.bsp-center #subscription-toggle {
        float: none;
    }
    
    /* override any theme margins for generic input css so the mark as read button alignment matches */
    input.bsp_button1 {
        margin: 0px;
    }

    Change #3 (optional) (fixes the buttons clashing with the notices block):

    Also in /css/styles.php on line 3609 replace:

    		.bsp-center
    		{
    			width: 100%;
    			max-width: 100%;
    			float: none;
    			text-align: center;
    			margin-top: 20px;
    		}

    with:

    		.bsp-center
    		{
    			width: 100%;
    			max-width: 100%;
    			float: none;
    			text-align: center;
    			margin: 10px 0px 10px 0px;
    		}

    That’s It!

    If you WANT to over-complicate the solution like I was initially doing by trying to keep the current bsp button generation method intact, then I have a few hundred lines of code spanning across 5 or 6 different files that I can send your way. Just seemed like overkill and unnecessary. This approach uses the default bbPress html code and ajax, but just applies the custom wording/class to them.

    I’ve tested with and without BuddyPress active, with multiple themes, and with multiple browsers. Good-to-go as far as I can tell. Plus the button now actually uses ajax without reloading the page, which is a nice touch! 🙂

    • This reply was modified 3 years, 3 months ago by codejp3. Reason: added optional change #3

    @robin-w – I found the fix, but it’s quite complicated. Quick overview –

    1.) JS needs to be added for the ajax function including custom button class. It has to be generated based on custom user class or default bsp_button1 class. Also requires the new file to be generated within the main plugin file and within admin settings. Only enqueued in /includes/generate_css.php if bsp_style_settings_sub_management[subscriptions_management_activate] active. Also has to be multisite friendly.

    2.) bsp_subscribe_button() function re-written to use bbp_get_user_subscribe_link() which includes ajax action call.

    This brings up another change that could/should be implemented in /includes/settings.php. Within the “$_REQUEST[‘updated’]” success message, include a check for which plugin tab is active, and if that plugin tab deals with file generations then regenerate the files for only THAT TAB. It looks like most tabs generate files individually instead of within the main settings file, and they do so every page load instead of only when saved settings have changed.

    I’m making these changes now and will send you a new pre-pub version to check out soon. Just wanted to give you the heads up so that we’re not both tackling the same problem.

    Yeah I tried that too. Then I thought, well maybe it also wants it to be wrapped in the span class=subscription-toggle that bbPress uses, but that didn’t work either.

    I think it may take a full rewrite of the current bsp_subscribe_button() function in Style Pack /includes/functions.php so that it uses bbp_get_user_subscribe_link() instead of bbp_get_forum_subscription_link().

    Full function details can be found in /bbpress/includes/users/templates.php around line 1300-ish:

    bbp_get_user_subscribe_link( $args = array(), $user_id = 0, $wrap = true )

    args array:

    'subscribe'   => esc_html__( 'Subscribe',   'bbpress' ),
    'unsubscribe' => esc_html__( 'Unsubscribe', 'bbpress' ),
    'user_id'     => 0,
    'object_id'   => 0,
    'object_type' => 'post',
    'before'      => '',
    'after'       => '',
    'redirect_to' => '',

    minimum required args:

    user_id
    object_id
    object_type

    @kckc & @jb510 – You’re not crazy! 🙂

    Confirmed. The conflict is not with the private groups plugin, but BuddyPress directly.

    I can replicate the issues with just:
    bbPress
    BuddyPress
    Style Pack

    Happens in all 3 of my browsers, and regardless of which theme is active.

    Now to figure out WHY. No client-side errors showing in dev tools and no server-side errors showing in the debug log. Probably a conflict with something in BuddyPress being named the same thing as something in bbPress/Style Pack.

    Will keep digging until I find the culprit.

    I’m going to install BuddyPress and the private groups plugin on my test site. Seems like the most likely culprit give both of your feedback so far. I’ll chime back in here if I can replicate the issue.

    @robin-w – If that function for subscription management deals with user registration in any way (original critical error reason), then it’s certainly a possibility. If not, then I suspect the issue will still exist.

    I have tested on firefox, chromium, and midori. Also tested against traditional, block and fse themes. Subscribe button working fine on all.

    Only thing I noticed that could use a little tweaking is the margins.

    The “Mark All Topics Read” button (if enabled), doesn’t have any specific styling for it, so it inherits theme-level “input” styling, which some of themes I tested against gave it bottom margin of 24px or top margin of 12px or some kind of margin value for general input elements, which threw the whole row of buttons off. Adding this to /css/styles.php for generation would solve it to override generic input element theme styling:

    input.bsp_button1 {
        margin: 0px;
    }

    And then I noticed that if I display forum notices, the buttons overlap the notice.

    Changing the margin values in the .bsp-center class seems to be a good fit.

    From:

    .bsp-center {
        width: 100%;
        max-width: 100%;
        float: none;
        text-align: center;
        margin-top: 20px;
    }

    To:

    .bsp-center {
        width: 100%;
        max-width: 100%;
        float: none;
        text-align: center;
        margin: 10px 0px 10px 0px;
    }

    Like I said, the functionality is working just fine against 3 different themes in 3 different browsers so I was not able to replicate the issue. Just noticed a few styling tweaks.

    403 error means “forbidden”

    Follow the official documentation for how to add that debugging code to wp-config.php:

    Debugging in WordPress

    Probably related to this:

    NOTE: You must insert this BEFORE/* That's all, stop editing! Happy blogging. */ in the wp-config.php file.

    Also, by default

    define( 'WP_DEBUG', false );

    is already there. You can delete that line or comment it out and then paste the code I gave you in the same spot.

    @jemar707 – You’ve got email! Let me know if you need any further assistance. 🙂

    @kalusha – is this the plugin you’re using? WP-Members

    I’ve installed that plugin and played around with it to try to reproduce the error. Everything appears to be working fine with both the default /wp-login.php?action=register form and the in-page register form for restricted pages.

    If you can provide the exact error message to me or @robin-w we may be able to make Style Pack work with the WP-Members plugin.

    Enabling Debugging may help you get the error. You can temporarily enable debugging by adding the following lines to your wp-config.php file:

    define( 'WP_DEBUG', true );
    
    // Enable Debug logging to the /wp-content/debug.log file
    define( 'WP_DEBUG_LOG', true );
    
    // Disable display of errors and warnings
    define( 'WP_DEBUG_DISPLAY', true );
    @ini_set( 'display_errors', E_ALL );
    
    define( 'SCRIPT_DEBUG', true );

    And for better control over debug messages, I recommend this plugin – DebugPress

    @jemar707 – I’ve tried very hard to replicate your error with full debugging enabled and have not been able to reproduce it yet.

    I’ve tried the specific steps you listed to recreate:
    Activate Moderation Tools in bbp style pack, create a new topic or reply in the forum.

    I tried with various Moderation tools settings in wp-admin/options-general.php?page=bbpress

    I tried by creating topics as an admin user, a regular user, and a guest user.

    I tried those on 3 different theme types (traditional (twenty-ten), block (twenty-twenty-two), and full-site editing (twenty-twenty-three) ).

    NOTHING. No critical errors. I’m not even getting any general PHP warning/notice messages. It seems to be working exactly as expected without any issues.

    Since I cannot replicate it, I’d like for you to share your exact setting values for Style Pack. Here’s what I’m requesting you email to me (and @robin-w ):


    1.) Your Style Pack Settings ( export them as a file and attach it to the email: wp-admin/options-general.php?page=bbp-style-pack&tab=export )


    2.) The Plugin Information at the top of the “Plugin Information” tab ( wp-admin/options-general.php?page=bbp-style-pack&tab=plugin-info ), specifically the first 6 values (WP Version – Active Plugins).

    3.) The exact error message you received in your email (if any) when the critical error occurs.

    Please email them to [email protected] and to the address that @robin-w provided above.

    @robin-w Guess I’ll start testing these two critical error bugs too.

    @robin-w good to know, but I’m still going to test widgets and shortcodes thoroughly today. If there are any lingering issues, I want them wrapped-up. If there are no issues, then perhaps I can help @litzelmann figure out why they’re having issues on their specific server/site.

    OK. I’m on it. Should have a fix for you later today.

    @litzelmann

    No. They have been applied to the past 3 updates so there’s nothing for you to do at this point.

    I’m digging into widgets and shortcodes now. Question:

    Are you still having issues with specific widgets/shortcodes, or all of them?

Viewing 15 replies - 316 through 330 (of 407 total)