We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36760
    • 136 Posts
    Sorry, what's happening is the user data I'm trying to collect from Facebook is being put in the Remote Data tab of the user profile in the manager. Instead of being filled into the main profile sections (like email, city, gender, etc.).

    I'm pretty sure I know how to set it up correctly, since you helped me with it once before, but I think having the Facebook stuff in there too is throwing me for a loop. Here's the section of code I think is causing the issue. (I have a feeling maybe something in it is still outdated?)

    	if(empty($user)){
    	    	//they're new!
    		//facebook may pass multiple hometowns back
    		if(!empty($me['hometown'])){
    			if(is_array($me['hometown'])){
    			   $homet=$me['hometown'][0];
    			}else{
           			   $homet=$me['hometown'];
    			}
    		}
     
    	  	// Create an empty modx user and populate with facebook data
    		$user = $modx->newObject('modUser');
    		$user->fromArray(
                              array('username' => $me['name'],'active' => true
    		                ,'remote_key' => $me['id'] ,'remote_data' => $me //store the remote data as json object in db (in case you need more info bout the FB user later)
    		             )
                       );
     
                   //We'll also toss a profile on to save their email and photo and such
    		$profile = $modx->newObject('modUserProfile');
    		$profile->fromArray(array(
    		'email' => isset($me['email']) ? $me['email'] : '[email protected]'
    		,'fullname' => $me['name']
    		,'city' => $homet
                    ,'photo'=> 'http://graph.facebook.com/'. $me['id'] .'/picture'
    		));
    		$user->addOne($profile, 'Profile');


    I believe what it's supposed to do is put all of the data in the Remote Data tab, and then put relevant information into the main profile sections. Right now all it's doing is filling in the Full Name and putting in [email protected] as the email address.

    Hopefully that makes a little more sense. What you gave me may very well be the solution, I just don't know how to work it in with the Facebook things.

    I'm actually going to get the person I'm helping to find additional help, since there are other things that need to happen with this that I know are over my head. So if it's still not making sense, don't worry about it too much.