Title: Issues with MultiSite &#8211; please help :-)
Last modified: August 20, 2016

---

# Issues with MultiSite – please help :-)

 *  [Dan & Jennifer](https://wordpress.org/support/users/danstuff/)
 * (@danstuff)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/issues-with-multisite-please-help/)
 * Hi Max!
 * Just installed Simple Login Log, great plugin!
 * Ran into problem however… we’re installing it on a WP multisite (with many domain-
   based sub-blogs). Some of these blogs are also domain-mapped btw, however that
   should not make a difference.
 * The problem is:
 * 1.) Logins to via the top-level site (mysite.com/wp-login.php) are logged to 
   this table: wp_simple_login_log
 * 2.) However, logins to sub-sites in the same wordpress multisite install (i.e.
   bobsblog.mysite.com/wp-login.php), are logged into separately created tables 
   for each sub-blog. i.e. for blog ID 92, they’re logged to this table: wp_92_simple_login_log
 * This is problematic as a network administrator because I can’t see ALL of the
   logins in one place.
    It is also problematic because a new table is getting created
   for each network blog – this is 1000’s of unnecessary tables!
 * Since users are created at the top level in WordPress, it makes sense that all
   of the logging would be stored at the top network level as well.
 * Thoughts? Suggestions?
 * Thanks!!
    Dan
 * [http://wordpress.org/extend/plugins/simple-login-log/](http://wordpress.org/extend/plugins/simple-login-log/)

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/issues-with-multisite-please-help/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/issues-with-multisite-please-help/page/2/?output_format=md)

 *  Plugin Contributor [Max Chirkov](https://wordpress.org/support/users/maxchirkov/)
 * (@maxchirkov)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/issues-with-multisite-please-help/#post-3327705)
 * Hi Dan,
 * I see the issue. Since I don’t have a multi-site setup, I don’t know what would
   be the best solution, off the top of my head. For now, you could simply hack 
   the plugin by hardcoding the table name. Edit the PHP file – find this line within
   the constructor:
 *     ```
       $this->table = $wpdb->prefix . $this->table;
       ```
   
 * and change the $wpdb->prefix to the prefix of your main table. For example:
 *     ```
       $this->table = 'wp_' . $this->table;
       ```
   
 * this should work.
 *  Thread Starter [Dan & Jennifer](https://wordpress.org/support/users/danstuff/)
 * (@danstuff)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/issues-with-multisite-please-help/#post-3327723)
 * Hey Max!
 * Thanks for the helpful recommendation, that absolutely worked!
 * Actually I added an if/then to check for multisite, with the is_multisite() function–
   see below.
 * Would you consider adding this check to the production plugin code, that way 
   we can update the plugin regularly when you release updates, without overwriting
   this fix. 🙂
 * Thanks!!
    Dan
 *     ```
       // table where to log logins
       if ( is_multisite() )
           // hard-code table name for multisite only
           $this->table = 'wp_' . $this->table;
       else
           // non-multisite - regular table name
           $this->table = $wpdb->prefix . $this->table;
       ```
   
 *  Plugin Contributor [Max Chirkov](https://wordpress.org/support/users/maxchirkov/)
 * (@maxchirkov)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/issues-with-multisite-please-help/#post-3327753)
 * Dan,
 * yes, something like that would work, we just need to avoid any hard-coded prefixes,
   since WP allows to define custom prefixes during the installation. So, something
   like this would probably be better:
 *     ```
       if ( is_multisite() )
           // get main site's table prefix
           $main_prefix = $wpdb->get_blog_prefix(1);
           $this->table = $main_prefix . $this->table;
       else
           // non-multisite - regular table name
           $this->table = $wpdb->prefix . $this->table;
       ```
   
 *  Thread Starter [Dan & Jennifer](https://wordpress.org/support/users/danstuff/)
 * (@danstuff)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/issues-with-multisite-please-help/#post-3327754)
 * [@max](https://wordpress.org/support/users/max/) looks great!
 * Thanks!
    Dan
 *  Plugin Contributor [Max Chirkov](https://wordpress.org/support/users/maxchirkov/)
 * (@maxchirkov)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/issues-with-multisite-please-help/#post-3327760)
 * Dan,
 * Just FYI – the milti-site feature that we talked about above will not make it
   into the next update (v.0.9.4). You will need to make the same code alterations
   again (if you choose to update). Currently, I don’t have the ability to test 
   the multi-site setup and I don’t know how this would function exactly… I don’t
   know if the plugin gets installed network-wide, and if so, do individual blog
   admins see the Login Log page under the Users as well as Login Log settings under
   General Settings? If so, then in case like yours they shouldn’t – only Network
   Admin should be able to see those things… I have to have a multi-site development
   setup, before I can implement this correctly and commit to a new version.
 *  Thread Starter [Dan & Jennifer](https://wordpress.org/support/users/danstuff/)
 * (@danstuff)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/issues-with-multisite-please-help/#post-3327761)
 * Hey Max!
 * Thanks for the update. I can definitely help u test it!
 * Yes, the plugin would have to be network activated (as we’ve done( so that it
   would record logins at main multisite level AND at individual sub-site level.
 * And you’re quite right… this is a security feature… so it’s for the network superadmin–
   so it should be listed in the primary site Users->Login Log but not in the other
   sites.
 * You know, that can be just a checkbox option in config…
 * Also wanted to make sure you saw this post – it’s a continuation of the same 
   thing. 🙂
    [http://wordpress.org/support/topic/how-to-hide-users-login-log-sub-menu-for-sub-sites-in-multisite?replies=2](http://wordpress.org/support/topic/how-to-hide-users-login-log-sub-menu-for-sub-sites-in-multisite?replies=2)
 * Thanks!
    Dan
 *  Thread Starter [Dan & Jennifer](https://wordpress.org/support/users/danstuff/)
 * (@danstuff)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/issues-with-multisite-please-help/#post-3327779)
 * Hey Max.
 * I just updated the plugin, did a diff on the files, and tested.
 * I can confirm the the new version ALREADY works great with multisite.
 * the only change I had to apply was the one from this other support ticket:
    [http://wordpress.org/support/topic/how-to-hide-users-login-log-sub-menu-for-sub-sites-in-multisite?replies=2](http://wordpress.org/support/topic/how-to-hide-users-login-log-sub-menu-for-sub-sites-in-multisite?replies=2)
 * Thanks!
    Dan
 *  Plugin Contributor [Max Chirkov](https://wordpress.org/support/users/maxchirkov/)
 * (@maxchirkov)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/issues-with-multisite-please-help/#post-3327788)
 * Great to hear that, Dan! Thanks for letting me now.
 *  [Ben Lobaugh (blobaugh)](https://wordpress.org/support/users/blobaugh/)
 * (@blobaugh)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/issues-with-multisite-please-help/#post-3327808)
 * Do these updates mean that each site will see the logins for every other site
   on the network? That is not such a good idea. It would be better for each site
   to store the blog_id along with the login. Then in the Network Admin area a report
   can be generated for all or specific sites.
 *  Plugin Contributor [Max Chirkov](https://wordpress.org/support/users/maxchirkov/)
 * (@maxchirkov)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/issues-with-multisite-please-help/#post-3327809)
 * Hi Ben,
 * currently, each site should be displaying only its own log. Each site has a separate
   login-log table where its data is stored. Dan was offering a network option that
   would be only available to the network admin, and which allow oversee the logins
   for all sites on the network. In that case all site’s logins would be stored 
   in a single table of the main site. This is not implemented into the plugin, 
   but Dan is using code mentioned above in his own setup.
 *  [Ben Lobaugh (blobaugh)](https://wordpress.org/support/users/blobaugh/)
 * (@blobaugh)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/issues-with-multisite-please-help/#post-3327810)
 * Ok, thanks. I will see if I can hack something together that will do what I need
 *  [Ben Lobaugh (blobaugh)](https://wordpress.org/support/users/blobaugh/)
 * (@blobaugh)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/issues-with-multisite-please-help/#post-3327811)
 * Dan, would you be willing to test out what I have hacked together? It logs perfectly
   for Multisite, and wp-multi-network. Site owners only see logins to their site,
   network admins see logins for the entire network, the main multisite administrator
   sees logins across all networks and sites. If you are interested drop me a line
   at [ben@lobaugh.net](https://wordpress.org/support/topic/issues-with-multisite-please-help/ben@lobaugh.net?output_format=md)
 *  Thread Starter [Dan & Jennifer](https://wordpress.org/support/users/danstuff/)
 * (@danstuff)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/issues-with-multisite-please-help/#post-3327835)
 * [@ben](https://wordpress.org/support/users/ben/), sorry just now saw this. 🙂
 * Hmm, our config is different, we’re not looking for site admins to see their 
   own site login history. this is more of a site-wide security thing to have an
   audit log of logins. So the existing code is working for us as is.
 * Thanks!
    Dan
 *  Thread Starter [Dan & Jennifer](https://wordpress.org/support/users/danstuff/)
 * (@danstuff)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/issues-with-multisite-please-help/#post-3327836)
 * [@max](https://wordpress.org/support/users/max/) just updated to the latest version,
   and looks like the Multisite code you recommended above has been incorporated–
   AND it works great.
 * I’m very happy because I can now take this plugin off the list of “plugins we’ve
   made changes to so can’t readily update” LOL.
 * Thanks!!!
    Dan
 *  Plugin Contributor [Max Chirkov](https://wordpress.org/support/users/maxchirkov/)
 * (@maxchirkov)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/issues-with-multisite-please-help/#post-3327837)
 * You’re welcome, Dan. I released an update quite some time ago… can’t even remember
   what exactly I committed 🙂

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/issues-with-multisite-please-help/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/issues-with-multisite-please-help/page/2/?output_format=md)

The topic ‘Issues with MultiSite – please help :-)’ is closed to new replies.

 * ![](https://ps.w.org/simple-login-log/assets/icon-256x256.png?rev=3487526)
 * [Simple Login Log](https://wordpress.org/plugins/simple-login-log/)
 * [Support Threads](https://wordpress.org/support/plugin/simple-login-log/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-login-log/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-login-log/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-login-log/reviews/)

## Tags

 * [multisite](https://wordpress.org/support/topic-tag/multisite/)

 * 16 replies
 * 4 participants
 * Last reply from: [Marcelo Pedra](https://wordpress.org/support/users/kent-brockman/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/issues-with-multisite-please-help/page/2/#post-3327838)
 * Status: not resolved