We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24089
    • 3 Posts
    I’m trying to write a plugin that fires after a webuser is saved in the manager. I’ve attached my plugin to OnWebSaveUser and it works as expected. However, I have different webuser groups and I’d like my plugin to respond differently depending on the webuser group to which the webuser belongs. In save_web_user.processor.php I notice that the code that invokes the OnWebSaveUser event occurs before the code that saves the webuser groups to which the webuser belongs. Perhaps I am not understanding the the model here, but doesn’t it make sense for the OnWebSaveUser event to fire after the webuser group information is saved in the db? Is webgroup membership information not conceptually considered part of the webuser?

    In any event, what is the best way to get the effect I want? I need to somehow get the webgroup membership information for a webuser at the time the webuser is created so I can react appropriately. My dilemma is that the information is not passed as part of the event call and not yet saved in the database.

    Any suggestions as to how I can do this without changing save_web_user.processor.php? I realize I could simply move the code that invokes the event to after the code that saves the group membership information but I’d like to avoid changing core files if possible.


      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Is the $_POST[’user_groups’] still available to you?
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 24089
        • 3 Posts
        Duh, you are correct. I’m sitting here staring right at $usergroups on line 174 not realizing that it’s set equal to $_POST[’user_groups’] on line 61 shocked. Too many hours staring at the monitor. Thanks for the quick reply.