WordPress.org

Support

Support » Plugins and Hacks » [Resolved] WordPress Multisite below 3.7

[Resolved] WordPress Multisite below 3.7

  • The function wp_get_sites() is not present in WordPress versions below 3.7 so I made a modification to the function get_blogs() in /wp-content/plugins/wp-security-audit-log/inc/WPPHUtil.php @ Line 219.

    Changed:

    static function get_blogs()
        {
            if(wp_is_large_network()){
                return get_blog_details(get_option(WPPH_MAIN_SITE_ID_OPTION_NAME),true);
            }
            $blogs = wp_get_sites();
            $out = array();
            foreach($blogs as $blog){
                $entry = get_blog_details($blog['blog_id']);
                array_push($out, array(
                    'blog_id' => $entry->blog_id,
                    'blogname' => $entry->blogname
                ));
            }
            array_unshift($out, array('blog_id' => 0, 'blogname' => 'All sites'));
            return $out;
        }

    TO:

    static function get_blogs()
        {
    		global $wpdb;
            if(wp_is_large_network()){
                return get_blog_details(get_option(WPPH_MAIN_SITE_ID_OPTION_NAME),true);
            }
            //$blogs = wp_get_sites();
    		$query = 'SELECT blog_id FROM ' . $wpdb->blogs;
    		$blogs = $wpdb->get_results($query);
            $out = array();
            foreach($blogs as $blog){
                //$entry = get_blog_details($blog['blog_id']);
    			$entry = get_blog_details($blog->blog_id);
                array_push($out, array(
                    'blog_id' => $entry->blog_id,
                    'blogname' => $entry->blogname
                ));
            }
            array_unshift($out, array('blog_id' => 0, 'blogname' => 'All sites'));
            return $out;
        }

    It would be useful to see this in a future update :O)

    https://wordpress.org/plugins/wp-security-audit-log/

Viewing 1 replies (of 1 total)
  • Plugin Author WPWhiteSecurity

    @wpwhitesecurity

    Hi,

    Thanks for the recommendation and for using our plugin. We will look into your solution and definitely consider adding it to the next update.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] WordPress Multisite below 3.7’ is closed to new replies.