Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter tehfab1

    (@tehfab1)

    Yeah, crazy.

    I don’t know why the line numbers don’t match up. The plugin was installed through the Plugin installer in wordpress. Maybe something was funky with Notepad++ or something.

    Thread Starter tehfab1

    (@tehfab1)

    Ok, I think I’m starting to understand whats going on here. The SQL calls that are going out of control are meta_cache refreshes for users. We have well over 1,000 registered users on our site, so when Shortcodes Ultimate loops through each user and attempts to call the username it turns into a very expensive operation.

    Here is an example:

    SELECT user_id, meta_key, meta_value
    FROM va_usermeta
    WHERE user_id IN (348)
    ORDER BY umeta_id ASC

    The function trail looks like this:

    update_meta_cache()
    get_metadata()
    get_user_meta()
    WP_User->_init_caps()
    WP_User->for_blog()
    WP_User->init()
    WP_User->__construct()
    WP_User_Query->query()
    WP_User_Query->__construct()
    get_users()
    Su_Tools::get_users()
    Su_Data::shortcodes()
    Shortcodes_Ultimate::register()
    do_action('init')

    The Function that causes all the ruckus is in /inc/core/tools.php Line 1307

    public static function get_users() {
    
    		$users = array();
    
    		foreach ( (array) get_users() as $user ) $users[$user->ID] = $user->data->display_name;
    
    		return $users;
    
    	}

    The function is called in /inc/core/data.php Line 4209.

    ~~~~~~~~~~~~

    I commented out the foreach loop and Shortcodes Ultimate went from ~1,500 calls per page load to 3 lol. I don’t use any shortcodes that would rely on Shortcodes Ultimate being aware of what users are on the site so I’m going to leave it commented out for now. However, it might merit looking into a less expensive way to perform that task for websites which have a large number of users.

    Now, as an aside. This site is running Wishlist member. I’m not sure, but it wouldn’t surprise me if this was somehow exacerbating the issue and essentially breaking the user cache. I wonder if Wishlist member is forcing the update_meta_cache() function to run when a user is called to make sure they still have access to restricted areas of the website. I cannot confirm this, though, since like the nice people they are, they encrypted the code of their plugin.

    I wonder if that other guy also has wishlist member installed on his website.

    Probably what needs to be done is simply to write a single command that calls all the user display names at once. There must be a way to do this that side steps this potentially SQL expensive process.

    Your help, though, has been invaluable and I can use the plugin with no problem now! My site is like three times as fast haha.

    Thank you so much. I hope the data I gathered and shared here will be helpful in correcting this issue.

    Thread Starter tehfab1

    (@tehfab1)

    Hey thanks for the update! I will give that plugin a try and see if I can narrow it down more.

    Typically the content in the shortcodes is simply text / images. Occasionally I go crazy with it and embed some additional plugins, but mostly its plain text / basic HTML.

    I’ll update shortly with some additional results. Thanks for looking into this with me. Shortcodes Ultimate is the first plugin I install on every site I use, I really would like to avoid trying to replace it if possible!

Viewing 3 replies - 1 through 3 (of 3 total)