Hello Everyone,
I'm building a social marketplace platform via wordpress.
We need to let users to connect with Instagram and also pull their data from it such as Instagram Follower Count, Biography etc. I have managed to connect the Instagram, but am unable to access to extended data.
I added below code to end of my functions.php file and extended my database. When I do a var_dump of $identity or $bio, I get NULL on my screen. It seems like my webpage never goes through this function.
How can I solve my issue and display data from Instagrams extended data?
function oa_social_login_store_extended_data ($user_data, $identity)
{
// $user_data is an object that represents the newly added user
// The format is similar to the data returned by $user_data = get_userdata ($user_id);
// $identity is an object that contains the full social network profile
var_dump($identity);
//Example to store the gender
update_user_meta ($user_data->user_id, 'bio', $identity->bio);
// update_user_meta ($wp_usermeta->user_id, 'gender', $identity->gender);
}
//This action is called whenever Social Login adds a new user
add_action ('oa_social_login_action_after_user_insert', 'oa_social_login_store_extended_data', 10, 2);
Answers
Try with an exit; after your var_dump() to display the results.
Then, inspect the output to check if the profile info you want is present.
You may want to format the output (with some <pre>).
Hope this helps.