Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Languages/en_US/ManageSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@
$txt['custom_edit_registration_require'] = 'Yes, and require entry';
$txt['custom_edit_display'] = 'Show on Topic View';
$txt['custom_edit_mlist'] = 'Show on memberlist';
$txt['custom_edit_blist'] = 'Show on buddylist';
$txt['custom_edit_picktype'] = 'Field Type';

$txt['custom_edit_max_length'] = 'Maximum Length';
Expand Down
14 changes: 11 additions & 3 deletions Sources/Actions/Admin/Features.php
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ public function profileEdit(): void
$request = Db::$db->query(
'SELECT
id_field, col_name, field_name, field_desc, field_type, field_order, field_length, field_options,
show_reg, show_display, show_mlist, show_profile, private, active, default_value, can_search,
show_reg, show_display, show_mlist, show_blist, show_profile, private, active, default_value, can_search,
bbc, mask, enclose, placement
FROM {db_prefix}custom_fields
WHERE id_field = {int:current_field}',
Expand All @@ -969,6 +969,7 @@ public function profileEdit(): void
'reg' => $row['show_reg'],
'display' => $row['show_display'],
'mlist' => $row['show_mlist'],
'blist' => $row['show_blist'],
'type' => $row['field_type'],
'order' => $row['field_order'],
'max_length' => $row['field_length'],
Expand Down Expand Up @@ -1000,6 +1001,7 @@ public function profileEdit(): void
'reg' => false,
'display' => false,
'mlist' => false,
'blist' => false,
'type' => 'text',
'order' => 0,
'max_length' => 255,
Expand Down Expand Up @@ -1093,6 +1095,7 @@ public function profileEdit(): void
$show_reg = isset($_POST['reg']) ? (int) $_POST['reg'] : 0;
$show_display = isset($_POST['display']) ? 1 : 0;
$show_mlist = isset($_POST['mlist']) ? 1 : 0;
$show_blist = isset($_POST['blist']) ? 1 : 0;
$bbc = isset($_POST['bbc']) ? 1 : 0;
$show_profile = $_POST['profile_area'];
$active = isset($_POST['active']) ? 1 : 0;
Expand Down Expand Up @@ -1267,7 +1270,8 @@ public function profileEdit(): void
field_name = {string:field_name}, field_desc = {string:field_desc},
field_type = {string:field_type}, field_length = {int:field_length},
field_options = {string:field_options}, show_reg = {int:show_reg},
show_display = {int:show_display}, show_mlist = {int:show_mlist}, show_profile = {string:show_profile},
show_display = {int:show_display}, show_mlist = {int:show_mlist},
show_blist = {int:show_blist}, show_profile = {string:show_profile},
private = {int:private}, active = {int:active}, default_value = {string:default_value},
can_search = {int:can_search}, bbc = {int:bbc}, mask = {string:mask},
enclose = {string:enclose}, placement = {int:placement}
Expand All @@ -1277,6 +1281,7 @@ public function profileEdit(): void
'show_reg' => $show_reg,
'show_display' => $show_display,
'show_mlist' => $show_mlist,
'show_blist' => $show_blist,
'private' => $private,
'active' => $active,
'can_search' => $can_search,
Expand Down Expand Up @@ -1326,6 +1331,7 @@ public function profileEdit(): void
'show_reg' => 'int',
'show_display' => 'int',
'show_mlist' => 'int',
'show_blist' => 'int',
'show_profile' => 'string',
'private' => 'int',
'active' => 'int',
Expand All @@ -1348,6 +1354,7 @@ public function profileEdit(): void
$show_reg,
$show_display,
$show_mlist,
$show_blist,
$show_profile,
$private,
$active,
Expand Down Expand Up @@ -1405,7 +1412,7 @@ public function profileEdit(): void

$fields = [];
$request = Db::$db->query(
'SELECT col_name, field_name, field_type, field_order, bbc, enclose, placement, show_mlist, field_options
'SELECT col_name, field_name, field_type, field_order, bbc, enclose, placement, show_mlist, show_blist, field_options
FROM {db_prefix}custom_fields
WHERE show_display = {int:is_displayed}
AND active = {int:active}
Expand All @@ -1430,6 +1437,7 @@ public function profileEdit(): void
'placement' => !empty($row['placement']) ? $row['placement'] : '0',
'enclose' => !empty($row['enclose']) ? $row['enclose'] : '',
'mlist' => $row['show_mlist'],
'blist' => $row['show_blist'],
'options' => (!empty($row['field_options']) ? explode(',', $row['field_options']) : []),
];
}
Expand Down
8 changes: 5 additions & 3 deletions Sources/Actions/Profile/BuddyIgnoreLists.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,18 +216,20 @@ public function buddies(): void
$disabled_fields = isset(Config::$modSettings['disabled_profile_fields']) ? array_flip(explode(',', Config::$modSettings['disabled_profile_fields'])) : [];

$request = Db::$db->query(
'SELECT col_name, field_name, field_desc, field_type, field_options, show_mlist, bbc, enclose
'SELECT col_name, field_name, field_desc, field_type, field_options, bbc, enclose
FROM {db_prefix}custom_fields
WHERE active = {int:active}
AND private < {int:private_level}',
AND private < {int:private_level}
AND show_blist = {int:show_blist}',
[
'active' => 1,
'private_level' => 2,
'show_blist' => 1,
],
);

while ($row = Db::$db->fetch_assoc($request)) {
if (!isset($disabled_fields[$row['col_name']]) && !empty($row['show_mlist'])) {
if (!isset($disabled_fields[$row['col_name']])) {
Utils::$context['custom_pf'][$row['col_name']] = [
'label' => Lang::tokenTxtReplace($row['field_name']),
'type' => $row['field_type'],
Expand Down
10 changes: 10 additions & 0 deletions Sources/Db/Schema/v3_0/CustomFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class CustomFields extends Table
'show_reg' => 0,
'show_display' => 1,
'show_mlist' => 0,
'show_blist' => 0,
'show_profile' => 'forumprofile',
'private' => 0,
'active' => 1,
Expand All @@ -67,6 +68,7 @@ class CustomFields extends Table
'show_reg' => 0,
'show_display' => 1,
'show_mlist' => 0,
'show_blist' => 1,
'show_profile' => 'forumprofile',
'private' => 0,
'active' => 1,
Expand All @@ -88,6 +90,7 @@ class CustomFields extends Table
'show_reg' => 0,
'show_display' => 1,
'show_mlist' => 0,
'show_blist' => 1,
'show_profile' => 'forumprofile',
'private' => 0,
'active' => 1,
Expand All @@ -109,6 +112,7 @@ class CustomFields extends Table
'show_reg' => 1,
'show_display' => 1,
'show_mlist' => 0,
'show_blist' => 1,
'show_profile' => 'forumprofile',
'private' => 0,
'active' => 1,
Expand Down Expand Up @@ -208,6 +212,12 @@ public function __construct()
not_null: true,
default: 0,
),
'show_blist' => new Column(
name: 'show_blist',
type: 'smallint',
not_null: true,
default: 0,
),
'show_profile' => new Column(
name: 'show_profile',
type: 'varchar',
Expand Down
6 changes: 6 additions & 0 deletions Themes/default/Admin.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,12 @@ function template_edit_profile_field()
<dd>
<input type="checkbox" name="mlist" id="show_mlist"', Utils::$context['field']['mlist'] ? ' checked' : '', '>
</dd>
<dt>
<strong><label for="blist">', Lang::getTxt('custom_edit_blist', file: 'ManageSettings'), '</label></strong>
</dt>
<dd>
<input type="checkbox" name="blist" id="show_blist"', Utils::$context['field']['blist'] ? ' checked' : '', '>
</dd>
<dt>
<strong><label for="placement">', Lang::getTxt('custom_edit_placement', file: 'ManageSettings'), '</label></strong>
</dt>
Expand Down