[support] Help with deleting all users with a specific role

Steve Power steev at initsix.co.uk
Thu Mar 12 19:10:57 UTC 2009


excellent thankyou.  I assume i can create a page with php input, and select
users by role with a form.

I will try and post the code if it works!  cheers

On Thu, Mar 12, 2009 at 7:03 PM, William Smith <william.darren at gmail.com>wrote:

> You can use user_delete which besides deleting the user, also fires off the
> user hook with the delete op, so any other modules that are listening will
> clean up whatever they need to clean up.  The implementation of hook_user in
> the node module will set the uid of existing nodes to 0 in this case, but
> not delete them.  So if you want to eliminate all the nodes for the users,
> you would want to do that first (node_delete) before doing the user_delete.
>
> You'd wrap this all up in a while loop that iterated over each existing
> uid.
>
> On Thu, Mar 12, 2009 at 2:46 PM, Steve Power <steev at initsix.co.uk> wrote:
>
>> Hi
>>
>> ive been migrating a customer from phpbb2 to D6.  Was sposed to go live on
>> sunday...  Ive had numerous issues (mainly due to poor sql performance on
>> ec2 instances!) and the rest is due to be finished tonight starting 10pm uk
>> time....one problem is that the customer has been using the test site to
>> create nodes, while i stupidly had test forum data on there.  I have managed
>> to delete all the test forum data, but im left with 1700 users who need to
>> be readded from the most recent cut of the phpbb database.
>>
>> Anyways, longer story shorter - does anyone know the SQL i can use to
>> delete all authetnicated users, all their post settings (e.g.
>> user_titles_posts) and related tables etc?  I assume there is a drupal
>> function that i can loop through somewhere, but im running out of time and
>> wondered if anyone had done this before, and if they could point me in the
>> right direction!
>>
>> cheers!
>>
>> --
>> --
>> --
>> Steve Power
>> Principal Consultant
>> Mobile: +44 (0) 7747 027 243
>> Initsix Technology and Media
>> --
>> "So Linux is bulletproof? No. Bulletproof is one of the last stages of
>> drunkenness, not a state of security"  http://www.linux.com/feature/60208
>>
>> --
>> [ Drupal support list | http://lists.drupal.org/ ]
>>
>
>


-- 
-- 
--
Steve Power
Principal Consultant
Mobile: +44 (0) 7747 027 243
Initsix Technology and Media
--
"So Linux is bulletproof? No. Bulletproof is one of the last stages of
drunkenness, not a state of security"  http://www.linux.com/feature/60208
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.drupal.org/pipermail/support/attachments/20090312/a966642d/attachment-0001.htm>


More information about the support mailing list