1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Install, update and uninstall functions for the profile module.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* Implements hook_uninstall().
|
10 |
|
|
*/
|
11 |
|
|
function profile_uninstall() {
|
12 |
|
|
variable_del('profile_block_author_fields');
|
13 |
|
|
}
|
14 |
|
|
|
15 |
|
|
/**
|
16 |
|
|
* Implements hook_schema().
|
17 |
|
|
*/
|
18 |
|
|
function profile_schema() {
|
19 |
|
|
$schema['profile_field'] = array(
|
20 |
|
|
'description' => 'Stores profile field information.',
|
21 |
|
|
'fields' => array(
|
22 |
|
|
'fid' => array(
|
23 |
|
|
'type' => 'serial',
|
24 |
|
|
'not null' => TRUE,
|
25 |
|
|
'description' => 'Primary Key: Unique profile field ID.',
|
26 |
|
|
),
|
27 |
|
|
'title' => array(
|
28 |
|
|
'type' => 'varchar',
|
29 |
|
|
'length' => 255,
|
30 |
|
|
'not null' => FALSE,
|
31 |
|
|
'description' => 'Title of the field shown to the end user.',
|
32 |
|
|
),
|
33 |
|
|
'name' => array(
|
34 |
|
|
'type' => 'varchar',
|
35 |
|
|
'length' => 128,
|
36 |
|
|
'not null' => TRUE,
|
37 |
|
|
'default' => '',
|
38 |
|
|
'description' => 'Internal name of the field used in the form HTML and URLs.',
|
39 |
|
|
),
|
40 |
|
|
'explanation' => array(
|
41 |
|
|
'type' => 'text',
|
42 |
|
|
'not null' => FALSE,
|
43 |
|
|
'description' => 'Explanation of the field to end users.',
|
44 |
|
|
),
|
45 |
|
|
'category' => array(
|
46 |
|
|
'type' => 'varchar',
|
47 |
|
|
'length' => 255,
|
48 |
|
|
'not null' => FALSE,
|
49 |
|
|
'description' => 'Profile category that the field will be grouped under.',
|
50 |
|
|
),
|
51 |
|
|
'page' => array(
|
52 |
|
|
'type' => 'varchar',
|
53 |
|
|
'length' => 255,
|
54 |
|
|
'not null' => FALSE,
|
55 |
|
|
'description' => "Title of page used for browsing by the field's value",
|
56 |
|
|
),
|
57 |
|
|
'type' => array(
|
58 |
|
|
'type' => 'varchar',
|
59 |
|
|
'length' => 128,
|
60 |
|
|
'not null' => FALSE,
|
61 |
|
|
'description' => 'Type of form field.',
|
62 |
|
|
),
|
63 |
|
|
'weight' => array(
|
64 |
|
|
'type' => 'int',
|
65 |
|
|
'not null' => TRUE,
|
66 |
|
|
'default' => 0,
|
67 |
|
|
'description' => 'Weight of field in relation to other profile fields.',
|
68 |
|
|
),
|
69 |
|
|
'required' => array(
|
70 |
|
|
'type' => 'int',
|
71 |
|
|
'not null' => TRUE,
|
72 |
|
|
'default' => 0,
|
73 |
|
|
'size' => 'tiny',
|
74 |
|
|
'description' => 'Whether the user is required to enter a value. (0 = no, 1 = yes)',
|
75 |
|
|
),
|
76 |
|
|
'register' => array(
|
77 |
|
|
'type' => 'int',
|
78 |
|
|
'not null' => TRUE,
|
79 |
|
|
'default' => 0,
|
80 |
|
|
'size' => 'tiny',
|
81 |
|
|
'description' => 'Whether the field is visible in the user registration form. (1 = yes, 0 = no)',
|
82 |
|
|
),
|
83 |
|
|
'visibility' => array(
|
84 |
|
|
'type' => 'int',
|
85 |
|
|
'not null' => TRUE,
|
86 |
|
|
'default' => 0,
|
87 |
|
|
'size' => 'tiny',
|
88 |
|
|
'description' => 'The level of visibility for the field. (0 = hidden, 1 = private, 2 = public on profile but not member list pages, 3 = public on profile and list pages)',
|
89 |
|
|
),
|
90 |
|
|
'autocomplete' => array(
|
91 |
|
|
'type' => 'int',
|
92 |
|
|
'not null' => TRUE,
|
93 |
|
|
'default' => 0,
|
94 |
|
|
'size' => 'tiny',
|
95 |
|
|
'description' => 'Whether form auto-completion is enabled. (0 = disabled, 1 = enabled)',
|
96 |
|
|
),
|
97 |
|
|
'options' => array(
|
98 |
|
|
'type' => 'text',
|
99 |
|
|
'not null' => FALSE,
|
100 |
|
|
'description' => 'List of options to be used in a list selection field.',
|
101 |
|
|
),
|
102 |
|
|
),
|
103 |
|
|
'indexes' => array(
|
104 |
|
|
'category' => array('category'),
|
105 |
|
|
),
|
106 |
|
|
'unique keys' => array(
|
107 |
|
|
'name' => array('name'),
|
108 |
|
|
),
|
109 |
|
|
'primary key' => array('fid'),
|
110 |
|
|
);
|
111 |
|
|
|
112 |
|
|
$schema['profile_value'] = array(
|
113 |
|
|
'description' => 'Stores values for profile fields.',
|
114 |
|
|
'fields' => array(
|
115 |
|
|
'fid' => array(
|
116 |
|
|
'type' => 'int',
|
117 |
|
|
'unsigned' => TRUE,
|
118 |
|
|
'not null' => TRUE,
|
119 |
|
|
'default' => 0,
|
120 |
|
|
'description' => 'The {profile_field}.fid of the field.',
|
121 |
|
|
),
|
122 |
|
|
'uid' => array(
|
123 |
|
|
'type' => 'int',
|
124 |
|
|
'unsigned' => TRUE,
|
125 |
|
|
'not null' => TRUE,
|
126 |
|
|
'default' => 0,
|
127 |
|
|
'description' => 'The {users}.uid of the profile user.',
|
128 |
|
|
),
|
129 |
|
|
'value' => array(
|
130 |
|
|
'type' => 'text',
|
131 |
|
|
'not null' => FALSE,
|
132 |
|
|
'description' => 'The value for the field.',
|
133 |
|
|
),
|
134 |
|
|
),
|
135 |
|
|
'primary key' => array('uid', 'fid'),
|
136 |
|
|
'indexes' => array(
|
137 |
|
|
'fid' => array('fid'),
|
138 |
|
|
),
|
139 |
|
|
'foreign keys' => array(
|
140 |
|
|
'profile_field' => array(
|
141 |
|
|
'table' => 'profile_field',
|
142 |
|
|
'columns' => array('fid' => 'fid'),
|
143 |
|
|
),
|
144 |
|
|
'profile_user' => array(
|
145 |
|
|
'table' => 'users',
|
146 |
|
|
'columns' => array('uid' => 'uid'),
|
147 |
|
|
),
|
148 |
|
|
),
|
149 |
|
|
);
|
150 |
|
|
|
151 |
|
|
return $schema;
|
152 |
|
|
}
|
153 |
|
|
|
154 |
|
|
/**
|
155 |
|
|
* Rename {profile_fields} table to {profile_field} and {profile_values} to {profile_value}.
|
156 |
|
|
*/
|
157 |
|
|
function profile_update_7001() {
|
158 |
|
|
db_rename_table('profile_fields', 'profile_field');
|
159 |
|
|
db_rename_table('profile_values', 'profile_value');
|
160 |
|
|
}
|
161 |
|
|
|
162 |
|
|
/**
|
163 |
|
|
* Change the weight column to normal int.
|
164 |
|
|
*/
|
165 |
|
|
function profile_update_7002() {
|
166 |
|
|
db_change_field('profile_field', 'weight', 'weight', array(
|
167 |
|
|
'type' => 'int',
|
168 |
|
|
'not null' => TRUE,
|
169 |
|
|
'default' => 0,
|
170 |
|
|
'description' => 'Weight of field in relation to other profile fields.',
|
171 |
|
|
));
|
172 |
|
|
} |