Created
June 29, 2016 06:36
-
-
Save narodnaia/db0f91b5b7927fd585b47f4de3f019b9 to your computer and use it in GitHub Desktop.
PKP Open Journaling Systems - Database triggers to set user email as username
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Create these triggers to allow OJS user login with his or her email instead of his username | |
-- (OJS controllers do not allow this feature, thus it can be implemented at database level) | |
-- | |
DELIMITER $$ | |
CREATE TRIGGER `update_username` BEFORE INSERT ON `users` FOR EACH ROW begin | |
set new.username = new.email; | |
end | |
$$ | |
DELIMITER ; | |
DELIMITER $$ | |
CREATE TRIGGER `update_username_edition` BEFORE UPDATE ON `users` FOR EACH ROW set new.username = new.email | |
$$ | |
DELIMITER ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment