User Group Display Style Priority not being followed if user group title or banner text fields are empty

Affected version
2.2.7

Mouth

Well-known member
I have the following user group settings ....

SQL:
mysql> select user_group_id, title, display_style_priority, user_title, banner_text from xf_user_group where display_style_priority > 0 order by display_style_priority asc;
+---------------+----------------------------+------------------------+----------------+----------------+
| user_group_id | title                      | display_style_priority | user_title     | banner_text    |
+---------------+----------------------------+------------------------+----------------+----------------+
|             1 | Unregistered / Unconfirmed |                      5 | Guest          |                |
|             2 | Registered Users           |                     20 | I'm New Here   | Newcomer       |
|            25 | Established Members        |                     50 | Member         | Member         |
|            17 | Premium Members            |                    100 | Premium Member | Premium Member |
|            22 | Vendors                    |                    150 | Vendor         | Vendor         |
|            32 | In Memoriam                |                    600 | In Memoriam    | In Memoriam    |
|            20 | Banned Users               |                    700 | ** Banned **   |                |
|             4 | Moderators                 |                    900 | Moderator      | Moderator      |
|             3 | Administrative Users       |                   1000 | Administrator  |                |
+---------------+----------------------------+------------------------+----------------+----------------+
9 rows in set (0.00 sec)

... and the following user ...

SQL:
mysql> select username, custom_title, user_group_id, secondary_group_ids, is_banned from xf_user where user_id = 84345;
+----------+--------------+---------------+---------------------+-----------+
| username | custom_title | user_group_id | secondary_group_ids | is_banned |
+----------+--------------+---------------+---------------------+-----------+
| shineb99 |              |             2 | 20                  |         1 |
+----------+--------------+---------------+---------------------+-----------+
1 row in set (0.00 sec)

... this member (and members in the 'Banned Users (20)' user group, that being their highest user group display priority) should adhere to this user group's (Banned, 20) display styling ...

Screen Shot 2021-10-01 at 21.23.26.png Screen Shot 2021-10-01 at 21.23.34.png

... but because the above 'User banner text field for user group (Banned,20) is empty, xF is instead dropping back to the next highest user group (Registered,2) and using its 'User banner text'. The same also occurs if the 'user title override - use the following user title:' field is empty.

For example ...

Screen Shot 2021-10-01 at 21.30.31.png

... the User Title is correct, coming from the (Banned,20) user group, but the Banner Text (and styling) is incorrect, instead coming from the (Registered,2) user group ....

Screen Shot 2021-10-01 at 21.32.47.png

Likewise, if I empty the User Title field for the (Banned,20) user group, the member will instead display the User Title from (Registered,2) user group.

TL;DR / Bug ... If the User Title text and/or User Banner text is empty in a members highest display priority user group, xF will instead use the lower (next highest display priority) user group's User Title text and/or User Banner text.
 
Top