-
Notifications
You must be signed in to change notification settings - Fork 3
/
qa-user-profile-admin.php
47 lines (40 loc) · 1.03 KB
/
qa-user-profile-admin.php
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
<?php
class qa_user_profile_admin {
function option_default($option) {
switch($option) {
case 'qa_user_profile_max_length':
return 80;
default:
return null;
}
}
function allow_template($template) {
return ($template != 'admin');
}
function admin_form(&$qa_content){
// process the admin form if admin hit Save-Changes-button
$ok = null;
if (qa_clicked('qa_user_profile_save')) {
qa_opt('qa_user_profile_max_length', qa_post_text('qa_user_profile_max_length'));
$ok = qa_lang('admin/options_saved');
}
// form fields to display frontend for admin
$fields = array();
$fields[] = array(
'label' => 'Profile Max Length: ',
'type' => 'number',
'value' => (int)qa_opt('qa_user_profile_max_length'),
'tags' => 'name="qa_user_profile_max_length"',
);
return array(
'ok' => ($ok && !isset($error)) ? $ok : null,
'fields' => $fields,
'buttons' => array(
array(
'label' => qa_lang_html('main/save_button'),
'tags' => 'name="qa_user_profile_save"',
),
),
);
}
}