There are two different types of notifications a user can send after account registration to admin users. 1) Message to all admin users 2) Message to 1 admin.
If you want your php login system send a message to all admin users when a user account is created you can do that very easy by editing classes/users.php class. inside that class there are different functions one of them is register_user function this function works with form in register.php when user register them self. Another function is add_user which works when an admin add a user to system. And third function is register with facebook which works when a registration done by facebook button. Here we are explaining for register.php register_user function for other methods like add_user and register_user_facebook will also need same implementation to send notification email to admin on new registration of account.
First of all edit classes/users.php class from your user management and login system script files. Then find the function register_user( In this function at end there is a return value on successful registration message. return $language[‘registrat_success’]; Your code will go above this line.
You have to create a new Messages class object so you can use message object to send message.
Send Email notification to all admin users
Using the following code you can send notification to all admin users in system message would be sent to their message section of system and if they have activated email notifications from their edit profile section then they will get notification about messages in their email account as well here is the code.
//message object.
$subject = "New user registration.";
$message = "<h2>New user registration.</h2>";
$message .= "<p><strong>Name: </strong>".$first_name." ".$last_name."</p>";
$message .= "<p><strong>Email: </strong>".$email."</p>";
$message .= "<p><strong>Username: </strong>".$username."</p>";
$message_obj = new Messages;
$message_obj->level_message('admin', $subject, $message);
This code will send email notification on new user registration to all admin users.
Send message to one specific user on new registration
If you want to send message only one user admin or whoever user role you can use all above code but you have to change last line where we are using messages class’s function level_message we have to use different function single_user_msg($user_id, $subject, $message) This function will send message to only 1 user. But that function needs user id instead of username or email so if you cannot get that use this function new_message($username_email, $subject, $message) and the following code with work, First argument can be user email, or username who is gonna receive notification on new user registration.
//message object.
$subject = "New user registration.";
$message = "<h2>New user registration.</h2>";
$message .= "<p><strong>Name: </strong>".$first_name." ".$last_name."</p>";
$message .= "<p><strong>Email: </strong>".$email."</p>";
$message .= "<p><strong>Username: </strong>".$username."</p>";
$message_obj = new Messages;
$message_obj->new_message('[email protected]', $subject, $message); //First argument in this function would be email or username of your admin who will receive notification on new registration.
For any type of help or support questions please contact us. thank you.