Last active
December 28, 2015 18:59
-
-
Save tanmayk/7546827 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_user_insert(). | |
* Add default privacy settings. | |
*/ | |
function MYMODULE_user_insert(&$edit, $account, $category) { | |
// Add default privacy settings into users.data | |
$instances = field_info_instances('user', 'user'); | |
$field_settings = array(); | |
foreach ($instances as $field_name => $field_info) { | |
// Lets make it PUBLIC by default. | |
$field_settings[$field_name] = CORE_SECURITY_PRIVACY_PUBLIC; | |
} | |
$data['privacy_settings'] = $field_settings; | |
user_save($account, array('data' => $data)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment