party_user.install in Party 7
Same filename and directory in other branches
party_user.install Contains install hooks.
File
modules/party_user/party_user.installView source
<?php
/**
* @file party_user.install
* Contains install hooks.
*/
/**
* Implements hook_install().
*/
function party_user_install() {
// Set up our user mail primary field.
$primary_fields = variable_get('party_primary_fields', array());
// Don't override anything existing.
if (!isset($primary_fields['email']['user:mail'])) {
$primary_fields['email']['user:mail'] = array(
'data_set' => 'user',
'property' => 'mail',
// Make this the last label plugin in case there are already others.
'weight' => 50,
'callback' => 'party_label_default',
);
variable_set('party_primary_fields', $primary_fields);
}
}
/**
* Implements hook_enable().
*/
function party_user_enable() {
// Force core's setting to require e-mail verification on new user accounts
// created by visitors, so we know users are who they say they are.
variable_set('user_email_verification', TRUE);
}
/**
* Implements hook_requirements().
*/
function party_user_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time
$t = get_t();
// Check the core setting we set in party_user_enable() hasn't been reverted.
if ($phase == 'runtime') {
if (!variable_get('user_email_verification', TRUE)) {
$requirements['party_user_core_verification'] = array(
'title' => $t('New account email verification'),
'description' => $t('The Party User module requires new user accounts to verifify their email addresses. You should change the setting on the <a href="!url">account settings page</a>.', array(
'!url' => url('admin/config/people/accounts'),
)),
'severity' => REQUIREMENT_ERROR,
'value' => $t('Not set'),
);
}
}
return $requirements;
}
/**
* Bring across party_user_create_on_register variable to new format.
*/
function party_user_update_7001() {
$on_registration = variable_get('party_user_create_on_register', FALSE) ? 'create' : 'nothing';
variable_set('party_user_on_registration', $on_registration);
}
Functions
Name | Description |
---|---|
party_user_enable | Implements hook_enable(). |
party_user_install | Implements hook_install(). |
party_user_requirements | Implements hook_requirements(). |
party_user_update_7001 | Bring across party_user_create_on_register variable to new format. |