Created
November 21, 2019 15:54
-
-
Save cgi-caesar/77ac7d88d3de2581246422e5e675e394 to your computer and use it in GitHub Desktop.
aMember (site.php): Sync user comment field to user notes
This file contains hidden or 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
| <?php | |
| Am_Di::getInstance()->hook->add(Am_Event::USER_AFTER_UPDATE, function(Am_Event_UserAfterUpdate $e) { | |
| $user = $e->getUser(); | |
| $old = $e->getOldUser(); | |
| if ($user->comment && $user->comment != $old->comment) { | |
| $note = $e->getDi()->userNoteRecord; | |
| $note->user_id = $user->pk(); | |
| $note->content = $user->comment; | |
| $note->dattm = $e->getDi()->sqlDateTime; | |
| $note->admin_id = $e->getDi()->authAdmin->getUserId(); | |
| $note->save(); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment