We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27106
    • 147 Posts
    David Walker Reply #1, 15 years ago
    Can anyone point to a snippet or code demonstrating how to change a user's user group via a Web form - e.g. user makes a payment, so change their status from "triallist" to "subscriber".

    (I'm using Revolution 2.1.1) [ed. note: shorewalker last edited this post 15 years ago.]
      David Walker
      Principal, Shorewalker DMS
      Phone: 03 8899 7790
      Mobile: 0407 133 020
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      Mark Hamstra Reply #2, 15 years ago
      Using as a hook with FormIt or standalone snippet, untested but should work-ish.
      $join = $modx->user->joinGroup('subscriber','Member');
      if ($join) {
        $leave = $modx->user->leaveGroup('triallist');
        if ($join && $leave) { 
          // Joining & leaving group worked
          return true;
        }
        // Leaving group failed
        return false;
      } 
      // Joining user group failed.
      return false;
      
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.