Page 1 of 1

Mod'ing the Ext to Display User Email

Posted: Mon 27. Jun 2022, 00:34
by Dezdan
I would like to customize the extension a little bit and under each username displayed I would like to show the users email address. What is the best method to go about doing this mod? I was looking at the variables in common.php, and it appears the defines $user is referenced throughout so I can't edit it there. Any help provided would be appreciated. Thanks!

Re: Mod'ing the Ext to Display User Email

Posted: Mon 27. Jun 2022, 11:32
by Mike-on-Tour
As a first reply (prior to a more detailed look into the scripts) I would do this within the three relevant functions of ur_acp.php and the respective template files.

I will take a closer look later and come back with a more educated answer.

Re: Mod'ing the Ext to Display User Email

Posted: Mon 27. Jun 2022, 13:58
by Mike-on-Tour
It is as I initially thought, you have to change ur_acp.php, acp_ur_reminder.html, acp_ur_sleeper.html and acp_ur_zeropoater.html:

In ur_acp.php find the following lines in the function reminder:

Code: Select all

		$query = 'SELECT user_id, group_id, user_regdate, username, user_posts, mot_last_login, user_colour, mot_reminded_one, mot_reminded_two ' .
(line 373 in ver 1.4.2) and replace it with

Code: Select all

		$query = 'SELECT user_id, group_id, user_regdate, username, user_email, user_posts, mot_last_login, user_colour, mot_reminded_one, mot_reminded_two ' .

Find

Code: Select all

			$this->template->assign_block_vars('reminders', [
				'SERVER_CONFIG'		=> append_sid("{$this->root_path}memberlist.$this->php_ext", ['mode' => 'viewprofile', 'u' => $row['user_id']]),
				'USERNAME'			=> $row['username'],
(lines 470 - 472) and and insert the following as new line 473:

Code: Select all

				'USER_EMAIL'		=> $row['user_email'],
Now open acp_ur_reminder.html and find

Code: Select all

				<td><a href="{{ reminder.SERVER_CONFIG }}" target="_blank" {% if reminder.USER_COLOUR %}style="color: #{{ reminder.USER_COLOUR }};" class="username-coloured"{% endif %}>{{ reminder.USERNAME }}</a></td>
(line 38) and replace it with the following lines:

Code: Select all

				<td>
					<a href="{{ reminder.SERVER_CONFIG }}" target="_blank" {% if reminder.USER_COLOUR %}style="color: #{{ reminder.USER_COLOUR }};" class="username-coloured"{% endif %}>{{ reminder.USERNAME }}</a><br>
					{{ reminder.USER_EMAIL }}
				</td>


For the other two tables the changes are quite similar; to add the e-mail address to the sleeper table please find in the function sleeper the following line:

Code: Select all

		$sql = 'SELECT user_id, group_id, username, user_colour, user_regdate, mot_sleeper_remind
(line 591 in ur_acp.php)
and insert user_email, after username,
Then insert

Code: Select all

				'USER_EMAIL'		=> $row['user_email'],
as new line 689.
Open acp_ur_sleeper.html and find

Code: Select all

				<td><a href="{{ registered_only.SERVER_CONFIG }}" target="_blank" {% if registered_only.USER_COLOUR %}style="color: #{{ registered_only.USER_COLOUR }};" class="username-coloured"{% endif %}>{{ registered_only.USERNAME }}</a></td>
(line 34) and replace it with

Code: Select all

				<td>
					<a href="{{ registered_only.SERVER_CONFIG }}" target="_blank" {% if registered_only.USER_COLOUR %}style="color: #{{ registered_only.USER_COLOUR }};" class="username-coloured"{% endif %}>{{ registered_only.USERNAME }}</a><br>
					{{ registered_only.USER_EMAIL }}
				</td>


For the last table (zeroposter) find in the sleeper function of ur_acp.php

Code: Select all

		$query = 'SELECT user_id, group_id, username, user_colour, user_regdate, mot_last_login, mot_reminded_one, mot_reminded_two
(line 806) and insert user_email, after username,
Then insert

Code: Select all

				'USER_EMAIL'		=> $row['user_email'],
as new line 911.
Open acp_ur_zeropoater.html and find

Code: Select all

				<td><a href="{{ zeroposter.SERVER_CONFIG }}" target="_blank" {% if zeroposter.USER_COLOUR %}style="color: #{{ zeroposter.USER_COLOUR }};" class="username-coloured"{% endif %}>{{ zeroposter.USERNAME }}</a></td>
(line 38) and replace it with

Code: Select all

				<td>
					<a href="{{ zeroposter.SERVER_CONFIG }}" target="_blank" {% if zeroposter.USER_COLOUR %}style="color: #{{ zeroposter.USER_COLOUR }};" class="username-coloured"{% endif %}>{{ zeroposter.USERNAME }}</a><br>
					{{ zeroposter.USER_EMAIL }}
				</td>


After saving these four files purge your forum's cache and you should see the e-mail address underneath the username in all three tables.

Re: Mod'ing the Ext to Display User Email

Posted: Tue 28. Jun 2022, 05:16
by Dezdan
THANK YOU!!!! It worked perfect! Thank you for taking the time and giving step by step directions! It is very much appreciated!

Re: Mod'ing the Ext to Display User Email

Posted: Tue 28. Jun 2022, 06:51
by Mike-on-Tour
You're welcome :)