Merge lp:~quam-plures-core/quam-plures/shared_plugin_fields_1 into lp:quam-plures

Proposed by EdB
Status: Merged
Merged at revision: not available
Proposed branch: lp:~quam-plures-core/quam-plures/shared_plugin_fields_1
Merge into: lp:quam-plures
Diff against target: 825 lines (+134/-436)
10 files modified
htsrv/profile_update.php (+0/-8)
inc/_core/__core.init.php (+4/-4)
inc/_core/model/__core.install.php (+41/-33)
inc/users/model/_user.class.php (+0/-222)
inc/users/users.ctrl.php (+5/-56)
inc/users/views/_user.form.php (+0/-23)
install/_functions_create.php (+29/-29)
install/_functions_evoupgrade.php (+55/-45)
templates/_profile.disp.php (+0/-4)
templates/_user.disp.php (+0/-12)
To merge this branch: bzr merge lp:~quam-plures-core/quam-plures/shared_plugin_fields_1
Reviewer Review Type Date Requested Status
Yabs (community) Approve
Review via email: mp+21154@code.launchpad.net

Commit message

shared plugin fields step 1

Description of the change

See http://forums.quamplures.net/viewtopic.php?f=9&t=271 for details, but basically this gets rid of the remaining tidbits from the "experimental user fields" including the two tables, gets rid of the never-used bits in a user's profile (aim, yim, so forth), and creates 2 new tables that will (hopefully!) allow plugins to share fields instead of making each blogger enter in the same info twice.

To post a comment you must log in.
Revision history for this message
Yabs (yabs) wrote :

Looks good to me.

Can I leave it to you to merge in as I've had a looooong day digging footings and I'm off for a beer ;)

¥

review: Approve
Revision history for this message
EdB (edb) wrote :

Have a shot on my behalf :)

I'll get it merged today (local time day) unless someone else code reviews and finds an issue ... other than it doesn't actually do anything yet.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'htsrv/profile_update.php'
2--- htsrv/profile_update.php 2010-01-02 08:34:34 +0000
3+++ htsrv/profile_update.php 2010-03-11 16:10:29 +0000
4@@ -48,10 +48,6 @@
5 param( 'newuser_nickname', 'string', '' );
6 param( 'newuser_idmode', 'string', '' );
7 param( 'newuser_locale', 'string', $default_locale );
8-param( 'newuser_icq', 'string', '' );
9-param( 'newuser_aim', 'string', '' );
10-param( 'newuser_msn', 'string', '' );
11-param( 'newuser_yim', 'string', '' );
12 param( 'newuser_url', 'string', '' );
13 param( 'newuser_email', 'string', '' );
14 param( 'newuser_allow_msgform', 'integer', 0 ); // checkbox
15@@ -114,12 +110,8 @@
16 $current_User->set( 'firstname', $newuser_firstname );
17 $current_User->set( 'lastname', $newuser_lastname );
18 $current_User->set( 'nickname', $newuser_nickname );
19-$current_User->set( 'icq', $newuser_icq );
20 $current_User->set_email( $newuser_email );
21 $current_User->set( 'url', $newuser_url );
22-$current_User->set( 'aim', $newuser_aim );
23-$current_User->set( 'msn', $newuser_msn );
24-$current_User->set( 'yim', $newuser_yim );
25 $current_User->set( 'idmode', $newuser_idmode );
26 $current_User->set( 'locale', $newuser_locale );
27 $current_User->set( 'allow_msgform', $newuser_allow_msgform );
28
29=== modified file 'inc/_core/__core.init.php'
30--- inc/_core/__core.init.php 2010-03-06 16:19:45 +0000
31+++ inc/_core/__core.init.php 2010-03-11 16:10:29 +0000
32@@ -64,12 +64,12 @@
33 'T_pluginusersettings' => $tableprefix.'pluginusersettings',
34 'T_postcats' => $tableprefix.'postcats',
35 'T_settings' => $tableprefix.'settings',
36- 'T_templates__container' => $tableprefix.'templates__container',
37- 'T_templates__template' => $tableprefix.'templates__template',
38+ 'T_templates__container' => $tableprefix.'templates__container',
39+ 'T_templates__template' => $tableprefix.'templates__template',
40 'T_subscriptions' => $tableprefix.'subscriptions',
41 'T_users' => $tableprefix.'users',
42- 'T_users__fielddefs' => $tableprefix.'users__fielddefs',
43- 'T_users__fields' => $tableprefix.'users__fields',
44+ 'T_plugin_sharedfields' => $tableprefix.'plugin_sharedfields',
45+ 'T_plugin_sharedvalues' => $tableprefix.'plugin_sharedvalues',
46 'T_usersettings' => $tableprefix.'usersettings',
47 'T_widget' => $tableprefix.'widget',
48 );
49
50=== modified file 'inc/_core/model/__core.install.php'
51--- inc/_core/model/__core.install.php 2010-01-02 08:34:34 +0000
52+++ inc/_core/model/__core.install.php 2010-03-11 16:10:29 +0000
53@@ -90,7 +90,6 @@
54 user_firstname varchar(50) NULL,
55 user_lastname varchar(50) NULL,
56 user_nickname varchar(50) NULL,
57- user_icq int(11) unsigned NULL,
58 user_email varchar(255) NOT NULL,
59 user_url varchar(255) NULL,
60 user_ip varchar(15) NULL,
61@@ -98,9 +97,6 @@
62 user_browser varchar(200) NULL,
63 dateYMDhour datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
64 user_level int unsigned DEFAULT 0 NOT NULL,
65- user_aim varchar(50) NULL,
66- user_msn varchar(100) NULL,
67- user_yim varchar(50) NULL,
68 user_locale varchar(20) DEFAULT 'en-EU' NOT NULL,
69 user_idmode varchar(20) NOT NULL DEFAULT 'login',
70 user_allow_msgform TINYINT NOT NULL DEFAULT '1',
71@@ -108,31 +104,11 @@
72 user_showonline tinyint(1) NOT NULL default 1,
73 user_grp_ID int(4) NOT NULL default 1,
74 user_validated tinyint(1) NOT NULL DEFAULT 0,
75- user_avatar_file_ID int(10) unsigned default NULL,
76 PRIMARY KEY user_ID (user_ID),
77 UNIQUE user_login (user_login),
78 KEY user_grp_ID (user_grp_ID)
79 ) ENGINE = innodb DEFAULT CHARSET = $db_storage_charset" ),
80
81- 'T_users__fielddefs' => array(
82- 'Creating table for User field definitions',
83- "CREATE TABLE T_users__fielddefs (
84- ufdf_ID int(10) unsigned NOT NULL,
85- ufdf_type char(8) NOT NULL,
86- ufdf_name varchar(255) NOT NULL,
87- PRIMARY KEY (ufdf_ID)
88- ) ENGINE = innodb DEFAULT CHARSET = $db_storage_charset" ),
89-
90- 'T_users__fields' => array(
91- 'Creating table for User fields',
92- "CREATE TABLE T_users__fields (
93- uf_ID int(10) unsigned NOT NULL auto_increment,
94- uf_user_ID int(10) unsigned NOT NULL,
95- uf_ufdf_ID int(10) unsigned NOT NULL,
96- uf_varchar varchar(255) NOT NULL,
97- PRIMARY KEY (uf_ID)
98- ) ENGINE = innodb DEFAULT CHARSET = $db_storage_charset" ),
99-
100 'T_templates__template' => array(
101 'Creating table for installed templates',
102 "CREATE TABLE T_templates__template (
103@@ -524,6 +500,15 @@
104 INDEX plug_status( plug_status )
105 ) ENGINE = innodb DEFAULT CHARSET = $db_storage_charset" ),
106
107+ 'T_pluginevents' => array(
108+ 'Creating plugin events table',
109+ "CREATE TABLE T_pluginevents(
110+ pevt_plug_ID INT(11) UNSIGNED NOT NULL,
111+ pevt_event VARCHAR(40) NOT NULL,
112+ pevt_enabled TINYINT NOT NULL DEFAULT 1,
113+ PRIMARY KEY( pevt_plug_ID, pevt_event )
114+ ) ENGINE = innodb DEFAULT CHARSET = $db_storage_charset" ),
115+
116 'T_pluginsettings' => array(
117 'Creating plugin settings table',
118 "CREATE TABLE T_pluginsettings (
119@@ -533,6 +518,38 @@
120 PRIMARY KEY ( pset_plug_ID, pset_name )
121 ) ENGINE = innodb DEFAULT CHARSET = $db_storage_charset" ),
122
123+ /**
124+ * This table holds info about fields a plugin might want to access and
125+ * use. The only time it gets called is on a plugin's settings page
126+ * for the various bits that make a plugin field be a plugin field
127+ */
128+ 'T_plugin_sharedfields' => array(
129+ 'Creating table for User field definitions',
130+ "CREATE TABLE T_plugin_sharedfields (
131+ psf_fieldname VARCHAR(16) NOT NULL,
132+ psf_label VARCHAR(255) NOT NULL,
133+ psf_type VARCHAR(255) NOT NULL, /* probably only 'text', maybe 'checkbox', 'select' is crazy talk! */
134+ psf_note VARCHAR(255) NOT NULL,
135+ psf_validate VARCHAR(255) NOT NULL, /* make sure a url is a url ... for example */
136+ PRIMARY KEY (psf_fieldname)
137+ ) ENGINE = innodb DEFAULT CHARSET = $db_storage_charset" ),
138+
139+ /**
140+ * This table holds user-specific info for any shared plugin field. When on a
141+ * plugin's settings page it gets accessed to find then store info about a
142+ * user. The plugin then stores the fact that some info about the user
143+ * is stored in this table for the rest of QP to do it's thing with.
144+ */
145+ 'T_plugin_sharedvalues' => array(
146+ 'Creating table for User fields',
147+ "CREATE TABLE T_plugin_sharedvalues (
148+ psv_ID int(10) unsigned NOT NULL auto_increment,
149+ psv_user_ID int(10) unsigned NOT NULL,
150+ psv_psf_fieldname VARCHAR(32) NOT NULL,
151+ psv_userfieldvalue VARCHAR(255) NOT NULL,
152+ PRIMARY KEY (psv_ID)
153+ ) ENGINE = innodb DEFAULT CHARSET = $db_storage_charset" ),
154+
155 'T_pluginusersettings' => array(
156 'Creating plugin user settings table',
157 "CREATE TABLE T_pluginusersettings (
158@@ -543,15 +560,6 @@
159 PRIMARY KEY ( puset_plug_ID, puset_user_ID, puset_name )
160 ) ENGINE = innodb DEFAULT CHARSET = $db_storage_charset" ),
161
162- 'T_pluginevents' => array(
163- 'Creating plugin events table',
164- "CREATE TABLE T_pluginevents(
165- pevt_plug_ID INT(11) UNSIGNED NOT NULL,
166- pevt_event VARCHAR(40) NOT NULL,
167- pevt_enabled TINYINT NOT NULL DEFAULT 1,
168- PRIMARY KEY( pevt_plug_ID, pevt_event )
169- ) ENGINE = innodb DEFAULT CHARSET = $db_storage_charset" ),
170-
171 'T_cron__task' => array(
172 'Creating cron tasks table',
173 "CREATE TABLE T_cron__task(
174
175=== modified file 'inc/users/model/_user.class.php'
176--- inc/users/model/_user.class.php 2010-02-21 05:04:49 +0000
177+++ inc/users/model/_user.class.php 2010-03-11 16:10:29 +0000
178@@ -50,78 +50,21 @@
179 var $locale;
180 var $email;
181 var $url;
182- var $icq;
183- var $aim;
184- var $msn;
185- var $yim;
186 var $ip;
187 var $domain;
188 var $browser;
189 var $datecreated;
190 var $level;
191- var $avatar_file_ID;
192-
193- /**
194- * Does the user accept emails through a message form?
195- * @var boolean
196- */
197 var $allow_msgform;
198 var $notify;
199 var $showonline;
200-
201- /**
202- * Has the user been validated (by email)?
203- * @var boolean
204- */
205 var $validated;
206-
207- /**
208- * Number of posts by this user. Use get_num_posts() to access this (lazy filled).
209- * @var integer
210- * @access protected
211- */
212 var $_num_posts;
213-
214- /**
215- * The ID of the (primary, currently only) group of the user.
216- * @var integer
217- */
218 var $group_ID;
219-
220- /**
221- * Reference to group
222- * @see User::get_Group()
223- * @var Group
224- * @access protected
225- */
226 var $Group;
227-
228- /**
229- * Blog posts statuses permissions
230- */
231 var $blog_post_statuses = array();
232-
233- /**
234- * Cache for perms.
235- * @access protected
236- * @var array
237- */
238 var $cache_perms = array();
239
240-
241- /**
242- * User fields
243- */
244- var $userfields = array();
245- var $userfields_by_type = array();
246- var $updated_fields = array();
247- var $new_fields = array();
248-
249- /**
250- * Userfield defs
251- */
252- var $userfield_defs;
253-
254 /**
255 * Constructor
256 *
257@@ -196,10 +139,6 @@
258 $this->locale = $db_row->user_locale;
259 $this->email = $db_row->user_email;
260 $this->url = $db_row->user_url;
261- $this->icq = $db_row->user_icq;
262- $this->aim = $db_row->user_aim;
263- $this->msn = $db_row->user_msn;
264- $this->yim = $db_row->user_yim;
265 $this->ip = $db_row->user_ip;
266 $this->domain = $db_row->user_domain;
267 $this->browser = $db_row->user_browser;
268@@ -209,7 +148,6 @@
269 $this->validated = $db_row->user_validated;
270 $this->notify = $db_row->user_notify;
271 $this->showonline = $db_row->user_showonline;
272- $this->avatar_file_ID = $db_row->user_avatar_file_ID;
273
274 // Group for this user:
275 $this->group_ID = $db_row->user_grp_ID;
276@@ -985,15 +923,6 @@
277
278 if( $result = parent::dbinsert() )
279 { // We could insert the user object..
280-
281- // Add new fields:
282- if( !empty($this->new_fields) )
283- {
284- $sql = 'INSERT INTO T_users__fields( uf_user_ID, uf_ufdf_ID, uf_varchar )
285- VALUES ('.$this->ID.', '.implode( '), ('.$this->ID.', ', $this->new_fields ).' )';
286- $DB->query( $sql, 'Insert new fields' );
287- }
288-
289 // Notify plugins:
290 // A user could be created also in another DB (to synchronize it with QP)
291 $Plugins->trigger_event( 'AfterUserInsert', $params = array( 'User' => & $this ) );
292@@ -1018,33 +947,6 @@
293
294 parent::dbupdate();
295
296- // Update existing fields:
297- if( !empty($this->updated_fields) )
298- {
299- foreach( $this->updated_fields as $uf_ID=>$uf_val )
300- {
301- if( empty( $uf_val ) )
302- { // Delete field:
303- $DB->query( 'DELETE FROM T_users__fields
304- WHERE uf_ID = '.$uf_ID );
305- }
306- else
307- { // Update field:
308- $DB->query( 'UPDATE T_users__fields
309- SET uf_varchar = '.$DB->quote($uf_val).'
310- WHERE uf_ID = '.$uf_ID );
311- }
312- }
313- }
314-
315- // Add new fields:
316- if( !empty($this->new_fields) )
317- {
318- $sql = 'INSERT INTO T_users__fields( uf_user_ID, uf_ufdf_ID, uf_varchar )
319- VALUES ('.$this->ID.', '.implode( '), ('.$this->ID.', ', $this->new_fields ).' )';
320- $DB->query( $sql, 'Insert new fields' );
321- }
322-
323 // Notify plugins:
324 // Example: An authentication plugin could synchronize/update the password of the user.
325 $Plugins->trigger_event( 'AfterUserUpdate', $params = array( 'User' => & $this ) );
326@@ -1227,8 +1129,6 @@
327 }
328
329
330- // Template functions {{{
331-
332 /**
333 * Template function: display user's level
334 */
335@@ -1385,128 +1285,6 @@
336 }
337
338
339- /**
340- * Template function: display ICQ of the user
341- */
342- function icq( $format = 'htmlbody' )
343- {
344- $this->disp( 'icq', $format );
345- }
346-
347-
348- /**
349- * Template function: display AIM of the user.
350- *
351- * NOTE: Replaces spaces with '+' ?!?
352- */
353- function aim( $format = 'htmlbody' )
354- {
355- echo format_to_output( str_replace(' ', '+', $this->get('aim') ), $format );
356- }
357-
358-
359- /**
360- * Template function: display Yahoo IM of the user
361- */
362- function yim( $format = 'htmlbody' )
363- {
364- $this->disp( 'yim', $format );
365- }
366-
367-
368- /**
369- * Template function: display MSN of the user
370- */
371- function msn( $format = 'htmlbody' )
372- {
373- $this->disp( 'msn', $format );
374- }
375-
376- // }}}
377-
378-
379- /**
380- * Add a user field
381- */
382- function userfield_add( $type, $val )
383- {
384- global $DB;
385- $this->new_fields[] = $type.', '.$DB->quote($val);
386- }
387-
388-
389- /**
390- * Update an user field. Empty fields will be deleted on dbupdate.
391- */
392- function userfield_update( $uf_ID, $val )
393- {
394- global $DB;
395- $this->updated_fields[$uf_ID] = $val;
396- // pre_dump( $uf_ID, $val);
397- }
398-
399-
400- /**
401- * Load userfields
402- */
403- function userfields_load()
404- {
405- global $DB;
406-
407- $userfields = $DB->get_results( '
408- SELECT uf_ID, uf_ufdf_ID, uf_varchar
409- FROM T_users__fields
410- WHERE uf_user_ID = '.$this->ID );
411-
412- foreach( $userfields as $userfield )
413- {
414- // Save all data for this field:
415- $this->userfields[$userfield->uf_ID] = array( $userfield->uf_ufdf_ID, $userfield->uf_varchar);
416- // Save index
417- $this->userfields_by_type[$userfield->uf_ufdf_ID][] = $userfield->uf_ID;
418- }
419-
420- // Also make sure the definitions are loaded
421- $this->userfield_defs_load();
422- }
423-
424-
425- /**
426- * Load userfields defs
427- */
428- function userfield_defs_load()
429- {
430- global $DB;
431-
432- if( !isset($this->userfield_defs) )
433- {
434- $userfield_defs = $DB->get_results( '
435- SELECT ufdf_ID, ufdf_type, ufdf_name
436- FROM T_users__fielddefs' );
437-
438- foreach( $userfield_defs as $userfield_def )
439- {
440- $this->userfield_defs[$userfield_def->ufdf_ID] = array( $userfield_def->ufdf_type, $userfield_def->ufdf_name );
441- }
442- }
443- }
444-
445- /**
446- * Get first field for a specific type
447- *
448- * @return string or NULL
449- */
450- function userfieldget_first_for_type( $type_ID )
451- {
452- if( !isset($this->userfields_by_type[$type_ID]) )
453- {
454- return NULL;
455- }
456-
457- $idx = $this->userfields_by_type[$type_ID][0];
458-
459- return $this->userfields[$idx][1];
460- }
461 }
462
463 ?>
464
465=== modified file 'inc/users/users.ctrl.php'
466--- inc/users/users.ctrl.php 2010-02-22 14:41:25 +0000
467+++ inc/users/users.ctrl.php 2010-03-11 16:10:29 +0000
468@@ -287,15 +287,6 @@
469 param( 'edited_user_url', 'string', true );
470 param_check_url( 'edited_user_url', 'commenting' );
471
472- param( 'edited_user_icq', 'string', true );
473- param_check_number( 'edited_user_icq', T_('The ICQ UIN can only be a number, no letters allowed.') );
474-
475- param( 'edited_user_aim', 'string', true );
476-
477- param( 'edited_user_msn', 'string', true );
478- param_check_email( 'edited_user_msn', false );
479-
480- param( 'edited_user_yim', 'string', true );
481 param( 'edited_user_allow_msgform', 'integer', 0 );
482 param( 'edited_user_notify', 'integer', 0 );
483 param( 'edited_user_showonline', 'integer', 0 );
484@@ -320,10 +311,6 @@
485 }
486 $edited_User->set( 'email', $edited_user_email );
487 $edited_User->set( 'url', $edited_user_url );
488- $edited_User->set( 'icq', $edited_user_icq );
489- $edited_User->set( 'aim', $edited_user_aim );
490- $edited_User->set( 'msn', $edited_user_msn );
491- $edited_User->set( 'yim', $edited_user_yim );
492 $edited_User->set( 'allow_msgform', $edited_user_allow_msgform );
493 $edited_User->set( 'notify', $edited_user_notify );
494 $edited_User->set( 'showonline', $edited_user_showonline );
495@@ -337,49 +324,11 @@
496 param( 'edited_user_focusonfirst', 'integer', 0 );
497 param( 'edited_user_results_per_page', 'integer', null );
498
499-
500- // EXPERIMENTAL user fields:
501-
502- // EXISTING fields:
503- // Get indices of existing userfields:
504- $userfield_IDs = $DB->get_col( '
505- SELECT uf_ID
506- FROM T_users__fields
507- WHERE uf_user_ID = '.$edited_User->ID );
508- foreach( $userfield_IDs as $userfield_ID )
509- {
510- $uf_val = param( 'uf_'.$userfield_ID, 'string', '' );
511-
512- // TODO: type checking
513-
514- $edited_User->userfield_update( $userfield_ID, $uf_val );
515- }
516-
517- // NEW fields:
518- for( $i=1; $i<=3; $i++ )
519- { // new fields:
520- $new_uf_type = param( 'new_uf_type_'.$i, 'integer', '' );
521- $new_uf_val = param( 'new_uf_val_'.$i, 'string', '' );
522- if( empty($new_uf_type) && empty($new_uf_val) )
523- {
524- continue;
525- }
526-
527- if( empty($new_uf_type) )
528- {
529- param_error( 'new_uf_val_'.$i, T_('Please select a field type.') );
530- }
531- if( empty($new_uf_val) )
532- {
533- param_error( 'new_uf_val_'.$i, T_('Please enter a value.') );
534- }
535-
536- // echo $new_uf_type.':'.$new_uf_val;
537-
538- // TODO: type checking
539-
540- $edited_User->userfield_add( $new_uf_type, $new_uf_val );
541- }
542+ /**
543+ * @todo EdB: probably don't need the messages->count(error) bit
544+ * but it doesn't hurt and can be removed later by someone smart.
545+ * A bunch of "experimental user field" stuff used to be here ...
546+ */
547
548 if( $Messages->count( 'error' ) )
549 { // We have found validation errors:
550
551=== modified file 'inc/users/views/_user.form.php'
552--- inc/users/views/_user.form.php 2010-02-27 17:48:16 +0000
553+++ inc/users/views/_user.form.php 2010-03-11 16:10:29 +0000
554@@ -335,36 +335,13 @@
555 else
556 $url_fieldnote = '';
557
558- if( $edited_User->get('icq') != 0 )
559- $icq_fieldnote = '<a href="http://wwp.icq.com/scripts/search.dll?to='.$edited_User->get('icq').'" target="_blank">'.get_icon( 'play', 'imgtag', array('title'=>T_('Search on ICQ.com')) ).'</a>';
560- else
561- $icq_fieldnote = '';
562-
563- if( $edited_User->get('aim') != '' )
564- $aim_fieldnote = '<a href="aim:goim?screenname='.$edited_User->get('aim').'&amp;message=Hello">'.get_icon( 'play', 'imgtag', array('title'=>T_('Instant Message to user')) ).'</a>';
565- else
566- $aim_fieldnote = '';
567-
568-
569 if( $action != 'view_user' )
570 { // We can edit the values:
571-
572 $Form->text_input( 'edited_user_url', $edited_User->url, 30, T_('URL'), $url_fieldnote, array( 'maxlength' => 100 ) );
573- $Form->text_input( 'edited_user_icq', $edited_User->icq, 30, T_('ICQ'), $icq_fieldnote, array( 'maxlength' => 10 ) );
574- $Form->text_input( 'edited_user_aim', $edited_User->aim, 30, T_('AIM'), $aim_fieldnote, array( 'maxlength' => 50 ) );
575- $Form->text_input( 'edited_user_msn', $edited_User->msn, 30, T_('MSN IM'), '', array( 'maxlength' => 100 ) );
576- $Form->text_input( 'edited_user_yim', $edited_User->yim, 30, T_('YahooIM'), '', array( 'maxlength' => 50 ) );
577-
578 }
579 else
580 { // display only
581-
582 $Form->info( T_('URL'), $edited_User->get('url'), $url_fieldnote );
583- $Form->info( T_('ICQ'), $edited_User->get('icq', 'formvalue'), $icq_fieldnote );
584- $Form->info( T_('AIM'), $edited_User->get('aim'), $aim_fieldnote );
585- $Form->info( T_('MSN IM'), $edited_User->get('msn') );
586- $Form->info( T_('YahooIM'), $edited_User->get('yim') );
587-
588 }
589
590 $Form->end_fieldset();
591
592=== modified file 'install/_functions_create.php'
593--- install/_functions_create.php 2010-02-22 14:41:25 +0000
594+++ install/_functions_create.php 2010-03-11 16:10:29 +0000
595@@ -141,36 +141,36 @@
596 echo "OK.<br />\n";
597
598 echo 'Creating user field definitions... ';
599- // fp> Anyone, please add anything you can think of. It's better to start with a large list that update it progressively.
600 $DB->query( "
601- INSERT INTO T_users__fielddefs (ufdf_ID, ufdf_type, ufdf_name)
602- VALUES ( 10000, 'email', 'MSN/Live IM'),
603- ( 10100, 'word', 'Yahoo IM'),
604- ( 10200, 'word', 'AOL AIM'),
605- ( 10300, 'number', 'ICQ ID'),
606- ( 40000, 'phone', 'Skype'),
607- ( 50000, 'phone', 'Main phone'),
608- ( 50100, 'phone', 'Cell phone'),
609- ( 50200, 'phone', 'Office phone'),
610- ( 50300, 'phone', 'Home phone'),
611- ( 60000, 'phone', 'Office FAX'),
612- ( 60100, 'phone', 'Home FAX'),
613- (100000, 'url', 'Website'),
614- (100100, 'url', 'Blog'),
615- (110000, 'url', 'Linkedin'),
616- (120000, 'url', 'Twitter'),
617- (130100, 'url', 'Facebook'),
618- (130200, 'url', 'Myspace'),
619- (140000, 'url', 'Flickr'),
620- (150000, 'url', 'YouTube'),
621- (160000, 'url', 'Digg'),
622- (160100, 'url', 'StumbleUpon'),
623- (200000, 'text', 'Role'),
624- (200100, 'text', 'Organization'),
625- (200200, 'text', 'Division'),
626- (211000, 'text', 'VAT ID'),
627- (300000, 'text', 'Main address'),
628- (300300, 'text', 'Home address');" );
629+ INSERT INTO T_plugin_sharedfields (psf_fieldname, psf_label, psf_type, psf_note, psf_validate)
630+ VALUES ( 'address_1', 'Address 1', 'text', 'note', 'none' ),
631+ ( 'address_2', 'Address 2', 'text', 'note', 'none' ),
632+ ( 'city', 'City', 'text', 'note', 'none' ),
633+ ( 'county', 'County', 'text', 'note', 'none' ),
634+ ( 'state', 'State', 'text', 'note', 'none' ),
635+ ( 'province', 'Province', 'text', 'note', 'none' ),
636+ ( 'postal_code', 'Postal Code', 'text', 'note', 'none' ),
637+ ( 'nation', 'Nation', 'text', 'note', 'none' ),
638+ ( 'home_phone', 'Home Phone', 'text', 'note', 'phone' ),
639+ ( 'cell_phone', 'Cell Phone', 'text', 'note', 'phone' ),
640+ ( 'home_fax', 'Home FAX', 'text', 'note', 'phone' ),
641+ ( 'birthday', 'Birthday', 'text', 'note', 'none' ),
642+ ( 'gender', 'Gender', 'text', 'note', 'none' ),
643+ ( 'avatar_ID', 'Avatar File #', 'text', 'note', 'number' ),
644+ ( 'digg_url', 'Digg', 'text', 'note', 'url' ),
645+ ( 'facebook', 'Facebook', 'text', 'note', 'url' ),
646+ ( 'flickr', 'Flickr', 'text', 'note', 'url' ),
647+ ( 'linkdin', 'LinkedIn', 'text', 'note', 'url' ),
648+ ( 'myspace', 'Myspace', 'text', 'note', 'url' ),
649+ ( 'stumble', 'StumbleUpon', 'text', 'note', 'url' ),
650+ ( 'twitter', 'Twitter', 'text', 'note', 'url' ),
651+ ( 'youtube', 'YouTube', 'text', 'note', 'url' ),
652+ ( 'aol_aim', 'AOL AIM', 'text', 'note', 'none' ),
653+ ( 'icq_id', 'ICQ ID', 'text', 'note', 'none' ),
654+ ( 'jabber', 'Jabber', 'text', 'note', 'none' ),
655+ ( 'msn_im', 'MSN IM', 'text', 'note', 'none' ),
656+ ( 'skype', 'Skype ID', 'text', 'note', 'none' ),
657+ ( 'yahoo_im', 'Yahoo IM', 'text', 'note', 'none' );" );
658 echo "OK.<br />\n";
659
660
661
662=== modified file 'install/_functions_evoupgrade.php'
663--- install/_functions_evoupgrade.php 2010-02-19 10:50:37 +0000
664+++ install/_functions_evoupgrade.php 2010-03-11 16:10:29 +0000
665@@ -400,59 +400,69 @@
666 ( 1600, 'Intro-All' ) " );
667 task_end();
668
669- task_begin( 'Updating User table' );
670- $DB->query( "ALTER TABLE T_users
671- ADD COLUMN user_avatar_file_ID int(10) unsigned default NULL AFTER user_validated" );
672- task_end();
673-
674 task_begin( 'Creating table for User field definitions' );
675- $DB->query( "CREATE TABLE T_users__fielddefs (
676- ufdf_ID int(10) unsigned NOT NULL,
677- ufdf_type char(8) NOT NULL,
678- ufdf_name varchar(255) collate latin1_general_ci NOT NULL,
679- PRIMARY KEY (ufdf_ID)
680+ $DB->query( "CREATE TABLE T_plugin_sharedfields (
681+ psf_ID int(10) unsigned NOT NULL,
682+ psf_type char(8) NOT NULL,
683+ psf_name varchar(255) collate latin1_general_ci NOT NULL,
684+ PRIMARY KEY (psf_ID)
685 )" );
686 task_end();
687
688+
689+
690+ 'T_plugin_sharedfields' => array(
691+ 'Creating table for User field definitions',
692+ "CREATE TABLE T_plugin_sharedfields (
693+ psf_fieldname VARCHAR(32) NOT NULL,
694+ psf_label VARCHAR(255) NOT NULL,
695+ psf_type VARCHAR(255) NOT NULL, // probably only 'text', maybe 'checkbox', 'select' is crazy talk!
696+ psf_validate VARCHAR(255) NOT NULL, // might be needed for some fields, but probably not
697+ psf_note VARCHAR(255) NOT NULL,
698+ PRIMARY KEY (psf_fieldname)
699+ ) ENGINE = innodb DEFAULT CHARSET = $db_storage_charset" ),
700+
701+
702 task_begin( 'Creating default field definitions...' );
703 $DB->query( "
704- INSERT INTO T_users__fielddefs (ufdf_ID, ufdf_type, ufdf_name)
705- VALUES ( 10000, 'email', 'MSN/Live IM'),
706- ( 10100, 'word', 'Yahoo IM'),
707- ( 10200, 'word', 'AOL AIM'),
708- ( 10300, 'number', 'ICQ ID'),
709- ( 40000, 'phone', 'Skype'),
710- ( 50000, 'phone', 'Main phone'),
711- ( 50100, 'phone', 'Cell phone'),
712- ( 50200, 'phone', 'Office phone'),
713- ( 50300, 'phone', 'Home phone'),
714- ( 60000, 'phone', 'Office FAX'),
715- ( 60100, 'phone', 'Home FAX'),
716- (100000, 'url', 'Website'),
717- (100100, 'url', 'Blog'),
718- (110000, 'url', 'Linkedin'),
719- (120000, 'url', 'Twitter'),
720- (130100, 'url', 'Facebook'),
721- (130200, 'url', 'Myspace'),
722- (140000, 'url', 'Flickr'),
723- (150000, 'url', 'YouTube'),
724- (160000, 'url', 'Digg'),
725- (160100, 'url', 'StumbleUpon'),
726- (200000, 'text', 'Role'),
727- (200100, 'text', 'Company/Org.'),
728- (200200, 'text', 'Division'),
729- (211000, 'text', 'VAT ID'),
730- (300000, 'text', 'Main address'),
731- (300300, 'text', 'Home address');" );
732+ INSERT INTO T_plugin_sharedfields (psf_fieldname, psf_label, psf_type, psf_note, psf_validate)
733+ VALUES ( 'address_1', 'Address 1', 'text', '', 'none' ),
734+ ( 'address_2', 'Address 2', 'text', '', 'none' ),
735+ ( 'city', 'City', 'text', '', 'none' ),
736+ ( 'county', 'County', 'text', '', 'none' ),
737+ ( 'state', 'State', 'text', '', 'none' ),
738+ ( 'province', 'Province', 'text', '', 'none' ),
739+ ( 'postal_code', 'Postal Code', 'text', '', 'none' ),
740+ ( 'nation', 'Nation', 'text', '', 'none' ),
741+ ( 'home_phone', 'Home Phone', 'text', '', 'phone' ),
742+ ( 'cell_phone', 'Cell Phone', 'text', '', 'phone' ),
743+ ( 'home_fax', 'Home FAX', 'text', '', 'phone' ),
744+ ( 'birthday', 'Birthday', 'text', '', 'none' ),
745+ ( 'gender', 'Gender', 'text', '', 'none' ),
746+ ( 'avatar_ID', 'Avatar File #', 'text', '', 'number' ),
747+ ( 'digg_url', 'Digg', 'text', '', 'url' ),
748+ ( 'facebook', 'Facebook', 'text', '', 'url' ),
749+ ( 'flickr', 'Flickr', 'text', '', 'url' ),
750+ ( 'linkdin', 'LinkedIn', 'text', '', 'url' ),
751+ ( 'myspace', 'Myspace', 'text', '', 'url' ),
752+ ( 'stumble', 'StumbleUpon', 'text', '', 'url' ),
753+ ( 'twitter', 'Twitter', 'text', '', 'url' ),
754+ ( 'youtube', 'YouTube', 'text', '', 'url' ),
755+ ( 'aol_aim', 'AOL AIM', 'text', '', 'none' ),
756+ ( 'icq_id', 'ICQ ID', 'text', '', 'none' ),
757+ ( 'jabber', 'Jabber', 'text', '', 'none' ),
758+ ( 'msn_im', 'MSN IM', 'text', '', 'none' ),
759+ ( 'skype', 'Skype ID', 'text', '', 'none' ),
760+ ( 'yahoo_im', 'Yahoo IM', 'text', '', 'none' );" );
761 task_end();
762
763 task_begin( 'Creating table for User fields...' );
764- $DB->query( "CREATE TABLE T_users__fields (
765- uf_ID int(10) unsigned NOT NULL auto_increment,
766- uf_user_ID int(10) unsigned NOT NULL,
767- uf_ufdf_ID int(10) unsigned NOT NULL,
768- uf_varchar varchar(255) NOT NULL,
769- PRIMARY KEY (uf_ID)
770+ $DB->query( "CREATE TABLE T_plugin_sharedvalues (
771+ psv_ID int(10) unsigned NOT NULL auto_increment,
772+ psv_user_ID int(10) unsigned NOT NULL,
773+ psv_psf_fieldname VARCHAR(32) NOT NULL,
774+ psv_userfieldvalue VARCHAR(255) NOT NULL,
775+ PRIMARY KEY (psv_ID)
776 )" );
777 task_end();
778
779@@ -571,7 +581,7 @@
780 $DB->save_error_state();
781 $DB->halt_on_error = false;
782 $DB->show_errors = false;
783- $DB->query( "ALTER TABLE {$tableprefix}users_fields RENAME TO T_users__fields" );
784+ $DB->query( "ALTER TABLE {$tableprefix}users_fields RENAME TO T_plugin_sharedvalues" );
785 $DB->restore_error_state();
786 echo "OK.<br />\n";
787
788
789=== modified file 'templates/_profile.disp.php'
790--- templates/_profile.disp.php 2010-02-22 14:41:25 +0000
791+++ templates/_profile.disp.php 2010-03-11 16:10:29 +0000
792@@ -77,10 +77,6 @@
793 $ProfileForm->info( T_('Level'), $current_User->get('level') );
794 $ProfileForm->info( T_('Posts'), $current_User->get('num_posts') );
795 $ProfileForm->text_input( 'newuser_url', $current_User->get( 'url' ), 40, T_('URL'), '', array( 'maxlength' => 100, 'class' => 'bComment' ) );
796-$ProfileForm->text_input( 'newuser_icq', $current_User->get( 'icq' ), 40, T_('ICQ'), '', array( 'maxlength' => 10, 'class' => 'bComment' ) );
797-$ProfileForm->text_input( 'newuser_aim', $current_User->get( 'aim' ), 40, T_('AOL I.M.'), '', array( 'maxlength' => 50, 'class' => 'bComment' ) );
798-$ProfileForm->text_input( 'newuser_msn', $current_User->get( 'msn' ), 40, T_('MSN I.M.'), '', array( 'maxlength' => 100, 'class' => 'bComment' ) );
799-$ProfileForm->text_input( 'newuser_yim', $current_User->get( 'yim' ), 40, T_('Yahoo I.M.'), '', array( 'maxlength' => 50, 'class' => 'bComment' ) );
800 $ProfileForm->end_fieldset();
801
802 $ProfileForm->buttons( array(
803
804=== modified file 'templates/_user.disp.php'
805--- templates/_user.disp.php 2010-02-22 14:41:25 +0000
806+++ templates/_user.disp.php 2010-03-11 16:10:29 +0000
807@@ -57,18 +57,6 @@
808 }
809 $ProfileForm->end_fieldset();
810
811-$ProfileForm->begin_fieldset( T_('Additional info') );
812-// Load the user fields:
813-$User->userfields_load();
814-/**
815- * @todo (legacy): fp> have some clean iteration support
816- */
817-foreach( $User->userfields as $uf_ID=>$uf_array )
818-{
819- $ProfileForm->info( $User->userfield_defs[$uf_array[0]][1], $uf_array[1] );
820-}
821-$ProfileForm->end_fieldset();
822-
823 $ProfileForm->begin_fieldset( T_('Miscellaneous') );
824 $ProfileForm->info( T_('Locale'), $User->get( 'locale' ) );
825 $ProfileForm->info( T_('Level'), $User->get('level') );

Subscribers

People subscribed via source and target branches