Skip to content

Commit

Permalink
Fixes for {ifprofile_field_...} tag.
Browse files Browse the repository at this point in the history
- Now correctly respects visibility of hidden fields setting.
- Now removes tag and text if custom field contains 0 or is empty.
  • Loading branch information
michael-milette committed May 20, 2021
1 parent 3cde69a commit 1698884
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1812,15 +1812,15 @@ function ($matches) {

// If the tag exists and is not set to "Not visible" in the custom profile field's settings.
if (isset($profiledata[$field->id]) && $isuser &&
($field->visible == '0' || get_config('filter_filtercodes', 'ifprofilefiedonlyvisible'))) {
($field->visible == '0' || !get_config('filter_filtercodes', 'ifprofilefiedonlyvisible'))) {
$data = trim($profiledata[$field->id]);
} else {
$data = '';
}

// If the value is empty or zero, remove the all of the tags and their contents for that field shortname.
if (empty($data)) {
$replace['/\{ ' . $tag . '(.*?)\}(.*?)\{\/' . $tag . '\}/ims'] = '';
$replace['/\{' . $tag . '(.*?)\}(.*?)\{\/' . $tag . '\}/ims'] = '';
continue;
}

Expand Down

0 comments on commit 1698884

Please sign in to comment.