We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36695
    • 47 Posts
    Has anyone attempted anything like this, or know of an addon that might provide similar functionality? The workflow I'm hoping for is something like:

    • User completes the Registration form (e.g. using the Login.Register snippet), but is not "active"
    • A defined "administrating" user group is notified.
    • The admin can action the registration request by clicking in the email or logging into the manager and actioning via a CMP or something
    • The user is notified by email and their account becomes active

    It seems like it should be fairly straight forward to utilise the hooks in Register, but thought I'd ask before starting the work.
      • 34049
      • 28 Posts
      Just trying exactly that at the moment, but not quite completed it yet.

      I've used the Login Register snippet as you suggest to register the new member but not active and emailed the "membership secretary".

      I've used the ActivationEmail extra to trigger an email when the user status is changed to active.

      The next stage was for a simple way for the membership secretary to approve the membership request. I was hoping to find a way to show a membership profile page on which the membership secretary would get an extra couple of buttons "approve" and "deny". So I need to sort out a way that the approve button would change the members status to active. Unfortunately I've been busy with other parts to develop so not progressed any further. So I'll be watching any suggestions or progress with interest.
        • 3866 ☆ A M B ☆
        • 350 Posts
        I've used the ActivationEmail plugin from BobRay to moderate users, you can find out more here http://bobsguides.com/activationemail-plugin-tutorial.html.

        I have a couple of clients who use this functionality and simply log into the manager and activate / de-activate users without any issues. Having said that Adrian's idea of having a front end page for an administrator to Approve or Deny a new member would be a great addition, possibly something linked with the Peoples snippet where you can list all members of a particular user group. Could be an interesting development.
          Helen Warner
          Number one pixel!
          Proud to be linked with MODX at Crimson Pixel
          • 36695
          • 47 Posts
          Thanks for the input. I'm ending up going along similar lines to the ActivationEmail plugin. However, instead of a front end interface as Adrian suggested I'm using the approach taken by Quip. The email sent to the moderator includes a link to the manager with the "update user" action and user id specified, along with a custom GET variable. A plugin firing on OnUserFormRender checks for that var and tries to activate the user if present, and sends out the email to the user on success. In my case the admins are generally working through the back-end anyway which makes this more appropriate.
          Check out the "checkForApproval" method in core/components/quip/index.class.php. Adding the JS status message completes the experience.

          However, I've just thought that you could probably get away with a plugin OnManagerPageInit and pointing the email link at the dashboard or just the main users list page. In this case you wouldn't have to worry about checking the Active checkbox on the user form after you'd actioned this in your plugin, you'd just have the status message.

          For reference, this is the sort of code you could use in the plugin, although obviously it's just an example of the logic:
          if($modx->event->name === 'OnManagerPageInit') {
          if(isset($_GET['activateuser'])) {
          	$TheUser = $modx->getObject('modUser',$_GET['activateuser']);
          	if($TheUser && !$TheUser->get('active')) {
          		$TheUser->set('active',1);
          		if($TheUser->save()) {
          			$Title = 'Hooray! Get a cup of tea!';
          			$Message = "Your message or your lexicon call";
          
          		}
          		else {
          			$Title = 'This alert is bad news!';
          			$Message = 'Uh oh! There was a bit of a problem activating the user!';
          		}
          		$modx->regClientStartupHTMLBlock('<script type="text/javascript">
          		        Ext.onReady(function() {
          		            MODx.msg.status({
          		                title: "'.$Title.'"
          		                ,message: "'.$Message.'"
          		                ,delay: 10
          		            });
          		        });
          		        </script>');
          
          	}
          }
          }