WordPress.org

Ready to get started?Download WordPress

Forums

bbPress String Swap
Works as Billed but Slows Site Significantly (3 posts)

2 stars
  1. ZachMatthews
    Member
    Posted 1 year ago #

    This string swap plugin works as intended but it was adding almost 2 seconds of load time to my bbPress installation per the P3 Plugin Performance Profiler. I had to disable it as a result.

    For those trying to achieve this without the slowdown, I was able to successfully change the names on my Forum software using the following code, added to the end of my Functions.php page in my theme:

    add_filter( 'bbp_get_dynamic_roles', 'my_bbp_custom_role_names');
    
    function my_bbp_custom_role_names(){
     return array(
    
            // Keymaster
            bbp_get_keymaster_role() => array(
                'name'         => __( 'CHANGE THIS TO YOUR NAME', 'bbpress' ),
                'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() )
            ),
    
            // Moderator
            bbp_get_moderator_role() => array(
                'name'         => __( 'Moderator', 'bbpress' ),
                'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() )
            ),
    
            // Participant
            bbp_get_participant_role() => array(
                'name'         => __( 'Participant', 'bbpress' ),
                'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() )
            ),
    
            // Spectator
            bbp_get_spectator_role() => array(
                'name'         => __( 'Spectator', 'bbpress' ),
                'capabilities' => bbp_get_caps_for_role( bbp_get_spectator_role() )
            ),
    
            // Blocked
            bbp_get_blocked_role() => array(
                'name'         => __( 'Blocked', 'bbpress' ),
                'capabilities' => bbp_get_caps_for_role( bbp_get_blocked_role() )
            )
        );
    }
  2. daveshine (David Decker)
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for your feedback!
    As you said, my plugin works as advertised, so there's no reason to rate only with 2 stars! :)

    You could have opened a support thread about that issue in the forum here. There's also already a topic about that issue, see here: http://wordpress.org/support/topic/this-plugin-is-slowing-down-my-site-a-lot

    This all comes from the usage of WordPress' own 'gettext' filter! A lot of strings don't allow changing via filter yet, so we have to use a 'gettext' filter!

    The example of the dynamic role names will be changed in the same way you posted your example code - will come in the next version! NOTE: By the time of creating this plugin last year, there were no dynamic roles and no filter for it! For the sake of backward compatibility it was kept as is (via 'gettext' filter).

    I hope you'll change your review to a better rating once my update is live. It will also include an option to disable all settings that use 'gettext' filter (this resulting in fewer changeable strings, of course).

    Thanks, Dave :)

  3. daveshine (David Decker)
    Member
    Plugin Author

    Posted 9 months ago #

    @ZachMatthews:

    Hi there again!

    The performance issues could now be solved with the complete removal of the "gettext" filter usage, in favor of another, way better solution.

    Please upgrade to version 1.4.0 of the plugin!

    Maybe you can update your review then? - Thanks in advance!

    Thanks, Dave :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.