We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 43432
    • 19 Posts
    Quote from: BobRay at Jun 18, 2014, 09:23 PM
    I'm glad you got it sorted. Thanks for reporting back. smiley

    All of a sudden, as soon as I transferred over from .sandbox.paypal, it no longer works! (And I have no idea why!)

    I've setup some echos, and it's running in the part where the user should be added to the usergroup, so I'm not quite sure what's wrong! sad

    // Copyright Pixel Crescent 2014 All Rights Reserved
    // This initialises all MODx Commands and Permissions! :D
    require_once '../config.core.php';
    require_once MODX_CORE_PATH.'model/modx/modx.class.php';
    $modx = new modX();
    $modx->getService('error','error.modError', '', '');
    function userPurchasedItem($item_id, $payment_amount, $payer_email, $username) {
    	global $modx;
    	//mail('[email protected]', 'Just received a purchase!', 'The user: '.$username.' at '.$payer_email.' has just purchased an item for $'.$payment_amount.' ID: '.$item_id);
    	$myUser = $modx->getObject('modUser', array('username'=>$username));
    	 if ($myUser) {
    		echo 'It is set!';
    		$cm = $modx->getCacheManager();
        } else {
    		 mail('[email protected]', 'Error Assigning group', 'Something went wrong when assigning the user '.$username.' who purchased the item '.$item_id.' for'.$payment_amount);
            die('No User');

    My test code that is running is:

    userPurchasedItem('4', '5', '[email protected]', 'muffinjello');

    And there is the user 'muffinjello' in my DB... never even touched that. Any ideas?