1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
* @file
|
4 |
|
|
* Variable API module. Definition for Drupal core variables
|
5 |
|
|
*/
|
6 |
|
|
|
7 |
|
|
/**
|
8 |
|
|
* User module variables
|
9 |
|
|
*/
|
10 |
|
|
function user_variable_info($options) {
|
11 |
|
|
// $variables = array('#type' => 'fieldset', 'title' => t('User registration settings'));
|
12 |
|
|
$variables['user_register'] = array(
|
13 |
|
|
'type' => 'select',
|
14 |
|
|
'title' => t('Public registrations'),
|
15 |
|
|
'default' => 1,
|
16 |
|
|
'options' => TRUE,
|
17 |
|
|
'options callback' => 'user_variable_option_list',
|
18 |
|
|
'group' => 'user_settings',
|
19 |
|
|
);
|
20 |
|
|
$variables['user_email_verification'] = array(
|
21 |
|
|
'type' => 'boolean',
|
22 |
|
|
'title' => t('Require e-mail verification when a visitor creates an account', array(), $options),
|
23 |
|
|
'default' => TRUE,
|
24 |
|
|
'description' => t('If this box is checked, new users will be required to validate their e-mail address prior to logging into the site, and will be assigned a system-generated password. With it unchecked, users will be logged in immediately upon registering, and may select their own passwords during registration.', array(), $options),
|
25 |
|
|
'group' => 'user_settings',
|
26 |
|
|
);
|
27 |
|
|
$variables['user_registration_help'] = array(
|
28 |
|
|
'type' => 'text',
|
29 |
|
|
'title' => t('User registration guidelines', array(), $options),
|
30 |
|
|
'default' => '',
|
31 |
|
|
'description' => t('This text is displayed at the top of the user registration form and is useful for helping or instructing your users.', array(), $options),
|
32 |
|
|
'group' => 'user_settings',
|
33 |
|
|
);
|
34 |
|
|
|
35 |
|
|
// User e-mail settings.
|
36 |
|
|
|
37 |
|
|
// These email tokens are shared for all settings, so just define
|
38 |
|
|
// the list once to help ensure they stay in sync.
|
39 |
|
|
$email_token_help = ' ' . t('Available variables are: [site:name], [site:url], [user:name], [user:mail], [site:login-url], [site:url-brief], [user:edit-url], [user:one-time-login-url], [user:cancel-url].', array(), $options);
|
40 |
|
|
|
41 |
|
|
$variables['user_mail_register_admin_created_[mail_part]'] = array(
|
42 |
|
|
'type' => 'user_mail',
|
43 |
|
|
'title' => t('Welcome, new user created by administrator', array(), $options),
|
44 |
|
|
'description' => t('Customize welcome e-mail messages sent to new member accounts created by an administrator.', array(), $options) . $email_token_help,
|
45 |
|
|
'group' => 'user_mails',
|
46 |
|
|
);
|
47 |
|
|
$variables['user_mail_register_no_approval_required_[mail_part]'] = array(
|
48 |
|
|
'type' => 'user_mail',
|
49 |
|
|
'title' => t('Welcome, no approval required', array(), $options),
|
50 |
|
|
'description' => t('Customize welcome e-mail messages sent to new members upon registering, when no administrator approval is required.', array(), $options) . $email_token_help,
|
51 |
|
|
'group' => 'user_mails',
|
52 |
|
|
);
|
53 |
|
|
$variables['user_mail_register_pending_approval_[mail_part]'] = array(
|
54 |
|
|
'type' => 'user_mail',
|
55 |
|
|
'title' => t('Welcome, awaiting administrator approval', array(), $options),
|
56 |
|
|
'description' => t('Customize welcome e-mail messages sent to new members upon registering, when administrative approval is required.', array(), $options) . $email_token_help,
|
57 |
|
|
'group' => 'user_mails',
|
58 |
|
|
);
|
59 |
|
|
$variables['user_mail_password_reset_[mail_part]'] = array(
|
60 |
|
|
'type' => 'user_mail',
|
61 |
|
|
'title' => t('Password recovery email'),
|
62 |
|
|
'description' => t('Customize e-mail messages sent to users who request a new password.') . $email_token_help,
|
63 |
|
|
'group' => 'user_mails',
|
64 |
|
|
);
|
65 |
|
|
$variables['user_mail_status_activated_[mail_part]'] = array(
|
66 |
|
|
'type' => 'user_mail',
|
67 |
|
|
'title' => t('Account activation email', array(), $options),
|
68 |
|
|
'description' => t('Enable and customize e-mail messages sent to users upon account activation (when an administrator activates an account of a user who has already registered, on a site where administrative approval is required).', array(), $options) . $email_token_help,
|
69 |
|
|
'group' => 'user_mails',
|
70 |
|
|
);
|
71 |
|
|
$variables['user_mail_status_activated_notify'] = array(
|
72 |
|
|
'type' => 'boolean',
|
73 |
|
|
'title' => t('Notify user when account is activated.', array(), $options),
|
74 |
|
|
'default' => TRUE,
|
75 |
|
|
'group' => 'user_settings',
|
76 |
|
|
);
|
77 |
|
|
$variables['user_mail_status_blocked_[mail_part]'] = array(
|
78 |
|
|
'type' => 'user_mail',
|
79 |
|
|
'title' => t('Account blocked email', array(), $options),
|
80 |
|
|
'description' => t('Enable and customize e-mail messages sent to users when their accounts are blocked.') . $email_token_help,
|
81 |
|
|
'group' => 'user_mails',
|
82 |
|
|
);
|
83 |
|
|
$variables['user_mail_status_blocked_notify'] = array(
|
84 |
|
|
'type' => 'boolean',
|
85 |
|
|
'title' => t('Notify user when account is blocked.', array(), $options),
|
86 |
|
|
'default' => FALSE,
|
87 |
|
|
'group' => 'user_settings',
|
88 |
|
|
);
|
89 |
|
|
$variables['user_mail_cancel_confirm_[mail_part]'] = array(
|
90 |
|
|
'type' => 'user_mail',
|
91 |
|
|
'title' => t('Account cancellation confirmation'),
|
92 |
|
|
'description' => t('Edit the e-mail messages sent to users when they attempt to cancel their accounts.', array(), $options) . $email_token_help,
|
93 |
|
|
'group' => 'user_mails',
|
94 |
|
|
);
|
95 |
|
|
$variables['user_mail_status_canceled_[mail_part]'] = array(
|
96 |
|
|
'type' => 'user_mail',
|
97 |
|
|
'title' => t('Account deleted email'),
|
98 |
|
|
'description' => t('Enable and customize e-mail messages sent to users when their accounts are deleted.', array(), $options) . $email_token_help,
|
99 |
|
|
'group' => 'user_mails',
|
100 |
|
|
);
|
101 |
|
|
$variables['user_mail_status_deleted_notify'] = array(
|
102 |
|
|
'type' => 'boolean',
|
103 |
|
|
'title' => t('Notify user when account is deleted.', array(), $options),
|
104 |
|
|
'default' => FALSE,
|
105 |
|
|
'group' => 'user_settings',
|
106 |
|
|
);
|
107 |
|
|
// User signatures.
|
108 |
|
|
$variables['user_signatures'] = array(
|
109 |
|
|
'type' => 'enable',
|
110 |
|
|
'title' => t('Signature support'),
|
111 |
|
|
'default' => 0,
|
112 |
|
|
'group' => 'user_settings',
|
113 |
|
|
);
|
114 |
|
|
|
115 |
|
|
// Picture support
|
116 |
|
|
$picture_support = variable_get('user_pictures', 0);
|
117 |
|
|
$form['user_pictures'] = array(
|
118 |
|
|
'type' => 'enable',
|
119 |
|
|
'title' => t('Picture support', array(), $options),
|
120 |
|
|
'default' => 0,
|
121 |
|
|
'group' => 'user_settings',
|
122 |
|
|
);
|
123 |
|
|
$variables['user_picture_path'] = array(
|
124 |
|
|
'type' => 'file_path',
|
125 |
|
|
'title' => t('Picture directory', array(), $options),
|
126 |
|
|
'default' => 'pictures',
|
127 |
|
|
'element' => array('#size' => 30, '#maxlength' => 255),
|
128 |
|
|
'description' => t('Subdirectory in the file upload directory where pictures will be stored.', array(), $options),
|
129 |
|
|
'group' => 'user_settings',
|
130 |
|
|
);
|
131 |
|
|
$variables['user_picture_default'] = array(
|
132 |
|
|
'type' => 'url',
|
133 |
|
|
'title' => t('Default picture', array(), $options),
|
134 |
|
|
'default' => '',
|
135 |
|
|
'description' => t('URL of picture to display for users with no custom picture selected. Leave blank for none.', array(), $options),
|
136 |
|
|
'group' => 'user_settings',
|
137 |
|
|
);
|
138 |
|
|
$variables['user_picture_dimensions'] = array(
|
139 |
|
|
'type' => 'string',
|
140 |
|
|
'title' => t('Picture maximum dimensions', array(), $options),
|
141 |
|
|
'default' => '85x85',
|
142 |
|
|
'description' => t('Maximum dimensions for pictures, in pixels.', array(), $options),
|
143 |
|
|
'element' => array('#size' => 15, '#maxlength' => 10),
|
144 |
|
|
'group' => 'user_settings',
|
145 |
|
|
);
|
146 |
|
|
$variables['user_picture_file_size'] = array(
|
147 |
|
|
'type' => 'number',
|
148 |
|
|
'title' => t('Picture maximum file size', array(), $options),
|
149 |
|
|
'default' => 30,
|
150 |
|
|
'description' => t('Maximum file size for pictures, in kB.', array(), $options),
|
151 |
|
|
'group' => 'user_settings',
|
152 |
|
|
);
|
153 |
|
|
$variables['user_picture_guidelines'] = array(
|
154 |
|
|
'type' => 'text',
|
155 |
|
|
'title' => t('Picture guidelines', array(), $options),
|
156 |
|
|
'default' => '',
|
157 |
|
|
'description' => t("This text is displayed at the picture upload form in addition to the default guidelines. It's useful for helping or instructing your users.", array(), $options),
|
158 |
|
|
'group' => 'user_settings',
|
159 |
|
|
);
|
160 |
|
|
|
161 |
|
|
return $variables;
|
162 |
|
|
}
|
163 |
|
|
|
164 |
|
|
/**
|
165 |
|
|
* Node module variable groups
|
166 |
|
|
*/
|
167 |
|
|
function user_variable_group_info() {
|
168 |
|
|
$groups['user_settings'] = array(
|
169 |
|
|
'title' => t('User settings'),
|
170 |
|
|
'description' => t('User settings'),
|
171 |
|
|
'access' => 'administer users',
|
172 |
|
|
'path' => 'admin/user/settings',
|
173 |
|
|
);
|
174 |
|
|
$groups['user_mails'] = array(
|
175 |
|
|
'title' => t('User emails'),
|
176 |
|
|
'description' => t('User emails'),
|
177 |
|
|
'access' => 'administer users',
|
178 |
|
|
'path' => 'admin/user/settings',
|
179 |
|
|
);
|
180 |
|
|
return $groups;
|
181 |
|
|
}
|
182 |
|
|
|
183 |
|
|
/**
|
184 |
|
|
* Implements hook_variable_type_info().
|
185 |
|
|
*/
|
186 |
|
|
function user_variable_type_info() {
|
187 |
|
|
$types['user_mail'] = array(
|
188 |
|
|
'title' => t('User mail text'),
|
189 |
|
|
'type' => 'mail_text',
|
190 |
|
|
'repeat' => array(
|
191 |
|
|
'default callback' => 'user_variable_mail_default',
|
192 |
|
|
),
|
193 |
|
|
);
|
194 |
|
|
return $types;
|
195 |
|
|
}
|
196 |
|
|
|
197 |
|
|
/**
|
198 |
|
|
* Default callback for user mail variables
|
199 |
|
|
*/
|
200 |
|
|
function user_variable_mail_default($variable, $options) {
|
201 |
|
|
// Remove 'user_mail_' prefix
|
202 |
|
|
$name = substr($variable['name'], 10);
|
203 |
|
|
return _user_mail_text($name, $options['language']);
|
204 |
|
|
}
|
205 |
|
|
|
206 |
|
|
/**
|
207 |
|
|
* Implements hook_variable_option_list().
|
208 |
|
|
*/
|
209 |
|
|
function user_variable_option_list($variable, $options = array()) {
|
210 |
|
|
switch ($variable['name']) {
|
211 |
|
|
case 'user_register':
|
212 |
|
|
return array(
|
213 |
|
|
t('Only site administrators can create new user accounts.', array(), $options),
|
214 |
|
|
t('Visitors can create accounts and no administrator approval is required.', array(), $options),
|
215 |
|
|
t('Visitors can create accounts but administrator approval is required.', array(), $options)
|
216 |
|
|
);
|
217 |
|
|
}
|
218 |
|
|
} |