Article
Posted on 7th July 2020
Takes about 5 mins to read

Drupal 7 introduced the brilliant feature of letting users cancel their own account and with it various options for what to do with content they've created when they are cancelled. One of these options is to: > Delete the account and its content. Which can prove somewhat problematic if used incorrectly. You see, Drupal is very good at the latter part: deleting all the content created by the user. It's not very good at warning...

Published in: #Drupal Planet #database #users #content
Article
Posted on 20th January 2011
Takes about 1 min to read

It used to be a bit of a chore to add a role a user in Drupal, but no longer! All you need to do is this (in Drupal 7): $uid = 123;// User ID of user that you want to add role to. $role_name = 'Role to add'; // The name of the role to add. if ($role = user_role_load_by_name($role_name)) { user_multiple_role_edit(array($uid), 'add_role', $role->rid); } Of course someone can still come along and screw...

Published in: #Drupal Planet #users