comparison modules/profile/profile.install @ 1:c1f4ac30525a 6.0

Drupal 6.0
author Franck Deroche <webmaster@defr.org>
date Tue, 23 Dec 2008 14:28:28 +0100
parents
children 3edae6ecd6c6
comparison
equal deleted inserted replaced
0:5a113a1c4740 1:c1f4ac30525a
1 <?php
2 // $Id: profile.install,v 1.12 2007/12/18 12:59:22 dries 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' => t('Stores profile field information.'),
28 'fields' => array(
29 'fid' => array(
30 'type' => 'serial',
31 'not null' => TRUE,
32 'description' => t('Primary Key: Unique profile field ID.'),
33 ),
34 'title' => array(
35 'type' => 'varchar',
36 'length' => 255,
37 'not null' => FALSE,
38 'description' => t('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' => t('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' => t('Explanation of the field to end users.'),
51 ),
52 'category' => array(
53 'type' => 'varchar',
54 'length' => 255,
55 'not null' => FALSE,
56 'description' => t('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' => t("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' => t('Type of form field.'),
69 ),
70 'weight' => array(
71 'type' => 'int',
72 'not null' => TRUE,
73 'default' => 0,
74 'size' => 'tiny',
75 'description' => t('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' => t('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' => t('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' => t('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' => t('Whether form auto-completion is enabled. (0 = disabled, 1 = enabled)'),
104 ),
105 'options' => array(
106 'type' => 'text',
107 'not null' => FALSE,
108 'description' => t('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' => t('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' => t('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' => t('The {users}.uid of the profile user.'),
132 ),
133 'value' => array(
134 'type' => 'text',
135 'not null' => FALSE,
136 'description' => t('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