git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9916 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Henry Sudhof 2009-08-03 15:46:56 +00:00
parent d376811e7f
commit 1f871950d8
13 changed files with 52 additions and 6 deletions

View file

@ -1408,6 +1408,7 @@ function get_schema_struct()
'field_validation' => array('VCHAR_UNI:20', ''), 'field_validation' => array('VCHAR_UNI:20', ''),
'field_required' => array('BOOL', 0), 'field_required' => array('BOOL', 0),
'field_show_on_reg' => array('BOOL', 0), 'field_show_on_reg' => array('BOOL', 0),
'field_show_on_vt' => array('BOOL', 0),
'field_show_profile' => array('BOOL', 0), 'field_show_profile' => array('BOOL', 0),
'field_hide' => array('BOOL', 0), 'field_hide' => array('BOOL', 0),
'field_no_view' => array('BOOL', 0), 'field_no_view' => array('BOOL', 0),

View file

@ -258,9 +258,9 @@
</li> </li>
<li>[Feature] Display version check on ACP main page.</li> <li>[Feature] Display version check on ACP main page.</li>
<li>[Feature] Ability to copy permissions from one forum to several other forums.</li> <li>[Feature] Ability to copy permissions from one forum to several other forums.</li>
<li>[Feature] Ability to control the display of custom profile fields on viewtopic (Bug #48985).</li>
<li>[Feature] Fallback options for missing language files. (Bug #38575 - Patch by EXreaction)</li> <li>[Feature] Fallback options for missing language files. (Bug #38575 - Patch by EXreaction)</li>
</ul> </ul>
<a name="v304"></a><h3>1.ii. Changes since 3.0.4</h3> <a name="v304"></a><h3>1.ii. Changes since 3.0.4</h3>
<ul> <ul>

View file

@ -369,6 +369,7 @@ class acp_profile
'field_show_profile'=> 0, 'field_show_profile'=> 0,
'field_no_view' => 0, 'field_no_view' => 0,
'field_show_on_reg' => 0, 'field_show_on_reg' => 0,
'field_show_on_vt' => 0,
'lang_name' => utf8_normalize_nfc(request_var('field_ident', '', true)), 'lang_name' => utf8_normalize_nfc(request_var('field_ident', '', true)),
'lang_explain' => '', 'lang_explain' => '',
'lang_default_value'=> '') 'lang_default_value'=> '')
@ -379,7 +380,7 @@ class acp_profile
// $exclude contains the data we gather in each step // $exclude contains the data we gather in each step
$exclude = array( $exclude = array(
1 => array('field_ident', 'lang_name', 'lang_explain', 'field_option_none', 'field_show_on_reg', 'field_required', 'field_hide', 'field_show_profile', 'field_no_view'), 1 => array('field_ident', 'lang_name', 'lang_explain', 'field_option_none', 'field_show_on_reg', 'field_show_on_vt', 'field_required', 'field_hide', 'field_show_profile', 'field_no_view'),
2 => array('field_length', 'field_maxlen', 'field_minlen', 'field_validation', 'field_novalue', 'field_default_value'), 2 => array('field_length', 'field_maxlen', 'field_minlen', 'field_validation', 'field_novalue', 'field_default_value'),
3 => array('l_lang_name', 'l_lang_explain', 'l_lang_default_value', 'l_lang_options') 3 => array('l_lang_name', 'l_lang_explain', 'l_lang_default_value', 'l_lang_options')
); );
@ -405,6 +406,7 @@ class acp_profile
$visibility_ary = array( $visibility_ary = array(
'field_required', 'field_required',
'field_show_on_reg', 'field_show_on_reg',
'field_show_on_vt',
'field_show_profile', 'field_show_profile',
'field_hide', 'field_hide',
); );
@ -721,6 +723,7 @@ class acp_profile
'S_STEP_ONE' => true, 'S_STEP_ONE' => true,
'S_FIELD_REQUIRED' => ($cp->vars['field_required']) ? true : false, 'S_FIELD_REQUIRED' => ($cp->vars['field_required']) ? true : false,
'S_SHOW_ON_REG' => ($cp->vars['field_show_on_reg']) ? true : false, 'S_SHOW_ON_REG' => ($cp->vars['field_show_on_reg']) ? true : false,
'S_SHOW_ON_VT' => ($cp->vars['field_show_on_vt']) ? true : false,
'S_FIELD_HIDE' => ($cp->vars['field_hide']) ? true : false, 'S_FIELD_HIDE' => ($cp->vars['field_hide']) ? true : false,
'S_SHOW_PROFILE' => ($cp->vars['field_show_profile']) ? true : false, 'S_SHOW_PROFILE' => ($cp->vars['field_show_profile']) ? true : false,
'S_FIELD_NO_VIEW' => ($cp->vars['field_no_view']) ? true : false, 'S_FIELD_NO_VIEW' => ($cp->vars['field_no_view']) ? true : false,
@ -1036,6 +1039,7 @@ class acp_profile
'field_validation' => $cp->vars['field_validation'], 'field_validation' => $cp->vars['field_validation'],
'field_required' => $cp->vars['field_required'], 'field_required' => $cp->vars['field_required'],
'field_show_on_reg' => $cp->vars['field_show_on_reg'], 'field_show_on_reg' => $cp->vars['field_show_on_reg'],
'field_show_on_vt' => $cp->vars['field_show_on_vt'],
'field_hide' => $cp->vars['field_hide'], 'field_hide' => $cp->vars['field_hide'],
'field_show_profile' => $cp->vars['field_show_profile'], 'field_show_profile' => $cp->vars['field_show_profile'],
'field_no_view' => $cp->vars['field_no_view'] 'field_no_view' => $cp->vars['field_no_view']

View file

@ -704,6 +704,9 @@ function database_update_info()
REPORTS_TABLE => array( REPORTS_TABLE => array(
'pm_id' => array('UINT', 0), 'pm_id' => array('UINT', 0),
), ),
PROFILE_FIELDS_TABLE => array(
'field_show_on_vt' => array('BOOL', 0),
),
), ),
'change_columns' => array( 'change_columns' => array(
USERS_TABLE => array( USERS_TABLE => array(

View file

@ -790,6 +790,7 @@ CREATE TABLE phpbb_profile_fields (
field_validation VARCHAR(20) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, field_validation VARCHAR(20) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
field_required INTEGER DEFAULT 0 NOT NULL, field_required INTEGER DEFAULT 0 NOT NULL,
field_show_on_reg INTEGER DEFAULT 0 NOT NULL, field_show_on_reg INTEGER DEFAULT 0 NOT NULL,
field_show_on_vt INTEGER DEFAULT 0 NOT NULL,
field_show_profile INTEGER DEFAULT 0 NOT NULL, field_show_profile INTEGER DEFAULT 0 NOT NULL,
field_hide INTEGER DEFAULT 0 NOT NULL, field_hide INTEGER DEFAULT 0 NOT NULL,
field_no_view INTEGER DEFAULT 0 NOT NULL, field_no_view INTEGER DEFAULT 0 NOT NULL,
@ -1370,7 +1371,9 @@ CREATE TABLE phpbb_users (
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,
user_form_salt VARCHAR(32) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, user_form_salt VARCHAR(32) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
user_new INTEGER DEFAULT 1 NOT NULL user_new INTEGER DEFAULT 1 NOT NULL,
user_reminded INTEGER DEFAULT 0 NOT NULL,
user_reminded_time INTEGER DEFAULT 0 NOT NULL
);; );;
ALTER TABLE phpbb_users ADD PRIMARY KEY (user_id);; ALTER TABLE phpbb_users ADD PRIMARY KEY (user_id);;

View file

@ -948,6 +948,7 @@ CREATE TABLE [phpbb_profile_fields] (
[field_validation] [varchar] (20) DEFAULT ('') NOT NULL , [field_validation] [varchar] (20) DEFAULT ('') NOT NULL ,
[field_required] [int] DEFAULT (0) NOT NULL , [field_required] [int] DEFAULT (0) NOT NULL ,
[field_show_on_reg] [int] DEFAULT (0) NOT NULL , [field_show_on_reg] [int] DEFAULT (0) NOT NULL ,
[field_show_on_vt] [int] DEFAULT (0) NOT NULL ,
[field_show_profile] [int] DEFAULT (0) NOT NULL , [field_show_profile] [int] DEFAULT (0) NOT NULL ,
[field_hide] [int] DEFAULT (0) NOT NULL , [field_hide] [int] DEFAULT (0) NOT NULL ,
[field_no_view] [int] DEFAULT (0) NOT NULL , [field_no_view] [int] DEFAULT (0) NOT NULL ,
@ -1645,7 +1646,9 @@ CREATE TABLE [phpbb_users] (
[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 ,
[user_form_salt] [varchar] (32) DEFAULT ('') NOT NULL , [user_form_salt] [varchar] (32) DEFAULT ('') NOT NULL ,
[user_new] [int] DEFAULT (1) NOT NULL [user_new] [int] DEFAULT (1) NOT NULL ,
[user_reminded] [int] DEFAULT (0) NOT NULL ,
[user_reminded_time] [int] DEFAULT (0) NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO GO

View file

@ -554,6 +554,7 @@ CREATE TABLE phpbb_profile_fields (
field_validation varbinary(60) DEFAULT '' NOT NULL, field_validation varbinary(60) DEFAULT '' NOT NULL,
field_required tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_required tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_show_on_vt tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_show_profile tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_show_profile tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_hide tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_hide tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
@ -971,6 +972,8 @@ CREATE TABLE phpbb_users (
user_newpasswd varbinary(120) DEFAULT '' NOT NULL, user_newpasswd varbinary(120) DEFAULT '' NOT NULL,
user_form_salt varbinary(96) DEFAULT '' NOT NULL, user_form_salt varbinary(96) DEFAULT '' NOT NULL,
user_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, user_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
user_reminded tinyint(4) DEFAULT '0' NOT NULL,
user_reminded_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY (user_id), PRIMARY KEY (user_id),
KEY user_birthday (user_birthday), KEY user_birthday (user_birthday),
KEY user_email_hash (user_email_hash), KEY user_email_hash (user_email_hash),

View file

@ -554,6 +554,7 @@ CREATE TABLE phpbb_profile_fields (
field_validation varchar(20) DEFAULT '' NOT NULL, field_validation varchar(20) DEFAULT '' NOT NULL,
field_required tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_required tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_show_on_vt tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_show_profile tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_show_profile tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_hide tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_hide tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, field_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
@ -971,6 +972,8 @@ CREATE TABLE phpbb_users (
user_newpasswd varchar(40) DEFAULT '' NOT NULL, user_newpasswd varchar(40) DEFAULT '' NOT NULL,
user_form_salt varchar(32) DEFAULT '' NOT NULL, user_form_salt varchar(32) DEFAULT '' NOT NULL,
user_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, user_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
user_reminded tinyint(4) DEFAULT '0' NOT NULL,
user_reminded_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY (user_id), PRIMARY KEY (user_id),
KEY user_birthday (user_birthday), KEY user_birthday (user_birthday),
KEY user_email_hash (user_email_hash), KEY user_email_hash (user_email_hash),

View file

@ -1060,6 +1060,7 @@ CREATE TABLE phpbb_profile_fields (
field_validation varchar2(60) DEFAULT '' , field_validation varchar2(60) DEFAULT '' ,
field_required number(1) DEFAULT '0' NOT NULL, field_required number(1) DEFAULT '0' NOT NULL,
field_show_on_reg number(1) DEFAULT '0' NOT NULL, field_show_on_reg number(1) DEFAULT '0' NOT NULL,
field_show_on_vt number(1) DEFAULT '0' NOT NULL,
field_show_profile number(1) DEFAULT '0' NOT NULL, field_show_profile number(1) DEFAULT '0' NOT NULL,
field_hide number(1) DEFAULT '0' NOT NULL, field_hide number(1) DEFAULT '0' NOT NULL,
field_no_view number(1) DEFAULT '0' NOT NULL, field_no_view number(1) DEFAULT '0' NOT NULL,
@ -1791,6 +1792,8 @@ CREATE TABLE phpbb_users (
user_newpasswd varchar2(120) DEFAULT '' , user_newpasswd varchar2(120) DEFAULT '' ,
user_form_salt varchar2(96) DEFAULT '' , user_form_salt varchar2(96) DEFAULT '' ,
user_new number(1) DEFAULT '1' NOT NULL, user_new number(1) DEFAULT '1' NOT NULL,
user_reminded number(4) DEFAULT '0' NOT NULL,
user_reminded_time number(11) DEFAULT '0' NOT NULL,
CONSTRAINT pk_phpbb_users PRIMARY KEY (user_id), CONSTRAINT pk_phpbb_users PRIMARY KEY (user_id),
CONSTRAINT u_phpbb_username_clean UNIQUE (username_clean) CONSTRAINT u_phpbb_username_clean UNIQUE (username_clean)
) )

View file

@ -741,6 +741,7 @@ CREATE TABLE phpbb_profile_fields (
field_validation varchar(20) DEFAULT '' NOT NULL, field_validation varchar(20) DEFAULT '' NOT NULL,
field_required INT2 DEFAULT '0' NOT NULL CHECK (field_required >= 0), field_required INT2 DEFAULT '0' NOT NULL CHECK (field_required >= 0),
field_show_on_reg INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_reg >= 0), field_show_on_reg INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_reg >= 0),
field_show_on_vt INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_vt >= 0),
field_show_profile INT2 DEFAULT '0' NOT NULL CHECK (field_show_profile >= 0), field_show_profile INT2 DEFAULT '0' NOT NULL CHECK (field_show_profile >= 0),
field_hide INT2 DEFAULT '0' NOT NULL CHECK (field_hide >= 0), field_hide INT2 DEFAULT '0' NOT NULL CHECK (field_hide >= 0),
field_no_view INT2 DEFAULT '0' NOT NULL CHECK (field_no_view >= 0), field_no_view INT2 DEFAULT '0' NOT NULL CHECK (field_no_view >= 0),
@ -1234,6 +1235,8 @@ CREATE TABLE phpbb_users (
user_newpasswd varchar(40) DEFAULT '' NOT NULL, user_newpasswd varchar(40) DEFAULT '' NOT NULL,
user_form_salt varchar(32) DEFAULT '' NOT NULL, user_form_salt varchar(32) DEFAULT '' NOT NULL,
user_new INT2 DEFAULT '1' NOT NULL CHECK (user_new >= 0), user_new INT2 DEFAULT '1' NOT NULL CHECK (user_new >= 0),
user_reminded INT2 DEFAULT '0' NOT NULL,
user_reminded_time INT4 DEFAULT '0' NOT NULL CHECK (user_reminded_time >= 0),
PRIMARY KEY (user_id) PRIMARY KEY (user_id)
); );

View file

@ -537,6 +537,7 @@ CREATE TABLE phpbb_profile_fields (
field_validation varchar(20) NOT NULL DEFAULT '', field_validation varchar(20) NOT NULL DEFAULT '',
field_required INTEGER UNSIGNED NOT NULL DEFAULT '0', field_required INTEGER UNSIGNED NOT NULL DEFAULT '0',
field_show_on_reg INTEGER UNSIGNED NOT NULL DEFAULT '0', field_show_on_reg INTEGER UNSIGNED NOT NULL DEFAULT '0',
field_show_on_vt INTEGER UNSIGNED NOT NULL DEFAULT '0',
field_show_profile INTEGER UNSIGNED NOT NULL DEFAULT '0', field_show_profile INTEGER UNSIGNED NOT NULL DEFAULT '0',
field_hide INTEGER UNSIGNED NOT NULL DEFAULT '0', field_hide INTEGER UNSIGNED NOT NULL DEFAULT '0',
field_no_view INTEGER UNSIGNED NOT NULL DEFAULT '0', field_no_view INTEGER UNSIGNED NOT NULL DEFAULT '0',
@ -940,7 +941,9 @@ CREATE TABLE phpbb_users (
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 '',
user_form_salt varchar(32) NOT NULL DEFAULT '', user_form_salt varchar(32) NOT NULL DEFAULT '',
user_new INTEGER UNSIGNED NOT NULL DEFAULT '1' user_new INTEGER UNSIGNED NOT NULL DEFAULT '1',
user_reminded tinyint(4) NOT NULL DEFAULT '0',
user_reminded_time INTEGER UNSIGNED NOT NULL DEFAULT '0'
); );
CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday); CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday);

View file

@ -66,6 +66,8 @@ $lang = array_merge($lang, array(
'DISPLAY_AT_PROFILE_EXPLAIN' => 'The user is able to change this profile field within the user control panel.', 'DISPLAY_AT_PROFILE_EXPLAIN' => 'The user is able to change this profile field within the user control panel.',
'DISPLAY_AT_REGISTER' => 'Display on registration screen', 'DISPLAY_AT_REGISTER' => 'Display on registration screen',
'DISPLAY_AT_REGISTER_EXPLAIN' => 'If this option is enabled, the field will be displayed on registration.', 'DISPLAY_AT_REGISTER_EXPLAIN' => 'If this option is enabled, the field will be displayed on registration.',
'DISPLAY_ON_VT' => 'Display on viewtopic screen',
'DISPLAY_ON_VT_EXPLAIN' => 'If this option is enabled, the field will be displayed in the mini-profile on the topic screen.',
'DISPLAY_PROFILE_FIELD' => 'Publicly display profile field', 'DISPLAY_PROFILE_FIELD' => 'Publicly display profile field',
'DISPLAY_PROFILE_FIELD_EXPLAIN' => 'The profile field will be shown in all locations allowed within the load settings. Setting this to “no” will hide the field from topic pages, profiles and the memberlist.', 'DISPLAY_PROFILE_FIELD_EXPLAIN' => 'The profile field will be shown in all locations allowed within the load settings. Setting this to “no” will hide the field from topic pages, profiles and the memberlist.',
'DROPDOWN_ENTRIES_EXPLAIN' => 'Enter your options now, every option in one line.', 'DROPDOWN_ENTRIES_EXPLAIN' => 'Enter your options now, every option in one line.',

View file

@ -1179,7 +1179,22 @@ if ($config['load_cpf_viewtopic'])
$cp = new custom_profile(); $cp = new custom_profile();
// Grab all profile fields from users in id cache for later use - similar to the poster cache // Grab all profile fields from users in id cache for later use - similar to the poster cache
$profile_fields_cache = $cp->generate_profile_fields_template('grab', $id_cache); $profile_fields_tmp = $cp->generate_profile_fields_template('grab', $id_cache);
// filter out fields not to be displayed on viewtopic. Yes, it's a hack, but this shouldn't break any MODs.
$profile_fields_cache = array();
foreach ($profile_fields_tmp as $profile_user_id => $profile_fields)
{
$profile_fields_cache[$profile_user_id] = array();
foreach ($profile_fields as $used_ident => $profile_field)
{
if ($profile_field['data']['field_show_on_vt'])
{
$profile_fields_cache[$profile_user_id][$used_ident] = $profile_field;
}
}
}
unset($profile_fields_tmp);
} }
// Generate online information for user // Generate online information for user