Obviously people are stuck with their usernames once they register. Is it possible to add a new field, Display Name, to the forum, so people can keep changing how their names are displayed?
I actually asked this ChatGPT and this is the answer, can someone take a look please?
Steps to Add a Display Name Field in phpBB
Add a similar field in ucp_register.html if you want users to set it during registration.
To:
Update includes/functions_display.php to fetch the display name:
Go to ACP > "Purge Cache" to refresh the forum.
Test registration, profile updates, and post displays.
This will allow users to set a display name, which will be shown instead of their username in posts.
I actually asked this ChatGPT and this is the answer, can someone take a look please?
Steps to Add a Display Name Field in phpBB
- Add a New Field to the Users Table
Code:
ALTER TABLE phpbb_users ADD user_display_name VARCHAR(255) NOT NULL DEFAULT '';
- Modify the User Registration & Profile Edit Templates
Code:
<div class="input-group"> <label for="display_name">Display Name:</label> <input type="text" name="display_name" id="display_name" value="{USER_DISPLAY_NAME}" /> </div>
- Modify the User Profile Handling in PHP
Code:
case 'profile_info': $display_name = request_var('display_name', '', true); if (!empty($display_name)) { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_display_name = "' . $db->sql_escape($display_name) . '" WHERE user_id = ' . $user->data['user_id']; $db->sql_query($sql); } break;
- Modify Templates to Show Display Name Instead of Username
Code:
{postrow.POST_AUTHOR_FULL}
Code:
{postrow.USER_DISPLAY_NAME}
Code:
if (!empty($row['user_display_name'])) { $user_display_name = $row['user_display_name']; } else { $user_display_name = $row['username']; }
- Purge Cache & Test
Go to ACP > "Purge Cache" to refresh the forum.
Test registration, profile updates, and post displays.
This will allow users to set a display name, which will be shown instead of their username in posts.
Statistics: Posted by Zinnn — Tue Feb 11, 2025 1:26 pm