mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-19 23:32:02 +02:00
[ticket/12169] Add new option to display profile fields on memberlist
PHPBB3-12169
This commit is contained in:
parent
3c46aeb005
commit
995019a992
@ -63,6 +63,10 @@
|
||||
<dt><label for="field_show_on_vt">{L_DISPLAY_ON_VT}{L_COLON}</label><br /><span>{L_DISPLAY_ON_VT_EXPLAIN}</span></dt>
|
||||
<dd><input type="checkbox" class="radio" id="field_show_on_vt" name="field_show_on_vt" value="1"<!-- IF S_SHOW_ON_VT --> checked="checked"<!-- ENDIF --> /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="field_show_on_ml">{L_DISPLAY_ON_MEMBERLIST}{L_COLON}</label><br /><span>{L_DISPLAY_ON_MEMBERLIST_EXPLAIN}</span></dt>
|
||||
<dd><input type="checkbox" class="radio" id="field_show_on_ml" name="field_show_on_ml" value="1"<!-- IF S_SHOW_ON_MEMBERLIST --> checked="checked"<!-- ENDIF --> /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="field_required">{L_REQUIRED_FIELD}{L_COLON}</label><br /><span>{L_REQUIRED_FIELD_EXPLAIN}</span></dt>
|
||||
<dd><input type="checkbox" class="radio" id="field_required" name="field_required" value="1"<!-- IF S_FIELD_REQUIRED --> checked="checked"<!-- ENDIF --> /></dd>
|
||||
|
@ -385,6 +385,7 @@ class acp_profile
|
||||
'field_show_on_reg' => 0,
|
||||
'field_show_on_pm' => 0,
|
||||
'field_show_on_vt' => 0,
|
||||
'field_show_on_ml' => 0,
|
||||
'lang_name' => utf8_normalize_nfc(request_var('field_ident', '', true)),
|
||||
'lang_explain' => '',
|
||||
'lang_default_value'=> '')
|
||||
@ -395,7 +396,7 @@ class acp_profile
|
||||
|
||||
// $exclude contains the data we gather in each step
|
||||
$exclude = array(
|
||||
1 => array('field_ident', 'lang_name', 'lang_explain', 'field_option_none', 'field_show_on_reg', 'field_show_on_pm', 'field_show_on_vt', 'field_required', 'field_show_novalue', '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_pm', 'field_show_on_vt', 'field_show_on_ml', 'field_required', 'field_show_novalue', 'field_hide', 'field_show_profile', 'field_no_view'),
|
||||
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')
|
||||
);
|
||||
@ -407,6 +408,7 @@ class acp_profile
|
||||
'field_show_on_reg',
|
||||
'field_show_on_pm',
|
||||
'field_show_on_vt',
|
||||
'field_show_on_ml',
|
||||
'field_show_profile',
|
||||
'field_hide',
|
||||
);
|
||||
@ -620,6 +622,7 @@ class acp_profile
|
||||
'S_SHOW_ON_REG' => ($cp->vars['field_show_on_reg']) ? true : false,
|
||||
'S_SHOW_ON_PM' => ($cp->vars['field_show_on_pm']) ? true : false,
|
||||
'S_SHOW_ON_VT' => ($cp->vars['field_show_on_vt']) ? true : false,
|
||||
'S_SHOW_ON_MEMBERLIST'=> ($cp->vars['field_show_on_ml']) ? true : false,
|
||||
'S_FIELD_HIDE' => ($cp->vars['field_hide']) ? true : false,
|
||||
'S_SHOW_PROFILE' => ($cp->vars['field_show_profile']) ? true : false,
|
||||
'S_FIELD_NO_VIEW' => ($cp->vars['field_no_view']) ? true : false,
|
||||
@ -880,6 +883,7 @@ class acp_profile
|
||||
'field_show_on_reg' => $cp->vars['field_show_on_reg'],
|
||||
'field_show_on_pm' => $cp->vars['field_show_on_pm'],
|
||||
'field_show_on_vt' => $cp->vars['field_show_on_vt'],
|
||||
'field_show_on_ml' => $cp->vars['field_show_on_ml'],
|
||||
'field_hide' => $cp->vars['field_hide'],
|
||||
'field_show_profile' => $cp->vars['field_show_profile'],
|
||||
'field_no_view' => $cp->vars['field_no_view']
|
||||
|
@ -771,6 +771,7 @@ $schema_data['phpbb_profile_fields'] = array(
|
||||
'field_show_on_reg' => array('BOOL', 0),
|
||||
'field_show_on_pm' => array('BOOL', 0),
|
||||
'field_show_on_vt' => array('BOOL', 0),
|
||||
'field_show_on_ml' => array('BOOL', 0),
|
||||
'field_show_profile' => array('BOOL', 0),
|
||||
'field_hide' => array('BOOL', 0),
|
||||
'field_no_view' => array('BOOL', 0),
|
||||
|
@ -921,6 +921,7 @@ CREATE TABLE phpbb_profile_fields (
|
||||
field_show_on_reg INTEGER DEFAULT 0 NOT NULL,
|
||||
field_show_on_pm INTEGER DEFAULT 0 NOT NULL,
|
||||
field_show_on_vt INTEGER DEFAULT 0 NOT NULL,
|
||||
field_show_on_ml INTEGER DEFAULT 0 NOT NULL,
|
||||
field_show_profile INTEGER DEFAULT 0 NOT NULL,
|
||||
field_hide INTEGER DEFAULT 0 NOT NULL,
|
||||
field_no_view INTEGER DEFAULT 0 NOT NULL,
|
||||
|
@ -1127,6 +1127,7 @@ CREATE TABLE [phpbb_profile_fields] (
|
||||
[field_show_on_reg] [int] DEFAULT (0) NOT NULL ,
|
||||
[field_show_on_pm] [int] DEFAULT (0) NOT NULL ,
|
||||
[field_show_on_vt] [int] DEFAULT (0) NOT NULL ,
|
||||
[field_show_on_ml] [int] DEFAULT (0) NOT NULL ,
|
||||
[field_show_profile] [int] DEFAULT (0) NOT NULL ,
|
||||
[field_hide] [int] DEFAULT (0) NOT NULL ,
|
||||
[field_no_view] [int] DEFAULT (0) NOT NULL ,
|
||||
|
@ -658,6 +658,7 @@ CREATE TABLE phpbb_profile_fields (
|
||||
field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
field_show_on_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
field_show_on_vt tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
field_show_on_ml 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_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
|
@ -658,6 +658,7 @@ CREATE TABLE phpbb_profile_fields (
|
||||
field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
field_show_on_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
field_show_on_vt tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
field_show_on_ml 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_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
|
@ -1230,6 +1230,7 @@ CREATE TABLE phpbb_profile_fields (
|
||||
field_show_on_reg number(1) DEFAULT '0' NOT NULL,
|
||||
field_show_on_pm number(1) DEFAULT '0' NOT NULL,
|
||||
field_show_on_vt number(1) DEFAULT '0' NOT NULL,
|
||||
field_show_on_ml number(1) DEFAULT '0' NOT NULL,
|
||||
field_show_profile number(1) DEFAULT '0' NOT NULL,
|
||||
field_hide number(1) DEFAULT '0' NOT NULL,
|
||||
field_no_view number(1) DEFAULT '0' NOT NULL,
|
||||
|
@ -866,6 +866,7 @@ CREATE TABLE phpbb_profile_fields (
|
||||
field_show_on_reg INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_reg >= 0),
|
||||
field_show_on_pm INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_pm >= 0),
|
||||
field_show_on_vt INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_vt >= 0),
|
||||
field_show_on_ml INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_ml >= 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_no_view INT2 DEFAULT '0' NOT NULL CHECK (field_no_view >= 0),
|
||||
|
@ -788,9 +788,9 @@ INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogg');
|
||||
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_location', 'profilefields.type.string', 'phpbb_location', '20', '2', '100', '', '', '.*', 0, 0, 0, 1, 1, 1, 0, 0, 1, 1);
|
||||
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_interests', 'profilefields.type.text', 'phpbb_interests', '3|30', '2', '500', '', '', '.*', 0, 0, 0, 0, 0, 1, 0, 0, 1, 2);
|
||||
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, 3);
|
||||
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_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order) VALUES ('phpbb_location', 'profilefields.type.string', 'phpbb_location', '20', '2', '100', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1);
|
||||
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_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order) VALUES ('phpbb_interests', 'profilefields.type.text', 'phpbb_interests', '3|30', '2', '500', '', '', '.*', 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 2);
|
||||
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_on_ml, 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, 0, 1, 0, 0, 1, 3);
|
||||
|
||||
# User Notification Options (for first user)
|
||||
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, '');
|
||||
|
@ -639,6 +639,7 @@ CREATE TABLE phpbb_profile_fields (
|
||||
field_show_on_reg INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
field_show_on_pm INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
field_show_on_vt INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
field_show_on_ml INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
field_show_profile INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
field_hide INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
field_no_view INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
|
@ -65,6 +65,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_REGISTER' => 'Display on registration screen',
|
||||
'DISPLAY_AT_REGISTER_EXPLAIN' => 'If this option is enabled, the field will be displayed on registration.',
|
||||
'DISPLAY_ON_MEMBERLIST' => 'Display on memberlist screen',
|
||||
'DISPLAY_ON_MEMBERLIST_EXPLAIN' => 'If this option is enabled, the field will be displayed in the user rows on the memberlist screen.',
|
||||
'DISPLAY_ON_PM' => 'Display on view pm screen',
|
||||
'DISPLAY_ON_PM_EXPLAIN' => 'If this option is enabled, the field will be displayed in the mini-profile on the pm screen.',
|
||||
'DISPLAY_ON_VT' => 'Display on viewtopic screen',
|
||||
|
@ -1508,8 +1508,7 @@ switch ($mode)
|
||||
{
|
||||
$cp = $phpbb_container->get('profilefields.manager');
|
||||
|
||||
// @todo: Add separate setting for this.
|
||||
$cp_row = $cp->generate_profile_fields_template('headlines', false, false, 'field_show_on_pm');
|
||||
$cp_row = $cp->generate_profile_fields_template('headlines', false, false, 'field_show_on_ml');
|
||||
foreach ($cp_row as $profile_field)
|
||||
{
|
||||
$template->assign_block_vars('custom_fields', $profile_field);
|
||||
@ -1574,7 +1573,7 @@ switch ($mode)
|
||||
{
|
||||
foreach ($user_profile_fields as $field_ident => $profile_field)
|
||||
{
|
||||
if (!$profile_field['data']['field_show_on_pm'])
|
||||
if (!$profile_field['data']['field_show_on_ml'])
|
||||
{
|
||||
unset($profile_fields_cache[$user_id][$field_ident]);
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ class profilefield_location extends \phpbb\db\migration\profilefield_base_migrat
|
||||
{
|
||||
return array(
|
||||
'\phpbb\db\migration\data\v310\profilefield_types',
|
||||
'\phpbb\db\migration\data\v310\profilefield_on_memberlist',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,47 @@
|
||||
<?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_on_memberlist extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
return $this->db_tools->sql_column_exists($this->table_prefix . 'profile_fields', 'field_show_on_ml');
|
||||
}
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\phpbb\db\migration\data\v310\profilefield_cleanup',
|
||||
);
|
||||
}
|
||||
|
||||
public function update_schema()
|
||||
{
|
||||
return array(
|
||||
'add_columns' => array(
|
||||
$this->table_prefix . 'profile_fields' => array(
|
||||
'field_show_on_ml' => array('BOOL', 0),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function revert_schema()
|
||||
{
|
||||
return array(
|
||||
'drop_columns' => array(
|
||||
$this->table_prefix . 'profile_fields' => array(
|
||||
'field_show_on_ml',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user