WordPress.org

Forums

WP Security Audit Log
[resolved] WordPress Multisite below 3.7 (2 posts)

  1. hiphopsmurf
    Member
    Posted 1 year ago #

    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/

  2. WPWhiteSecurity
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Security Audit Log
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.