mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/12115] Convert user occupation to a profile field
PHPBB3-12115
This commit is contained in:
parent
344baf9180
commit
3c640e57c5
17 changed files with 176 additions and 26 deletions
|
@ -368,7 +368,6 @@ function make_user($username)
|
||||||
$email = "nobody@localhost";
|
$email = "nobody@localhost";
|
||||||
$icq = "12345678";
|
$icq = "12345678";
|
||||||
$website = "http://www.phpbb.com";
|
$website = "http://www.phpbb.com";
|
||||||
$occupation = "phpBB tester";
|
|
||||||
$location = "phpBB world hq";
|
$location = "phpBB world hq";
|
||||||
$interests = "Eating, sleeping, living, and breathing phpBB";
|
$interests = "Eating, sleeping, living, and breathing phpBB";
|
||||||
$signature = "$username: phpBB tester.";
|
$signature = "$username: phpBB tester.";
|
||||||
|
@ -422,8 +421,8 @@ function make_user($username)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmilies, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
|
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmilies, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
|
||||||
VALUES ($new_user_id, '$username', " . time() . ", '$password', '$email', '$icq', '$website', '$occupation', '$location', '$interests', '$signature', '$signature_bbcode_uid', '$avatar_filename', $viewemail, '$aim', '$yim', '$msn', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $user_timezone, '$user_dateformat', '$user_lang', $user_style, 0, 1, ";
|
VALUES ($new_user_id, '$username', " . time() . ", '$password', '$email', '$icq', '$website', '$location', '$interests', '$signature', '$signature_bbcode_uid', '$avatar_filename', $viewemail, '$aim', '$yim', '$msn', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $user_timezone, '$user_dateformat', '$user_lang', $user_style, 0, 1, ";
|
||||||
|
|
||||||
|
|
||||||
$sql .= "1, '')";
|
$sql .= "1, '')";
|
||||||
|
|
|
@ -1368,7 +1368,6 @@ class acp_users
|
||||||
'jabber' => utf8_normalize_nfc(request_var('jabber', $user_row['user_jabber'], true)),
|
'jabber' => utf8_normalize_nfc(request_var('jabber', $user_row['user_jabber'], true)),
|
||||||
'website' => request_var('website', $user_row['user_website']),
|
'website' => request_var('website', $user_row['user_website']),
|
||||||
'location' => utf8_normalize_nfc(request_var('location', $user_row['user_from'], true)),
|
'location' => utf8_normalize_nfc(request_var('location', $user_row['user_from'], true)),
|
||||||
'occupation' => utf8_normalize_nfc(request_var('occupation', $user_row['user_occ'], true)),
|
|
||||||
'interests' => utf8_normalize_nfc(request_var('interests', $user_row['user_interests'], true)),
|
'interests' => utf8_normalize_nfc(request_var('interests', $user_row['user_interests'], true)),
|
||||||
'bday_day' => 0,
|
'bday_day' => 0,
|
||||||
'bday_month' => 0,
|
'bday_month' => 0,
|
||||||
|
@ -1402,7 +1401,6 @@ class acp_users
|
||||||
array('string', true, 12, 255),
|
array('string', true, 12, 255),
|
||||||
array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')),
|
array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')),
|
||||||
'location' => array('string', true, 2, 100),
|
'location' => array('string', true, 2, 100),
|
||||||
'occupation' => array('string', true, 2, 500),
|
|
||||||
'interests' => array('string', true, 2, 500),
|
'interests' => array('string', true, 2, 500),
|
||||||
'bday_day' => array('num', true, 1, 31),
|
'bday_day' => array('num', true, 1, 31),
|
||||||
'bday_month' => array('num', true, 1, 12),
|
'bday_month' => array('num', true, 1, 12),
|
||||||
|
@ -1432,7 +1430,6 @@ class acp_users
|
||||||
'user_jabber' => $data['jabber'],
|
'user_jabber' => $data['jabber'],
|
||||||
'user_website' => $data['website'],
|
'user_website' => $data['website'],
|
||||||
'user_from' => $data['location'],
|
'user_from' => $data['location'],
|
||||||
'user_occ' => $data['occupation'],
|
|
||||||
'user_interests'=> $data['interests'],
|
'user_interests'=> $data['interests'],
|
||||||
'user_birthday' => $data['user_birthday'],
|
'user_birthday' => $data['user_birthday'],
|
||||||
);
|
);
|
||||||
|
@ -1484,7 +1481,6 @@ class acp_users
|
||||||
'JABBER' => $data['jabber'],
|
'JABBER' => $data['jabber'],
|
||||||
'WEBSITE' => $data['website'],
|
'WEBSITE' => $data['website'],
|
||||||
'LOCATION' => $data['location'],
|
'LOCATION' => $data['location'],
|
||||||
'OCCUPATION' => $data['occupation'],
|
|
||||||
'INTERESTS' => $data['interests'],
|
'INTERESTS' => $data['interests'],
|
||||||
|
|
||||||
'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options,
|
'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options,
|
||||||
|
|
|
@ -787,6 +787,7 @@ $schema_data['phpbb_profile_fields'] = array(
|
||||||
$schema_data['phpbb_profile_fields_data'] = array(
|
$schema_data['phpbb_profile_fields_data'] = array(
|
||||||
'COLUMNS' => array(
|
'COLUMNS' => array(
|
||||||
'user_id' => array('UINT', 0),
|
'user_id' => array('UINT', 0),
|
||||||
|
'pf_phpbb_occupation' => array('TEXT_UNI', ''),
|
||||||
),
|
),
|
||||||
'PRIMARY_KEY' => 'user_id',
|
'PRIMARY_KEY' => 'user_id',
|
||||||
);
|
);
|
||||||
|
@ -1170,7 +1171,6 @@ $schema_data['phpbb_users'] = array(
|
||||||
'user_msnm' => array('VCHAR_UNI', ''),
|
'user_msnm' => array('VCHAR_UNI', ''),
|
||||||
'user_jabber' => array('VCHAR_UNI', ''),
|
'user_jabber' => array('VCHAR_UNI', ''),
|
||||||
'user_website' => array('VCHAR_UNI:200', ''),
|
'user_website' => array('VCHAR_UNI:200', ''),
|
||||||
'user_occ' => array('TEXT_UNI', ''),
|
|
||||||
'user_interests' => array('TEXT_UNI', ''),
|
'user_interests' => array('TEXT_UNI', ''),
|
||||||
'user_actkey' => array('VCHAR:32', ''),
|
'user_actkey' => array('VCHAR:32', ''),
|
||||||
'user_newpasswd' => array('VCHAR_UNI:40', ''),
|
'user_newpasswd' => array('VCHAR_UNI:40', ''),
|
||||||
|
|
|
@ -210,7 +210,6 @@ function user_add($user_row, $cp_data = false)
|
||||||
'user_lastpage' => '',
|
'user_lastpage' => '',
|
||||||
'user_posts' => 0,
|
'user_posts' => 0,
|
||||||
'user_colour' => '',
|
'user_colour' => '',
|
||||||
'user_occ' => '',
|
|
||||||
'user_interests' => '',
|
'user_interests' => '',
|
||||||
'user_avatar' => '',
|
'user_avatar' => '',
|
||||||
'user_avatar_type' => '',
|
'user_avatar_type' => '',
|
||||||
|
|
|
@ -195,7 +195,6 @@ class ucp_main
|
||||||
'POSTS_DAY' => $user->lang('POST_DAY', $posts_per_day),
|
'POSTS_DAY' => $user->lang('POST_DAY', $posts_per_day),
|
||||||
'POSTS_PCT' => $user->lang('POST_PCT', $percentage),
|
'POSTS_PCT' => $user->lang('POST_PCT', $percentage),
|
||||||
|
|
||||||
'OCCUPATION' => (!empty($row['user_occ'])) ? $row['user_occ'] : '',
|
|
||||||
'INTERESTS' => (!empty($row['user_interests'])) ? $row['user_interests'] : '',
|
'INTERESTS' => (!empty($row['user_interests'])) ? $row['user_interests'] : '',
|
||||||
|
|
||||||
// 'S_GROUP_OPTIONS' => $group_options,
|
// 'S_GROUP_OPTIONS' => $group_options,
|
||||||
|
|
|
@ -271,7 +271,6 @@ class ucp_profile
|
||||||
'jabber' => utf8_normalize_nfc(request_var('jabber', $user->data['user_jabber'], true)),
|
'jabber' => utf8_normalize_nfc(request_var('jabber', $user->data['user_jabber'], true)),
|
||||||
'website' => request_var('website', $user->data['user_website']),
|
'website' => request_var('website', $user->data['user_website']),
|
||||||
'location' => utf8_normalize_nfc(request_var('location', $user->data['user_from'], true)),
|
'location' => utf8_normalize_nfc(request_var('location', $user->data['user_from'], true)),
|
||||||
'occupation' => utf8_normalize_nfc(request_var('occupation', $user->data['user_occ'], true)),
|
|
||||||
'interests' => utf8_normalize_nfc(request_var('interests', $user->data['user_interests'], true)),
|
'interests' => utf8_normalize_nfc(request_var('interests', $user->data['user_interests'], true)),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -308,7 +307,6 @@ class ucp_profile
|
||||||
array('string', true, 12, 255),
|
array('string', true, 12, 255),
|
||||||
array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')),
|
array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')),
|
||||||
'location' => array('string', true, 2, 100),
|
'location' => array('string', true, 2, 100),
|
||||||
'occupation' => array('string', true, 2, 500),
|
|
||||||
'interests' => array('string', true, 2, 500),
|
'interests' => array('string', true, 2, 500),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -356,7 +354,6 @@ class ucp_profile
|
||||||
'user_jabber' => $data['jabber'],
|
'user_jabber' => $data['jabber'],
|
||||||
'user_website' => $data['website'],
|
'user_website' => $data['website'],
|
||||||
'user_from' => $data['location'],
|
'user_from' => $data['location'],
|
||||||
'user_occ' => $data['occupation'],
|
|
||||||
'user_interests'=> $data['interests'],
|
'user_interests'=> $data['interests'],
|
||||||
'user_notify_type' => $data['notify'],
|
'user_notify_type' => $data['notify'],
|
||||||
);
|
);
|
||||||
|
@ -427,7 +424,6 @@ class ucp_profile
|
||||||
'JABBER' => $data['jabber'],
|
'JABBER' => $data['jabber'],
|
||||||
'WEBSITE' => $data['website'],
|
'WEBSITE' => $data['website'],
|
||||||
'LOCATION' => $data['location'],
|
'LOCATION' => $data['location'],
|
||||||
'OCCUPATION'=> $data['occupation'],
|
|
||||||
'INTERESTS' => $data['interests'],
|
'INTERESTS' => $data['interests'],
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -954,6 +954,19 @@ if (!$get_info)
|
||||||
|
|
||||||
'where' => 'users.user_id <> -1',
|
'where' => 'users.user_id <> -1',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
array(
|
||||||
|
'target' => PROFILE_FIELDS_DATA_TABLE,
|
||||||
|
'primary' => 'users.user_id',
|
||||||
|
'query_first' => array(
|
||||||
|
array('target', $convert->truncate_statement . PROFILE_FIELDS_DATA_TABLE),
|
||||||
|
),
|
||||||
|
|
||||||
|
array('user_id', 'users.user_id', 'phpbb_user_id'),
|
||||||
|
array('pf_phpbb_occupation', 'users.user_occ', array('function1' => 'phpbb_set_encoding')),
|
||||||
|
|
||||||
|
'where' => 'users.user_id <> -1',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -946,7 +946,8 @@ END;;
|
||||||
|
|
||||||
# Table: 'phpbb_profile_fields_data'
|
# Table: 'phpbb_profile_fields_data'
|
||||||
CREATE TABLE phpbb_profile_fields_data (
|
CREATE TABLE phpbb_profile_fields_data (
|
||||||
user_id INTEGER DEFAULT 0 NOT NULL
|
user_id INTEGER DEFAULT 0 NOT NULL,
|
||||||
|
pf_phpbb_occupation BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL
|
||||||
);;
|
);;
|
||||||
|
|
||||||
ALTER TABLE phpbb_profile_fields_data ADD PRIMARY KEY (user_id);;
|
ALTER TABLE phpbb_profile_fields_data ADD PRIMARY KEY (user_id);;
|
||||||
|
@ -1423,7 +1424,6 @@ CREATE TABLE phpbb_users (
|
||||||
user_msnm VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
|
user_msnm VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
|
||||||
user_jabber VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
|
user_jabber VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
|
||||||
user_website VARCHAR(200) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
|
user_website VARCHAR(200) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
|
||||||
user_occ BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL,
|
|
||||||
user_interests BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL,
|
user_interests BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL,
|
||||||
user_actkey VARCHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
user_actkey VARCHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
||||||
user_newpasswd VARCHAR(40) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
|
user_newpasswd VARCHAR(40) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
|
||||||
|
|
|
@ -1153,7 +1153,8 @@ GO
|
||||||
Table: 'phpbb_profile_fields_data'
|
Table: 'phpbb_profile_fields_data'
|
||||||
*/
|
*/
|
||||||
CREATE TABLE [phpbb_profile_fields_data] (
|
CREATE TABLE [phpbb_profile_fields_data] (
|
||||||
[user_id] [int] DEFAULT (0) NOT NULL
|
[user_id] [int] DEFAULT (0) NOT NULL ,
|
||||||
|
[pf_phpbb_occupation] [varchar] (4000) DEFAULT ('') NOT NULL
|
||||||
) ON [PRIMARY]
|
) ON [PRIMARY]
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
@ -1739,7 +1740,6 @@ CREATE TABLE [phpbb_users] (
|
||||||
[user_msnm] [varchar] (255) DEFAULT ('') NOT NULL ,
|
[user_msnm] [varchar] (255) DEFAULT ('') NOT NULL ,
|
||||||
[user_jabber] [varchar] (255) DEFAULT ('') NOT NULL ,
|
[user_jabber] [varchar] (255) DEFAULT ('') NOT NULL ,
|
||||||
[user_website] [varchar] (200) DEFAULT ('') NOT NULL ,
|
[user_website] [varchar] (200) DEFAULT ('') NOT NULL ,
|
||||||
[user_occ] [varchar] (4000) DEFAULT ('') NOT NULL ,
|
|
||||||
[user_interests] [varchar] (4000) DEFAULT ('') NOT NULL ,
|
[user_interests] [varchar] (4000) DEFAULT ('') NOT NULL ,
|
||||||
[user_actkey] [varchar] (32) DEFAULT ('') NOT NULL ,
|
[user_actkey] [varchar] (32) DEFAULT ('') NOT NULL ,
|
||||||
[user_newpasswd] [varchar] (40) DEFAULT ('') NOT NULL ,
|
[user_newpasswd] [varchar] (40) DEFAULT ('') NOT NULL ,
|
||||||
|
|
|
@ -672,6 +672,7 @@ CREATE TABLE phpbb_profile_fields (
|
||||||
# Table: 'phpbb_profile_fields_data'
|
# Table: 'phpbb_profile_fields_data'
|
||||||
CREATE TABLE phpbb_profile_fields_data (
|
CREATE TABLE phpbb_profile_fields_data (
|
||||||
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
|
pf_phpbb_occupation blob NOT NULL,
|
||||||
PRIMARY KEY (user_id)
|
PRIMARY KEY (user_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1032,7 +1033,6 @@ CREATE TABLE phpbb_users (
|
||||||
user_msnm blob NOT NULL,
|
user_msnm blob NOT NULL,
|
||||||
user_jabber blob NOT NULL,
|
user_jabber blob NOT NULL,
|
||||||
user_website blob NOT NULL,
|
user_website blob NOT NULL,
|
||||||
user_occ blob NOT NULL,
|
|
||||||
user_interests blob NOT NULL,
|
user_interests blob NOT NULL,
|
||||||
user_actkey varbinary(32) DEFAULT '' NOT NULL,
|
user_actkey varbinary(32) DEFAULT '' NOT NULL,
|
||||||
user_newpasswd varbinary(120) DEFAULT '' NOT NULL,
|
user_newpasswd varbinary(120) DEFAULT '' NOT NULL,
|
||||||
|
|
|
@ -672,6 +672,7 @@ CREATE TABLE phpbb_profile_fields (
|
||||||
# Table: 'phpbb_profile_fields_data'
|
# Table: 'phpbb_profile_fields_data'
|
||||||
CREATE TABLE phpbb_profile_fields_data (
|
CREATE TABLE phpbb_profile_fields_data (
|
||||||
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
|
pf_phpbb_occupation text NOT NULL,
|
||||||
PRIMARY KEY (user_id)
|
PRIMARY KEY (user_id)
|
||||||
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
|
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
|
||||||
|
|
||||||
|
@ -1032,7 +1033,6 @@ CREATE TABLE phpbb_users (
|
||||||
user_msnm varchar(255) DEFAULT '' NOT NULL,
|
user_msnm varchar(255) DEFAULT '' NOT NULL,
|
||||||
user_jabber varchar(255) DEFAULT '' NOT NULL,
|
user_jabber varchar(255) DEFAULT '' NOT NULL,
|
||||||
user_website varchar(200) DEFAULT '' NOT NULL,
|
user_website varchar(200) DEFAULT '' NOT NULL,
|
||||||
user_occ text NOT NULL,
|
|
||||||
user_interests text NOT NULL,
|
user_interests text NOT NULL,
|
||||||
user_actkey varchar(32) DEFAULT '' NOT NULL,
|
user_actkey varchar(32) DEFAULT '' NOT NULL,
|
||||||
user_newpasswd varchar(40) DEFAULT '' NOT NULL,
|
user_newpasswd varchar(40) DEFAULT '' NOT NULL,
|
||||||
|
|
|
@ -1265,6 +1265,7 @@ END;
|
||||||
*/
|
*/
|
||||||
CREATE TABLE phpbb_profile_fields_data (
|
CREATE TABLE phpbb_profile_fields_data (
|
||||||
user_id number(8) DEFAULT '0' NOT NULL,
|
user_id number(8) DEFAULT '0' NOT NULL,
|
||||||
|
pf_phpbb_occupation clob DEFAULT '' ,
|
||||||
CONSTRAINT pk_phpbb_profile_fields_data PRIMARY KEY (user_id)
|
CONSTRAINT pk_phpbb_profile_fields_data PRIMARY KEY (user_id)
|
||||||
)
|
)
|
||||||
/
|
/
|
||||||
|
@ -1856,7 +1857,6 @@ CREATE TABLE phpbb_users (
|
||||||
user_msnm varchar2(765) DEFAULT '' ,
|
user_msnm varchar2(765) DEFAULT '' ,
|
||||||
user_jabber varchar2(765) DEFAULT '' ,
|
user_jabber varchar2(765) DEFAULT '' ,
|
||||||
user_website varchar2(600) DEFAULT '' ,
|
user_website varchar2(600) DEFAULT '' ,
|
||||||
user_occ clob DEFAULT '' ,
|
|
||||||
user_interests clob DEFAULT '' ,
|
user_interests clob DEFAULT '' ,
|
||||||
user_actkey varchar2(32) DEFAULT '' ,
|
user_actkey varchar2(32) DEFAULT '' ,
|
||||||
user_newpasswd varchar2(120) DEFAULT '' ,
|
user_newpasswd varchar2(120) DEFAULT '' ,
|
||||||
|
|
|
@ -882,6 +882,7 @@ CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order)
|
||||||
*/
|
*/
|
||||||
CREATE TABLE phpbb_profile_fields_data (
|
CREATE TABLE phpbb_profile_fields_data (
|
||||||
user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
|
user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
|
||||||
|
pf_phpbb_occupation varchar(4000) DEFAULT '' NOT NULL,
|
||||||
PRIMARY KEY (user_id)
|
PRIMARY KEY (user_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1304,7 +1305,6 @@ CREATE TABLE phpbb_users (
|
||||||
user_msnm varchar(255) DEFAULT '' NOT NULL,
|
user_msnm varchar(255) DEFAULT '' NOT NULL,
|
||||||
user_jabber varchar(255) DEFAULT '' NOT NULL,
|
user_jabber varchar(255) DEFAULT '' NOT NULL,
|
||||||
user_website varchar(200) DEFAULT '' NOT NULL,
|
user_website varchar(200) DEFAULT '' NOT NULL,
|
||||||
user_occ varchar(4000) DEFAULT '' NOT NULL,
|
|
||||||
user_interests varchar(4000) DEFAULT '' NOT NULL,
|
user_interests varchar(4000) DEFAULT '' NOT NULL,
|
||||||
user_actkey varchar(32) DEFAULT '' NOT NULL,
|
user_actkey varchar(32) DEFAULT '' NOT NULL,
|
||||||
user_newpasswd varchar(40) DEFAULT '' NOT NULL,
|
user_newpasswd varchar(40) DEFAULT '' NOT NULL,
|
||||||
|
|
|
@ -467,10 +467,10 @@ INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id,
|
||||||
INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts_approved, forum_posts_unapproved, forum_posts_softdeleted, forum_topics_approved, forum_topics_unapproved, forum_topics_softdeleted, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_subject, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents, forum_flags) VALUES ('{L_FORUMS_TEST_FORUM_TITLE}', '{L_FORUMS_TEST_FORUM_DESC}', 2, 3, 1, 1, 1, 0, 0, 1, 0, 0, 1, 2, 'Admin', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', 972086460, '', '', '', '', '', '', '', 0, 0, '', 48);
|
INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts_approved, forum_posts_unapproved, forum_posts_softdeleted, forum_topics_approved, forum_topics_unapproved, forum_topics_softdeleted, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_subject, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents, forum_flags) VALUES ('{L_FORUMS_TEST_FORUM_TITLE}', '{L_FORUMS_TEST_FORUM_DESC}', 2, 3, 1, 1, 1, 0, 0, 1, 0, 0, 1, 2, 'Admin', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', 972086460, '', '', '', '', '', '', '', 0, 0, '', 48);
|
||||||
|
|
||||||
# -- Users / Anonymous user
|
# -- Users / Anonymous user
|
||||||
INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_from, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_website, user_occ, user_interests, user_actkey, user_newpasswd, user_allow_massemail) VALUES (2, 1, 'Anonymous', 'anonymous', 0, '', '', 'en', 1, 0, '', 0, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 0);
|
INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_from, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_website, user_interests, user_actkey, user_newpasswd, user_allow_massemail) VALUES (2, 1, 'Anonymous', 'anonymous', 0, '', '', 'en', 1, 0, '', 0, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', '', '', 0);
|
||||||
|
|
||||||
# -- username: Admin password: admin (change this or remove it once everything is working!)
|
# -- username: Admin password: admin (change this or remove it once everything is working!)
|
||||||
INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_from, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_website, user_occ, user_interests, user_actkey, user_newpasswd) VALUES (3, 5, 'Admin', 'admin', 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', 'en', 1, 1, 'AA0000', 1, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
|
INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_from, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_website, user_interests, user_actkey, user_newpasswd) VALUES (3, 5, 'Admin', 'admin', 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', 'en', 1, 1, 'AA0000', 1, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', '', '');
|
||||||
|
|
||||||
# -- Groups
|
# -- Groups
|
||||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GUESTS', 3, 0, '', 0, '', '', '', 5);
|
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GUESTS', 3, 0, '', 0, '', '', '', 5);
|
||||||
|
@ -787,6 +787,9 @@ INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'mp3');
|
||||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogg');
|
INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogg');
|
||||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogm');
|
INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogm');
|
||||||
|
|
||||||
|
# Add default profile fields
|
||||||
|
INSERT INTO phpbb_profile_fields ('field_name', 'field_type', 'field_ident', 'field_length', 'field_minlen', 'field_maxlen', 'field_novalue', 'field_default_value', 'field_validation', 'field_required', 'field_show_novalue', 'field_show_on_reg', 'field_show_on_pm', 'field_show_on_vt', 'field_show_profile', 'field_hide', 'field_no_view', 'field_active', 'field_order') VALUES ('phpbb_occupation', 'profilefields.type.text', 'phpbb_occupation', '3|30', '2', '500', '', '', '.*', 0, 0, 0, 0, 0, 1, 0, 0, 1, 1);
|
||||||
|
|
||||||
# User Notification Options (for first user)
|
# User Notification Options (for first user)
|
||||||
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, '');
|
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, '');
|
||||||
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, 'email');
|
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, 'email');
|
||||||
|
|
|
@ -652,6 +652,7 @@ CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order)
|
||||||
# Table: 'phpbb_profile_fields_data'
|
# Table: 'phpbb_profile_fields_data'
|
||||||
CREATE TABLE phpbb_profile_fields_data (
|
CREATE TABLE phpbb_profile_fields_data (
|
||||||
user_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
user_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
pf_phpbb_occupation text(65535) NOT NULL DEFAULT '',
|
||||||
PRIMARY KEY (user_id)
|
PRIMARY KEY (user_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1003,7 +1004,6 @@ CREATE TABLE phpbb_users (
|
||||||
user_msnm varchar(255) NOT NULL DEFAULT '',
|
user_msnm varchar(255) NOT NULL DEFAULT '',
|
||||||
user_jabber varchar(255) NOT NULL DEFAULT '',
|
user_jabber varchar(255) NOT NULL DEFAULT '',
|
||||||
user_website varchar(200) NOT NULL DEFAULT '',
|
user_website varchar(200) NOT NULL DEFAULT '',
|
||||||
user_occ text(65535) NOT NULL DEFAULT '',
|
|
||||||
user_interests text(65535) NOT NULL DEFAULT '',
|
user_interests text(65535) NOT NULL DEFAULT '',
|
||||||
user_actkey varchar(32) NOT NULL DEFAULT '',
|
user_actkey varchar(32) NOT NULL DEFAULT '',
|
||||||
user_newpasswd varchar(40) NOT NULL DEFAULT '',
|
user_newpasswd varchar(40) NOT NULL DEFAULT '',
|
||||||
|
|
|
@ -644,7 +644,6 @@ switch ($mode)
|
||||||
'POSTS_DAY' => $user->lang('POST_DAY', $posts_per_day),
|
'POSTS_DAY' => $user->lang('POST_DAY', $posts_per_day),
|
||||||
'POSTS_PCT' => $user->lang('POST_PCT', $percentage),
|
'POSTS_PCT' => $user->lang('POST_PCT', $percentage),
|
||||||
|
|
||||||
'OCCUPATION' => (!empty($member['user_occ'])) ? censor_text($member['user_occ']) : '',
|
|
||||||
'INTERESTS' => (!empty($member['user_interests'])) ? censor_text($member['user_interests']) : '',
|
'INTERESTS' => (!empty($member['user_interests'])) ? censor_text($member['user_interests']) : '',
|
||||||
'SIGNATURE' => $member['user_sig'],
|
'SIGNATURE' => $member['user_sig'],
|
||||||
'POSTS_IN_QUEUE'=> $member['posts_in_queue'],
|
'POSTS_IN_QUEUE'=> $member['posts_in_queue'],
|
||||||
|
|
146
phpBB/phpbb/db/migration/data/v310/profilefield_occupation.php
Normal file
146
phpBB/phpbb/db/migration/data/v310/profilefield_occupation.php
Normal file
|
@ -0,0 +1,146 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package migration
|
||||||
|
* @copyright (c) 2014 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\db\migration\data\v310;
|
||||||
|
|
||||||
|
class profilefield_occupation extends \phpbb\db\migration\migration
|
||||||
|
{
|
||||||
|
public function effectively_installed()
|
||||||
|
{
|
||||||
|
return $this->db_tools->sql_column_exists($this->table_prefix . 'profile_fields_data', 'pf_phpbb_occupation');
|
||||||
|
}
|
||||||
|
|
||||||
|
static public function depends_on()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'\phpbb\db\migration\data\v310\profilefield_types',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update_schema()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'change_columns' => array(
|
||||||
|
$this->table_prefix . 'profile_fields_data' => array(
|
||||||
|
'pf_phpbb_occupation' => array('MTEXT', ''),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update_data()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array('custom', array(array($this, 'create_occupation_custom_field'))),
|
||||||
|
array('custom', array(array($this, 'convert_occupation_to_custom_field'))),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create_occupation_custom_field()
|
||||||
|
{
|
||||||
|
$sql = 'SELECT MAX(field_order) as max_field_order
|
||||||
|
FROM ' . PROFILE_FIELDS_TABLE;
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
$max_field_order = (int) $this->db->sql_fetchfield('max_field_order');
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$sql_ary = array(
|
||||||
|
'field_name' => 'phpbb_occupation',
|
||||||
|
'field_type' => 'profilefields.type.text',
|
||||||
|
'field_ident' => 'phpbb_occupation',
|
||||||
|
'field_length' => '3|30',
|
||||||
|
'field_minlen' => '2',
|
||||||
|
'field_maxlen' => '500',
|
||||||
|
'field_novalue' => '',
|
||||||
|
'field_default_value' => '',
|
||||||
|
'field_validation' => '.*',
|
||||||
|
'field_required' => 0,
|
||||||
|
'field_show_novalue' => 0,
|
||||||
|
'field_show_on_reg' => 0,
|
||||||
|
'field_show_on_pm' => 0,
|
||||||
|
'field_show_on_vt' => 0,
|
||||||
|
'field_show_profile' => 1,
|
||||||
|
'field_hide' => 0,
|
||||||
|
'field_no_view' => 0,
|
||||||
|
'field_active' => 1,
|
||||||
|
'field_order' => $max_field_order + 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
$sql = 'INSERT INTO ' . PROFILE_FIELDS_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
|
||||||
|
$this->db->sql_query($sql);
|
||||||
|
$field_id = (int) $this->db->sql_nextid();
|
||||||
|
|
||||||
|
$insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, PROFILE_LANG_TABLE);
|
||||||
|
|
||||||
|
$sql = 'SELECT lang_id
|
||||||
|
FROM ' . LANG_TABLE;
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
while ($lang_id = (int) $this->db->sql_fetchfield('lang_id'))
|
||||||
|
{
|
||||||
|
$insert_buffer->add(array(
|
||||||
|
'field_id' => $field_id,
|
||||||
|
'lang_id' => $lang_id,
|
||||||
|
'lang_name' => 'OCCUPATION',
|
||||||
|
'lang_explain' => '',
|
||||||
|
'lang_default_value' => '',
|
||||||
|
));
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$insert_buffer->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $start Start of staggering step
|
||||||
|
* @return mixed int start of the next step, null if the end was reached
|
||||||
|
*/
|
||||||
|
public function convert_occupation_to_custom_field($start)
|
||||||
|
{
|
||||||
|
$insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $this->table_prefix . 'profile_fields_data');
|
||||||
|
$limit = 250;
|
||||||
|
$converted_users = 0;
|
||||||
|
|
||||||
|
$sql = 'SELECT user_id, user_occ
|
||||||
|
FROM ' . $this->table_prefix . "users
|
||||||
|
WHERE user_occ <> ''
|
||||||
|
ORDER BY user_id";
|
||||||
|
$result = $this->db->sql_query_limit($sql, $limit, $start);
|
||||||
|
|
||||||
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$converted_users++;
|
||||||
|
|
||||||
|
$cp_data = array(
|
||||||
|
'pf_phpbb_occupation' => $row['user_occ'],
|
||||||
|
);
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . $this->fields_data_table . '
|
||||||
|
SET ' . $this->db->sql_build_array('UPDATE', $cp_data) . '
|
||||||
|
WHERE user_id = ' . (int) $row['user_id'];
|
||||||
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
|
if (!$this->db->sql_affectedrows())
|
||||||
|
{
|
||||||
|
$cp_data['user_id'] = (int) $row['user_id'];
|
||||||
|
$insert_buffer->insert($cp_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$insert_buffer->flush();
|
||||||
|
|
||||||
|
if ($converted_users < $limit)
|
||||||
|
{
|
||||||
|
// No more users left, we are done...
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $start + $limit;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue