Mod'ing the Ext to Display User Email

If you need support and would like to ask your question in English please enter here
Dezdan
Posts: 8
Joined: Mon 27. Jun 2022, 00:22

Mod'ing the Ext to Display User Email

Post 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!
User avatar
Mike-on-Tour
Administrator
Posts: 501
Joined: Sat 21. Mar 2020, 19:02

Re: Mod'ing the Ext to Display User Email

Post 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.
Gruß
Mike
User avatar
Mike-on-Tour
Administrator
Posts: 501
Joined: Sat 21. Mar 2020, 19:02

Re: Mod'ing the Ext to Display User Email

Post 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.
Gruß
Mike
Dezdan
Posts: 8
Joined: Mon 27. Jun 2022, 00:22

Re: Mod'ing the Ext to Display User Email

Post by Dezdan »

THANK YOU!!!! It worked perfect! Thank you for taking the time and giving step by step directions! It is very much appreciated!
User avatar
Mike-on-Tour
Administrator
Posts: 501
Joined: Sat 21. Mar 2020, 19:02

Re: Mod'ing the Ext to Display User Email

Post by Mike-on-Tour »

You're welcome :)
Gruß
Mike
Dezdan
Posts: 8
Joined: Mon 27. Jun 2022, 00:22

Re: Mod'ing the Ext to Display User Email

Post by Dezdan »

Hey Mike,

Will the above still work for version 1.7.1?

Thanks!
~Dan
User avatar
Mike-on-Tour
Administrator
Posts: 501
Joined: Sat 21. Mar 2020, 19:02

Re: Mod'ing the Ext to Display User Email

Post by Mike-on-Tour »

Hi Dan,
I can't see any reason why this shouldn't work in any version of Userreminder although the line numbers may slightly be different - and BTW version 1.8.1 is available for download.
Gruß
Mike
Dezdan
Posts: 8
Joined: Mon 27. Jun 2022, 00:22

Re: Mod'ing the Ext to Display User Email

Post by Dezdan »

Thanks for the info! I'll get the update installed before I mod the code.
Dezdan
Posts: 8
Joined: Mon 27. Jun 2022, 00:22

Re: Mod'ing the Ext to Display User Email

Post by Dezdan »

FYI - phpBB is still showing 1.7.1 as the latest.
User avatar
Mike-on-Tour
Administrator
Posts: 501
Joined: Sat 21. Mar 2020, 19:02

Re: Mod'ing the Ext to Display User Email

Post by Mike-on-Tour »

I know, they take several weeks for validating but you can download it from this Board.
Gruß
Mike
Dezdan
Posts: 8
Joined: Mon 27. Jun 2022, 00:22

Re: Mod'ing the Ext to Display User Email

Post by Dezdan »

Hi Mike! Thanks for keeping up the great work on this extension!

Any chance you could provide updated details on making this mod for 1.11.0? It looks like there have been some significant code changes.

Thanks!
~Dan
User avatar
Mike-on-Tour
Administrator
Posts: 501
Joined: Sat 21. Mar 2020, 19:02

Re: Mod'ing the Ext to Display User Email

Post by Mike-on-Tour »

Hi Dan,
certainly I can, and it is even easier now since it will require only three changes to ur_acp.php and one or two additions to the three templates each:

First, insert user_email, after username, in lines 392, 586 and 787 of ur_acp.php to make sure you are getting the info from the database.

Then you just have to insert the email address to the template files:
In adm/style/acp_ur_reminder.html exchange line 50 with

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>
In adm/style/acp_ur_sleeper.html exchange lines 46 and 74 with

Code: Select all

					<td><a href="{{ sleeper.server_config }}" target="_blank" {% if sleeper.user_colour %}style="color: #{{ sleeper.user_colour }};" class="username-coloured"{% endif %}>{{ sleeper.username }}</a><br>{{ sleeper.user_email }}</td>
In adm/style/acp_ur_zeroposter.html exchange lines 50 and 85 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 that you are done and should see the email address underneath the username.
Gruß
Mike
Post Reply