itthinx / groups

Groups provides group-based user membership management, group-based capabilities and content access control. It integrates standard WordPress capabilities and application-specific capabilities along with an extensive API.
GNU General Public License v3.0
49 stars 35 forks source link

Plugin won't activate with lots of users #13

Closed haroldkyle closed 7 years ago

haroldkyle commented 10 years ago

We have about 12,000 users on our blog, so the plugin hangs for a long time upon activation. Eventually memory is exhausted as the activation cycles through Groups_User_Group::create() within Groups_Registered::activate(). The only way I could successfully activate the plugin was by commenting out the foreach over all users. I followed this up with an SQL query to make sure all the blog's users were added to the Registered group:

insert ignore into wp_3_groups_user_group 
select ID, 1 from wp_users u
join wp_usermeta um on um.user_id = u.ID and um.meta_key = 'wp_3_capabilities';

Perhaps (if this indeed is what the plugin does here) you could take a similar approach, which in my case only took 0.15 seconds.