Delete all spam node entries of a spesific user on a Drupal site with PHP
Case: We have one or more spammer-user who added hunderts/thousands of nodes automagicly or manually. It takes very long time to delete them using Drupal admin interface. We need a fast & effective solution.
The solution
1. Find 'uid' of spammer
2. Create a block with input-filter PHP and run following code
<?php
$r = db_query("select * from {node} where uid='123456789'");
while( $arr = db_fetch_array($r) ){
echo $counter++. " ". print_r($arr,1)." ";
echo node_delete( $arr[nid] );
}
?>
Similar entries
- Drupal LDAP to copy Win.Server.AD groups to roles
- Let your visitors run Drupal cron for you
- Drupal fieldset default expanded not collapsed
- CCK Text Field in Node-Teaser?
- Recreate all teasers on Drupal
- Backup all MySQL databases automagicly with the PHP admin script
- PHP Block for Custom Role under Drupal 6
- Drupal warning: array_filter()
- Suhosin blocks Drupal Modules
- Display E-Mail Adresse of anonym visitors in Drupal-comments securely
- Language_List and default language as selected option on Drupal 6x
- This content has been modified by another user, changes cannot be saved.
- 'Similar entries' block cannot be changed on Drupal
- Repair all mysql databases-tables with PHP
- CMS for a nice-looking news website
- 'Similar entries' block cannot be saved
- Drupal 6 vs. Joomla 1.5 (2009)
- [Howto Fix] Table './eximstats/sends' is marked as crashed and should be repaired
- Replace string in big database or large text file
- Ajax Error when using Drupal with Firefox

Post new comment