Knowledge Base

Admin user activation emails to one Admin only
Article ID: 17
Written By: karlsemple
Written On: Sun Jun 24, 2007 6:45 pm
Description: With account activation set to Admin this small change will direct registration notifications to an Admin of your choice rather than them all.
Link to this article: Select All
[url=http://www.phpbb.com/kb/article/admin-user-activation-emails-to-one-admin-only/]Knowledge Base - Admin user activation emails to one Admin only[/url]

Overview
  • If you have set account activation set to 'Admin' all the board Admin will receive registration notification e-mails. This may be a problem if you want multiple board Admin but only want one to be notified of new registrations.
Solution
  • Luckily there is a simple change which can be made to the usercp_register.php file to make this happen.
    • First things first you need the user_id of the Admin you wish the e-mails to be sent to.
    • You can find the Admin user_id by viewing their profile, their profile can be accessed from the member list or one of their posts.
    • When viewing their profile page their user_id is contained in the URI in the address bar, it is the value after the u=
    • Image
    • Now we have the desired Admin user_id we can make the changes to the file. You will need to open your includes/usercp_register.php in a text editor.
    • Find:
      Code: Select all
      if ( !defined('IN_PHPBB') )
      {
         die("Hacking attempt");
         exit;
      }
    • After Add:
      Code: Select all
      //Admin id of the Admin who will receive registration notification
      $admin_email_id = intval(2);
    • In the above code snippet intval(2) you replace the 2 with the user_id of you're desired Admin.
    • Find(about line 572):
      Code: Select all
      $sql = 'SELECT user_email, user_lang
                        FROM ' . USERS_TABLE . '
                        WHERE user_level = ' . ADMIN;
    • Replace With:
      Code: Select all
      $sql = 'SELECT user_email, user_lang
                        FROM ' . USERS_TABLE . '
                        WHERE user_id = ' . $admin_email_id;
    • Find(about line 740):
      Code: Select all
      $sql = "SELECT user_email, user_lang
                     FROM " . USERS_TABLE . "
                     WHERE user_level = " . ADMIN;
    • Replace With:
      Code: Select all
      $sql = 'SELECT user_email, user_lang
                        FROM ' . USERS_TABLE . '
                        WHERE user_id = ' . $admin_email_id;
    • Save and upload the edited file overwriting the old one.
  • As you should when editing any file please make complete back ups before completing any editing.
If you come across any errors in this article or have information you think should be includes please pm via the phpBB.com forum.