Loading...
 
Skip to main content

Features / Usability


Adding Email Notifications

posts: 122 United States

I have a need to add two mail notifications.

The first is a notification email to users when they register with the site, but does not require validation. It should be more of just a welcome to the site email. My thought was to take the validation email that's currently built into Tiki, and use that for the process of sending the email. Then when the user goes to login for the first time, the site doesn't check to see if they are valid. That being said, I can't find the proper place to turn off the validation check when users login. Is it in the tiki-login.php page?

The second notification is to a user when an article they submitted was approved. I can't really think of a way of doing this, unless there is a way to force them to watch articles they submitted. Any suggestions with this?

posts: 215

I regards to your first email notification request, I can tell you how to stop the user validation check. But, are you sure you want allow users to register without any validation? Removing that check could allow malicious users to register with fake email addresses.

The last column of the users_users table is named "waiting". If, in "Registration & Log in", the "Validate new user registrations by email" is checked, then the new user gets inserted into the users_users table with the waiting column set to "u". And they cannot log in until they use the validation link, which would then cause waiting column to be set to NULL.

There is also a second validation check that uses the column waiting. If "Require validation by Admin" is set, the waiting column gets set to "a", and after the Admin uses their validation link, then the waiting column get set to NULL, unless the "Validate new user registrations by email" is also set. If both the "Require validation by Admin" and "Validate new user registrations by email" options are selected, the waiting column first gets set to "a" and after the admin uses their link the column gets set to "u" and waits for the user to user their validation link.

The change below will stop both the "Validate new user registrations by email" check and the "Require validation by Admin" check, but I assume that if you don't want them to have to use the user validation link, then you probably don't want them to have to wait until the Admin validates their registration either.

When a new user registers, their users_users row gets inserted in lib/userslib.php. Replace the $waiting with NULL near the bottom of the section of code listed below.

You still have to modify the creation of the validation email. And you may loose this modification any time you apply Tiki updates.

Copy to clipboard
$query = "insert into `users_users`(`login`, `password`, `email`, `provpass`, `registrationDate`, `hash`, `pass_confirm`, `email_confirm`, `created`, `valid`, `openid_url`, `lastLogin`, `waiting`) values(?,?,?,?,?,?,?,?,?,?,?,?,?)"; $result = $this->query($query, array( $user, $pass, $email, $provpass, (int) $this->now, $hash, (int) $new_pass_confirm, (int) $new_email_confirm, (int) $this->now, $valid, $openid_url, $lastLogin, //(empty($_GLOBALS['user']) && $prefs['validateRegistration'] == 'y')? 'a': ((empty($_GLOBALS['user']) && $prefs['validateUsers'] == 'y')? 'u': NULL) $waiting ));