|
1 <?php |
|
2 // $Id: profile.install,v 1.12.2.1 2009/01/06 15:46:37 goba Exp $ |
|
3 |
|
4 /** |
|
5 * Implementation of hook_install(). |
|
6 */ |
|
7 function profile_install() { |
|
8 // Create tables. |
|
9 drupal_install_schema('profile'); |
|
10 } |
|
11 |
|
12 /** |
|
13 * Implementation of hook_uninstall(). |
|
14 */ |
|
15 function profile_uninstall() { |
|
16 // Remove tables |
|
17 drupal_uninstall_schema('profile'); |
|
18 |
|
19 variable_del('profile_block_author_fields'); |
|
20 } |
|
21 |
|
22 /** |
|
23 * Implementation of hook_schema(). |
|
24 */ |
|
25 function profile_schema() { |
|
26 $schema['profile_fields'] = array( |
|
27 'description' => 'Stores profile field information.', |
|
28 'fields' => array( |
|
29 'fid' => array( |
|
30 'type' => 'serial', |
|
31 'not null' => TRUE, |
|
32 'description' => 'Primary Key: Unique profile field ID.', |
|
33 ), |
|
34 'title' => array( |
|
35 'type' => 'varchar', |
|
36 'length' => 255, |
|
37 'not null' => FALSE, |
|
38 'description' => 'Title of the field shown to the end user.', |
|
39 ), |
|
40 'name' => array( |
|
41 'type' => 'varchar', |
|
42 'length' => 128, |
|
43 'not null' => TRUE, |
|
44 'default' => '', |
|
45 'description' => 'Internal name of the field used in the form HTML and URLs.', |
|
46 ), |
|
47 'explanation' => array( |
|
48 'type' => 'text', |
|
49 'not null' => FALSE, |
|
50 'description' => 'Explanation of the field to end users.', |
|
51 ), |
|
52 'category' => array( |
|
53 'type' => 'varchar', |
|
54 'length' => 255, |
|
55 'not null' => FALSE, |
|
56 'description' => 'Profile category that the field will be grouped under.', |
|
57 ), |
|
58 'page' => array( |
|
59 'type' => 'varchar', |
|
60 'length' => 255, |
|
61 'not null' => FALSE, |
|
62 'description' => "Title of page used for browsing by the field's value", |
|
63 ), |
|
64 'type' => array( |
|
65 'type' => 'varchar', |
|
66 'length' => 128, |
|
67 'not null' => FALSE, |
|
68 'description' => 'Type of form field.', |
|
69 ), |
|
70 'weight' => array( |
|
71 'type' => 'int', |
|
72 'not null' => TRUE, |
|
73 'default' => 0, |
|
74 'size' => 'tiny', |
|
75 'description' => 'Weight of field in relation to other profile fields.', |
|
76 ), |
|
77 'required' => array( |
|
78 'type' => 'int', |
|
79 'not null' => TRUE, |
|
80 'default' => 0, |
|
81 'size' => 'tiny', |
|
82 'description' => 'Whether the user is required to enter a value. (0 = no, 1 = yes)', |
|
83 ), |
|
84 'register' => array( |
|
85 'type' => 'int', |
|
86 'not null' => TRUE, |
|
87 'default' => 0, |
|
88 'size' => 'tiny', |
|
89 'description' => 'Whether the field is visible in the user registration form. (1 = yes, 0 = no)', |
|
90 ), |
|
91 'visibility' => array( |
|
92 'type' => 'int', |
|
93 'not null' => TRUE, |
|
94 'default' => 0, |
|
95 'size' => 'tiny', |
|
96 '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)', |
|
97 ), |
|
98 'autocomplete' => array( |
|
99 'type' => 'int', |
|
100 'not null' => TRUE, |
|
101 'default' => 0, |
|
102 'size' => 'tiny', |
|
103 'description' => 'Whether form auto-completion is enabled. (0 = disabled, 1 = enabled)', |
|
104 ), |
|
105 'options' => array( |
|
106 'type' => 'text', |
|
107 'not null' => FALSE, |
|
108 'description' => 'List of options to be used in a list selection field.', |
|
109 ), |
|
110 ), |
|
111 'indexes' => array('category' => array('category')), |
|
112 'unique keys' => array('name' => array('name')), |
|
113 'primary key' => array('fid'), |
|
114 ); |
|
115 |
|
116 $schema['profile_values'] = array( |
|
117 'description' => 'Stores values for profile fields.', |
|
118 'fields' => array( |
|
119 'fid' => array( |
|
120 'type' => 'int', |
|
121 'unsigned' => TRUE, |
|
122 'not null' => TRUE, |
|
123 'default' => 0, |
|
124 'description' => 'The {profile_fields}.fid of the field.', |
|
125 ), |
|
126 'uid' => array( |
|
127 'type' => 'int', |
|
128 'unsigned' => TRUE, |
|
129 'not null' => TRUE, |
|
130 'default' => 0, |
|
131 'description' => 'The {users}.uid of the profile user.', |
|
132 ), |
|
133 'value' => array( |
|
134 'type' => 'text', |
|
135 'not null' => FALSE, |
|
136 'description' => 'The value for the field.', |
|
137 ), |
|
138 ), |
|
139 'primary key' => array('uid', 'fid'), |
|
140 'indexes' => array( |
|
141 'fid' => array('fid'), |
|
142 ), |
|
143 ); |
|
144 |
|
145 return $schema; |
|
146 } |
|
147 |