-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.php
More file actions
49 lines (41 loc) · 1.46 KB
/
Copy pathinstall.php
File metadata and controls
49 lines (41 loc) · 1.46 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
<?php
// ----------------------------------------------------------------------
// This install file will be included by the module automatically
// at the first time that it is run. This file will take care of
// adding the custom user field "mod_user_avatar" to Phorum.
// This way, the administrator won't have to create the custom field
// manually.
// ----------------------------------------------------------------------
if(!defined("PHORUM")) return;
// No need to load this in 5.3.
if (file_exists('./include/api/custom_profile_fields.php')) {
require_once('./include/api/custom_profile_fields.php');
}
// See if we already have this field configured.
$existing = phorum_api_custom_profile_field_byname('mod_user_avatar');
// We have, but it is a deleted field.
// In this case restore the field and its data.
if (!empty($existing['deleted'])) {
phorum_api_custom_profile_field_restore($existing['id']);
$id = $existing['id'];
}
// Existing field.
elseif (!empty($existing)) {
$id = $existing['id'];
}
// New field.
else {
$id = NULL;
}
// Configure the field.
phorum_api_custom_profile_field_configure(array(
'id' => $id,
'name' => 'mod_user_avatar',
'length' => 65000, // since field is 65000+ in the database anyway
'html_disabled' => 0, // we need raw storage
));
// tell that the module has been installed
phorum_db_update_settings(array(
'mod_user_avatar' => array('mod_user_avatar_installed'=>1)
));
?>