Guest User

Untitled

a guest
Feb 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. <?php
  2.  
  3. Am_Di::getInstance()->hook->add(Am_Event::GENERATE_LOGIN, function (Am_Event $e) {
  4. $user = $e->getUser();
  5. if ($_ = preg_replace('/[^0-9a-zA-Z]/', '', "{$user->name_f}{$user->name_l}")) {
  6. $i = 1;
  7. $l = $_;
  8. while (!$e->getDi()->userTable->checkUniqLogin($l)) {
  9. $l = $_ . $i++;
  10. }
  11. $e->setReturn(array($l));
  12. }
  13. });
Add Comment
Please, Sign In to add comment