We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26503
    • 620 Posts

    just trying to write a quick little snippet here to check if an email address has already been used in modx revo 2.2++

    I'm tying something like this:



    if($_POST['email']){
      
      $reqEmail = trim($_POST['email']);
      
      if ($user = $modx->getObject('Profile', array('email'=>$reqEmail))){
      
    	$modx->setPlaceholder('error.message','Sorry, the email address you selected is not valid, it may already be in use.');
      
      }else{
      
      	$modx->setPlaceholder('email',$reqEmail);
        
      }
      
    }




    it's sort of a pre-check before someone is referred on to a registration form so I do NOT have a user ID to check against.

    thoughts?
      *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

      Sean Kimball CLP, CLS.
      Technical Director / Sr. Developer | BigBlock Studios
      ._______________________________________________.
      Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
      27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
      phone/fax: 905-426-5525
      • 3749
      • 24,544 Posts
      I think you want 'modUserProfile' for the object rather than 'Profile,' which is for getting a Profile as a related object of some other object (e.g. User) that you don't have.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 26503
        • 620 Posts
        yes - it is modUserProfile .. I was trying modUserprofile ... just a matter of case.
          *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

          Sean Kimball CLP, CLS.
          Technical Director / Sr. Developer | BigBlock Studios
          ._______________________________________________.
          Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
          27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
          phone/fax: 905-426-5525