-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhybridauth.admin.inc
More file actions
530 lines (499 loc) · 27.6 KB
/
Copy pathhybridauth.admin.inc
File metadata and controls
530 lines (499 loc) · 27.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
<?php
/**
* @file
* Administrative pages forms and functions for the HybridAuth module.
*/
function hybridauth_admin_settings() {
if (!variable_get('hybridauth_register', 0) && variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL) == USER_REGISTER_ADMINISTRATORS_ONLY) {
drupal_set_message(t('Currently only administrators can create new user accounts. Either change the "Who can register accounts?" option under "Account settings" tab or at the core <a href="!link">Account settings</a>.',
array('!link' => url('admin/config/people/accounts'))), 'warning');
}
$form = array();
$form['vtabs'] = array(
'#type' => 'vertical_tabs',
'#attached' => array(
'js' => array(drupal_get_path('module', 'hybridauth') . '/js/hybridauth.admin.js'),
),
);
$form['vtabs']['fset_providers'] = array(
'#type' => 'fieldset',
'#title' => t('Authentication providers'),
'#theme' => 'hybridauth_admin_settings_providers_table',
);
foreach (hybridauth_providers_list() as $provider_id => $provider_name) {
$form['vtabs']['fset_providers'][$provider_id]['icon'] = array(
'#theme' => 'hybridauth_provider_icon',
'#provider_id' => $provider_id,
'#icon_pack' => 'hybridauth_16',
);
$form['vtabs']['fset_providers'][$provider_id]['hybridauth_provider_' . $provider_id . '_enabled'] = array(
'#type' => 'checkbox',
'#title' => drupal_placeholder($provider_name),
'#default_value' => variable_get('hybridauth_provider_' . $provider_id . '_enabled', 0),
);
$form['vtabs']['fset_providers'][$provider_id]['file'] = array(
'#markup' => array_key_exists($provider_id, hybridauth_providers_files()) ? t('Yes') : t('No'),
);
$form['vtabs']['fset_providers'][$provider_id]['hybridauth_provider_' . $provider_id . '_weight'] = array(
'#type' => 'weight',
//'#title' => t('Weight'),
'#delta' => 20,
'#default_value' => variable_get('hybridauth_provider_' . $provider_id . '_weight', 0),
'#attributes' => array('class' => array('hybridauth-provider-weight')),
);
$form['vtabs']['fset_providers'][$provider_id]['settings'] = array(
'#type' => 'link',
'#title' => t('Settings'),
'#href' => 'admin/config/people/hybridauth/provider/' . $provider_id,
'#options' => array(
'query' => drupal_get_destination(),
),
);
}
$form['vtabs']['fset_fields'] = array(
'#type' => 'fieldset',
'#title' => t('Required fields'),
);
$form['vtabs']['fset_fields']['hybridauth_required_fields'] = array(
'#type' => 'checkboxes',
'#title' => t('Required fields'),
'#options' => array(
'email' => t('Email address'),
'firstName' => t('First name'),
'lastName' => t('Last name'),
'gender' => t('Gender'),
),
'#description' => t("Select required fields. If authentication provider doesn't return them, visitor will need to fill additional form with these fields before registration."),
'#default_value' => variable_get('hybridauth_required_fields', array('email' => 'email')),
);
$form['vtabs']['fset_widget'] = array(
'#type' => 'fieldset',
'#title' => t('Widget settings'),
);
$options = array(
'popup' => t('Use a popup window'),
'native' => t('Use the current window'),
);
$form['vtabs']['fset_widget']['hybridauth_window_type'] = array(
'#type' => 'radios',
'#title' => t('Authentication window type'),
'#options' => $options,
'#default_value' => variable_get('hybridauth_window_type', 'popup'),
);
$form['vtabs']['fset_widget']['hybridauth_widget_title'] = array(
'#type' => 'textfield',
'#title' => t('Widget title'),
'#default_value' => variable_get('hybridauth_widget_title', 'Or log in with...'),
);
$options = array(
'list' => t('Enabled providers icons'),
'button' => t('Single icon leading to a list of enabled providers'),
'link' => t('Link leading to a list of enabled providers'),
);
$form['vtabs']['fset_widget']['hybridauth_widget_type'] = array(
'#type' => 'radios',
'#title' => t('Widget type'),
'#options' => $options,
'#default_value' => variable_get('hybridauth_widget_type', 'list'),
);
$form['vtabs']['fset_widget']['hybridauth_widget_use_overlay'] = array(
'#type' => 'checkbox',
'#title' => t('Display list of enabled providers in an overlay'),
'#default_value' => variable_get('hybridauth_widget_use_overlay', 1),
'#states' => array(
'invisible' => array(
':input[name="hybridauth_widget_type"]' => array('value' => 'list'),
),
),
);
$form['vtabs']['fset_widget']['hybridauth_widget_link_text'] = array(
'#type' => 'textfield',
'#title' => t('Link text'),
'#default_value' => variable_get('hybridauth_widget_link_text', 'Social network account'),
'#states' => array(
'visible' => array(
':input[name="hybridauth_widget_type"]' => array('value' => 'link'),
),
),
);
$form['vtabs']['fset_widget']['hybridauth_widget_link_title'] = array(
'#type' => 'textfield',
'#title' => t('Link or icon title'),
'#default_value' => variable_get('hybridauth_widget_link_title', 'Social network account'),
'#states' => array(
'invisible' => array(
':input[name="hybridauth_widget_type"]' => array('value' => 'list'),
),
),
);
$options = array();
foreach (hybridauth_get_icon_packs() as $name => $icon_pack) {
$options[$name] = $icon_pack['title'];
}
$form['vtabs']['fset_widget']['hybridauth_widget_icon_pack'] = array(
'#type' => 'select',
'#title' => t('Icon package'),
'#options' => $options,
'#default_value' => variable_get('hybridauth_widget_icon_pack', 'hybridauth_32'),
);
$form['vtabs']['fset_widget']['hybridauth_widget_weight'] = array(
'#type' => 'weight',
'#title' => t('Widget weight'),
'#delta' => 100,
'#description' => t('Determines the order of the elements on the form - heavier elements get positioned later.'),
'#default_value' => variable_get('hybridauth_widget_weight', 100),
);
$form['vtabs']['fset_account'] = array(
'#type' => 'fieldset',
'#title' => t('Account settings'),
);
$core_settings = array(
USER_REGISTER_ADMINISTRATORS_ONLY => t('Administrators only'),
USER_REGISTER_VISITORS => t('Visitors'),
USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL => t('Visitors, but administrator approval is required'),
);
$form['vtabs']['fset_account']['hybridauth_register'] = array(
'#type' => 'radios',
'#title' => t('Who can register accounts?'),
'#options' => array(
0 => t('Follow core') . ': ' . $core_settings[variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)],
1 => t('Visitors'),
2 => t('Visitors, but administrator approval is required'),
),
'#description' => t('Select who can register accounts through HybridAuth.') . ' '
. t('The core settings are available at <a href="!link">Account settings</a>.',
array('!link' => url('admin/config/people/accounts'))),
'#default_value' => variable_get('hybridauth_register', 0),
);
$core_settings = array(
0 => t("Don't require e-mail verification"),
1 => t('Require e-mail verification'),
);
$form['vtabs']['fset_account']['hybridauth_email_verification'] = array(
'#type' => 'radios',
'#title' => t('E-mail verification'),
'#options' => array(
0 => t('Follow core') . ': ' . $core_settings[variable_get('user_email_verification', TRUE)],
1 => t('Require e-mail verification'),
2 => t("Don't require e-mail verification"),
),
'#description' => t('Select how to handle not verified e-mail addresses (authentication provider gives non-verified e-mail address).') . ' '
. t('The core settings are available at <a href="!link">Account settings</a>.',
array('!link' => url('admin/config/people/accounts'))),
'#default_value' => variable_get('hybridauth_email_verification', 0),
);
$form['vtabs']['fset_account']['hybridauth_pictures'] = array(
'#type' => 'checkbox',
'#title' => t('Save HybridAuth provided picture as user picture'),
'#description' => t('Save pictures provided by HybridAuth as user pictures. Check the "Enable user pictures" option at <a href="!link">Account settings</a> to make this option available.',
array('!link' => url('admin/config/people/accounts'))),
'#default_value' => variable_get('hybridauth_pictures', 1),
'#disabled' => !variable_get('user_pictures', 0),
);
$form['vtabs']['fset_account']['hybridauth_username'] = array(
'#type' => 'textfield',
'#title' => t('Username pattern'),
'#default_value' => variable_get('hybridauth_username', 'hybridauth_[user:hybridauth:provider]_[user:hybridauth:identifier]'),
'#description' => t('Create username for new users using this pattern; counter will be added in case of username conflict.') . ' '
. t('You should use only HybridAuth tokens here as the user is not created yet.') . ' '
. t('Install !link module to get list of all available tokens.',
array('!link' => l(t('Token'), 'http://drupal.org/project/token', array('attributes' => array('target' => '_blank'))))),
'#required' => TRUE,
);
$form['vtabs']['fset_account']['hybridauth_registration_username_change'] = array(
'#type' => 'checkbox',
'#title' => t('Allow username change when registering'),
'#description' => t('Allow users to change their username when registering through HybridAuth.'),
'#default_value' => variable_get('hybridauth_registration_username_change', 0),
);
$form['vtabs']['fset_account']['hybridauth_display_name'] = array(
'#type' => 'textfield',
'#title' => t('Display name pattern'),
'#default_value' => variable_get('hybridauth_display_name', '[user:hybridauth:firstName] [user:hybridauth:lastName]'),
'#description' => t('You can use any user tokens here.') . ' '
. t('Install !link module to get list of all available tokens.',
array('!link' => l(t('Token'), 'http://drupal.org/project/token', array('attributes' => array('target' => '_blank'))))),
'#required' => TRUE,
);
if (module_exists('token')) {
$form['vtabs']['fset_account']['fset_token'] = array(
'#type' => 'fieldset',
'#title' => t('Token'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['vtabs']['fset_account']['fset_token']['hybridauth_token_tree'] = array(
'#theme' => 'token_tree',
'#token_types' => array('user'),
'#global_types' => FALSE,
);
}
$form['vtabs']['fset_account']['hybridauth_override_realname'] = array(
'#type' => 'checkbox',
'#title' => t('Override Real name'),
'#description' => t('Override <a href="!link1">Real name settings</a> using the above display name pattern for users created by HybridAuth. This option is available only if !link2 module is installed.',
array('!link1' => url('admin/config/people/realname'),
'!link2' => l(t('Real name'), 'http://drupal.org/project/realname', array('attributes' => array('target' => '_blank'))))),
'#default_value' => variable_get('hybridauth_override_realname', 0),
'#disabled' => !module_exists('realname'),
);
$form['vtabs']['fset_account']['hybridauth_disable_username_change'] = array(
'#type' => 'checkbox',
'#title' => t('Disable username change'),
'#description' => t('Remove username field from user account edit form for users created by HybridAuth.'
. ' If this is unchecked then users should also have "Change own username" permission to actually be able to change the username.'),
'#default_value' => variable_get('hybridauth_disable_username_change', 1),
);
$form['vtabs']['fset_account']['hybridauth_remove_password_fields'] = array(
'#type' => 'checkbox',
'#title' => t('Remove password fields'),
'#description' => t('Remove password fields from user account edit form for users created by HybridAuth.'),
'#default_value' => variable_get('hybridauth_remove_password_fields', 1),
);
$form['vtabs']['fset_other'] = array(
'#type' => 'fieldset',
'#title' => t('Other settings'),
);
$form['vtabs']['fset_other']['hybridauth_destination'] = array(
'#type' => 'textfield',
'#title' => t('Redirect after login'),
'#default_value' => variable_get('hybridauth_destination', ''),
'#description' => t('Drupal path to redirect to, like "node/1". Leave empty to return to the same page.') . ' '
. t('You can use any user or global tokens here.') . ' '
. t('Install !link module to get list of all available tokens.',
array('!link' => l(t('Token'), 'http://drupal.org/project/token', array('attributes' => array('target' => '_blank'))))),
);
if (module_exists('token')) {
$form['vtabs']['fset_other']['fset_token'] = array(
'#type' => 'fieldset',
'#title' => t('Token'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['vtabs']['fset_other']['fset_token']['hybridauth_token_tree'] = array(
'#theme' => 'token_tree',
'#token_types' => array('user'),
'#global_types' => TRUE,
);
}
$form['vtabs']['fset_other']['hybridauth_forms'] = array(
'#type' => 'checkboxes',
'#title' => t('Drupal forms'),
'#options' => array(
'user_login' => t('User login form'),
'user_login_block' => t('User login block'),
'user_register_form' => t('User registration form'),
'comment_form' => t('Comment form'),
),
'#description' => t('Add default HybridAuth widget to these forms.'),
'#default_value' => variable_get('hybridauth_forms', array('user_login', 'user_login_block')),
);
$form['vtabs']['fset_other']['hybridauth_duplicate_emails'] = array(
'#type' => 'radios',
'#title' => t('Duplicate emails'),
'#options' => array(
0 => t('Allow duplicate email addresses, create new user account and login'),
1 => t("Don't allow duplicate email addresses, block registration and advise to login using the existing account"),
2 => t("Don't allow duplicate email addresses, add new identity to the existing account and login"),
),
'#default_value' => variable_get('hybridauth_duplicate_emails', 1),
'#description' => t('Select how to handle duplicate email addresses. This situation occurs when the same user is trying to authenticate using different authentication providers, but with the same email address.'),
);
$form['vtabs']['fset_other']['hybridauth_debug'] = array(
'#type' => 'checkbox',
'#title' => t('Debug mode'),
'#description' => t('When in debug mode, extra error information will be logged/displayed. This should be disabled when not in development.'),
'#default_value' => variable_get('hybridauth_debug', FALSE),
);
return system_settings_form($form);
}
/**
* Theme function for hybridauth_admin_settings() to render providers table.
*/
function theme_hybridauth_admin_settings_providers_table($vars) {
$form = $vars['form'];
$header = array(
array('data' => t('Name'), 'colspan' => 2),
t('Available'),
t('Weight'),
t('Operations'),
);
$rows = array();
foreach (element_children($form) as $provider_id) {
if (isset($form[$provider_id]['icon'])) {
$row = array(
drupal_render($form[$provider_id]['hybridauth_provider_' . $provider_id . '_enabled']),
drupal_render($form[$provider_id]['icon']),
drupal_render($form[$provider_id]['file']),
drupal_render($form[$provider_id]['hybridauth_provider_' . $provider_id . '_weight']),
drupal_render($form[$provider_id]['settings']),
);
$rows[] = array(
'data' => $row,
'class' => array('draggable'),
);
}
}
//Finally, output the sortable table. Make sure the id variable is the same as the table id in drupal_add_tabledrag
$output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'hybridauth-providers')));
$output .= drupal_render_children($form);
//This function is the instantiator of the sorter. Make sure the 0th paramater is the id of your table, and the 3rd paramater is the class of your weight variable
drupal_add_tabledrag('hybridauth-providers', 'order', 'sibling', 'hybridauth-provider-weight');
return $output;
}
function hybridauth_admin_provider_settings($form, &$form_state, $provider_id = NULL) {
$form = array();
switch ($provider_id) {
case 'Facebook':
$help = t('
<p>Enter your application ID and private key. You can get these by creating a new application at <a href="!apps_uri">!apps_uri</a>.</p>
<p>You must set <strong>App Domain</strong> to something like <strong>example.com</strong> to cover <strong>*.example.com</strong>.</p>
<p>You must set <strong>Site URL</strong> to <strong>%site_uri</strong>.</p>
',
array(
'!apps_uri' => 'https://developers.facebook.com/apps',
'%site_uri' => url('<front>', array('absolute' => TRUE)),
)
);
break;
case 'Twitter':
$help = t('
<p>Enter your consumer key and private key. You can get these by creating a new application at <a href="!apps_uri">!apps_uri</a>.</p>
',
array(
'!apps_uri' => 'https://dev.twitter.com/apps',
)
);
break;
case 'Google':
$origin_uri_parts = parse_url( url('<front>', array('absolute' => TRUE)) );
$help = t('
<p>Enter your application ID and private key. You can get these by creating a new application at <a href="!apps_uri">!apps_uri</a>.</p>
<p>You must set <strong>Authorized Redirect URIs</strong> to <strong>%redirect_uri</strong>.</p>
<p>You must set <strong>Authorized JavaScript Origins</strong> to <strong>%origin_uri</strong>.</p>
',
array(
'!apps_uri' => 'https://code.google.com/apis/console#access',
'%redirect_uri' => url('hybridauth/endpoint', array('absolute' => TRUE, 'query' => array('hauth.done' => 'Google'))),
'%origin_uri' => $origin_uri_parts['scheme'] . '://' . $origin_uri_parts['host'],
)
);
break;
default:
$help = t('Enter the application ID, consumer key, and/or secret key as required.');
break;
}
$form['keys'] = array(
'#type' => 'fieldset',
'#description' => $help,
);
$form['keys']['hybridauth_provider_' . $provider_id . '_keys_id'] = array(
'#type' => 'textfield',
'#title' => t('Application ID'),
'#description' => t('The application ID'),
'#default_value' => variable_get('hybridauth_provider_' . $provider_id . '_keys_id', ''),
);
$form['keys']['hybridauth_provider_' . $provider_id . '_keys_key'] = array(
'#type' => 'textfield',
'#title' => t('Application consumer key'),
'#description' => t('The Application consumer key'),
'#default_value' => variable_get('hybridauth_provider_' . $provider_id . '_keys_key', ''),
);
$form['keys']['hybridauth_provider_' . $provider_id . '_keys_secret'] = array(
'#type' => 'textfield',
'#title' => t('Application consumer secret'),
'#description' => t('The application consumer secret key'),
'#default_value' => variable_get('hybridauth_provider_' . $provider_id . '_keys_secret', ''),
);
if (in_array($provider_id, array('LinkedIn', 'MySpace', 'Twitter', 'Yahoo'))) {
unset($form['keys']['hybridauth_provider_' . $provider_id . '_keys_id']);
}
if (in_array($provider_id, array('Facebook', 'Google', 'Live', 'Vkontakte'))) {
unset($form['keys']['hybridauth_provider_' . $provider_id . '_keys_key']);
}
if (in_array($provider_id, array('Facebook'))) {
$form['advanced'] = array(
'#type' => 'fieldset',
'#title' => 'Advanced settings',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['advanced']['hybridauth_provider_' . $provider_id . '_scope'] = array(
'#type' => 'checkboxes',
'#title' => t('Scope - Permissions to request by default'),
'#default_value' => variable_get('hybridauth_provider_' . $provider_id . '_scope', array(
'email', 'user_about_me', 'user_birthday', 'user_hometown', 'user_website', 'offline_access',
)),
'#options' => array(
// See http://developers.facebook.com/docs/reference/api/permissions/
// Regular permissions
'user_about_me' => t('<strong>user_about_me</strong> -- Provides access to the "About Me" section of the profile in the about property'),
'user_activities' => t('<strong>user_activities</strong> -- Provides access to the user\'s list of activities as the activities connection'),
'user_birthday' => t('<strong>user_birthday</strong> -- Provides access to the birthday with year as the birthday_date property'),
'user_checkins' => t('<strong>user_checkins</strong> -- Provides read access to the authorized user\'s check-ins that the user can see.'),
'user_education_history' => t('<strong>user_education_history</strong> -- Provides access to education history as the education property'),
'user_events' => t('<strong>user_events</strong> -- Provides access to the list of events the user is attending as the events connection'),
'user_groups' => t('<strong>user_groups</strong> -- Provides access to the list of groups the user is a member of as the groups connection'),
'user_hometown' => t('<strong>user_hometown</strong> -- Provides access to the user\'s hometown in the hometown property'),
'user_interests' => t('<strong>user_interests</strong> -- Provides access to the user\'s list of interests as the interests connection'),
'user_likes' => t('<strong>user_likes</strong> -- Provides access to the list of all of the pages the user has liked as the likes connection'),
'user_location' => t('<strong>user_location</strong> -- Provides access to the user\'s current location as the location property'),
'user_notes' => t('<strong>user_notes</strong> -- Provides access to the user\'s notes as the notes connection'),
'user_online_presence' => t('<strong>user_online_presence</strong> -- Provides access to the user\'s online/offline presence'),
'user_photos' => t('<strong>user_photos</strong> -- Provides access to the photos the user has uploaded, and photos the user has been tagged in'),
'user_questions' => t('<strong>user_questions</strong> -- Provides access to the questions the user or friend has asked'),
'user_relationships' => t('<strong>user_relationships</strong> -- Provides access to the user\'s family and personal relationships and relationship status'),
'user_relationship_details' => t('<strong>user_relationship_details</strong> -- Provides access to the user\'s relationship preferences'),
'user_religion_politics' => t('<strong>user_religion_politics</strong> -- Provides access to the user\'s religious and political affiliations'),
'user_status' => t('<strong>user_status</strong> -- Provides access to the user\'s most recent status message'),
'user_videos' => t('<strong>user_videos</strong> -- Provides access to the videos the user has uploaded, and videos the user has been tagged in'),
'user_website' => t('<strong>user_website</strong> -- Provides access to the user\'s web site URL'),
'user_work_history' => t('<strong>user_work_history</strong> -- Provides access to work history as the work property'),
'email' => t('<strong>email</strong> -- Provides access to the user\'s primary email address in the email property. Do not spam users. Your use of email must comply both with Facebook policies and with the CAN-SPAM Act.'),
// Extended permissions
'read_friendlists' => t('<strong>read_friendlists</strong> -- Provides access to any friend lists the user created. All user\'s friends are provided as part of basic data, this extended permission grants access to the lists of friends a user has created, and should only be requested if your application utilizes lists of friends.'),
'read_insights' => t('<strong>read_insights</strong> -- Provides read access to the Insights data for pages, applications, and domains the user owns.'),
'read_mailbox' => t('<strong>read_mailbox</strong> -- Provides the ability to read from a user\'s Facebook Inbox.'),
'read_requests' => t('<strong>read_requests</strong> -- Provides read access to the user\'s friend requests'),
'read_stream' => t('<strong>read_stream</strong> -- Provides access to all the posts in the user\'s News Feed and enables your application to perform searches against the user\'s News Feed'),
'xmpp_login' => t('<strong>xmpp_login</strong> -- Provides applications that integrate with Facebook Chat the ability to log in users.'),
'ads_management' => t('<strong>ads_management</strong> -- Provides the ability to manage ads and call the Facebook Ads API on behalf of a user.'),
'create_event' => t('<strong>create_event</strong> -- Enables your application to create and modify events on the user\'s behalf'),
'manage_friendlists' => t('<strong>manage_friendlists</strong> -- Enables your app to create and edit the user\'s friend lists.'),
'manage_notifications' => t('<strong>manage_notifications</strong> -- Enables your app to read notifications and mark them as read. This permission will be required to all access to notifications after October 22, 2011.'),
'offline_access' => t('<strong>offline_access</strong> -- Enables your app to perform authorized requests on behalf of the user at any time. By default, most access tokens expire after a short time period to ensure applications only make requests on behalf of the user when the are actively using the application. This permission makes the access token returned by our OAuth endpoint long-lived.'),
'publish_checkins' => t('<strong>publish_checkins</strong> -- Enables your app to perform checkins on behalf of the user.'),
'publish_stream' => t('<strong>publish_stream</strong> -- Enables your app to post content, comments, and likes to a user\'s stream and to the streams of the user\'s friends. With this permission, you can publish content to a user\'s feed at any time, without requiring offline_access. However, please note that Facebook recommends a user-initiated sharing model.'),
'rsvp_event' => t('<strong>rsvp_event</strong> -- Enables your application to RSVP to events on the user\'s behalf'),
'sms' => t('<strong>sms</strong> -- Enables your application to send messages to the user and respond to messages from the user via text message'),
'publish_actions' => t('<strong>publish_actions</strong> -- Enables your application to publish user scores and achievements.'),
),
);
}
return system_settings_form($form);
}
function hybridauth_report() {
$providers = hybridauth_providers_list();
$header = array(t('Authentication provider'), t('Users count'));
$rows = array();
$query = db_select('hybridauth_identity', 'ha_id');
$query->addField('ha_id', 'provider', 'provider');
$query->addExpression('COUNT(provider_identifier)', 'count');
$query->groupBy('provider');
$results = $query
->execute()
->fetchAllAssoc('provider', PDO::FETCH_ASSOC);
foreach ($results as $result) {
$rows[] = array(
$providers[$result['provider']],
$result['count'],
);
}
$form = array();
$form['report'] = array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
);
return $form;
}