Social Engine get user id from profile page - zend-framework

I'm trying to add some features to the users profile page, and for that I would need that users ID - just to clarify, it's not viewers ID I'm chasing, it's the ID of the user whose profile I'm viewing.
So, I used $subject = Engine_Api::_()->core()->getSubject('user'); and it returns a big object full of all kinds of data, but don't know how to extract user ID?
Anyone have a clue? (SocialEngine 4 is the platform I'm using)

this will get you the userid of the profile..
$profileownerid = Engine_Api::_()->core()->getSubject('user')->getIdentity();

I've figured it out: $subject_id = $subject->getIdentity(); and voila!

Related

Get link to profile in Socialite?

I am trying to get a way to unique identify a Facebook profile using socialite for laravel. I have looked through all of their documentation but it doesn't seem like I can find anything
does anyone know how I am unique identify their profile without it being changed / spoofed like an ID or link to profile that never changes? I have tried doing http://facebook.com/profile.php?id=ID_HERE but no luck
For facebook just add id:
// user got from socialite
$user = Socialite::driver('facebook')->user();
// link to his profile
$userlink = 'https://facebook.com/' . $user->id;

Ionic with Backand social login: profile picture

I'm developing an application with ionic and Backand and I'm using the sign in with social accounts with the Backand service.
The social login process is OK, but I want to get the ID from Facebook and Google plus in order to get the profile picture.
I was talking with the support of Backand and I know that in Security and Auth there is an action "beforesocialSignUp" and I have not commented the line to get the data:
'use strict';
function backandCallback(userInput, dbRow, parameters, userProfile) {
// get facebook id and put in fuid field that you need to add to your user object
userInput.fuid = parameters.socialProfile.additionalValues.id;
// get gender from facebook and put in gender field that you need to add to your user object
// userInput.gender = parameters.socialProfile.additionalValues.gender;
}
And I have created the fuid field in my user object, but, when I make a login with Facebook or Google+ It doesn't save nothing. The login is OK but I can't get the ID data.
Any idea?
I had exactly the same problem.
The solution was to set the where condition of the BeforeSocialSignUp function from false to true.
This is nowhere in the documentation explained.
It took me 3 day ro figure this out :-(
Now the login works as expected and the fuid field gets assigned.
My next step is to get the profile picture from the FB Account, but therefore I have to make an API request to facebook with a user access token which I dont know how to get from backand.

Identifying Facebook Messenger user with UserID from a Facebook Login

I am trying out the new Facebook Messenger Platform and have hit a bit of a problem.
When a user first chats with my Bot, I want to use the sender.id to lookup the user in my DB and verify whether they're a customer or not and offer a more tailored UX.
User's sign up to my service using Facebook Login, but unfortunately it appears my App's Facebook ID & my Bot's Facebook ID are different due to IDs being limited to App-scopes.
Is there any way associate the 2 IDs to allow me to find a user in my DB?
UPDATE (4/20/2016):
We got around this by asking users on first contact via messenger to click a link to login to their account so we could associate their messenger_id with their account in our DB.
Would be awesome if facebook instead included PAGE_SCOPED IDs in the ids_for_business endpoint.
UPDATE: (6/1/2016):
Facebook's latest update includes a new "Account Linking" functionality that appears to solve this issue. See https://developers.facebook.com/docs/messenger-platform/account-linking
Facebook's latest update includes a new "Account Linking" functionality that appears to solve this issue. See https://developers.facebook.com/docs/messenger-platform/account-linking
Unfortunately, there's no way of doing that currently. Asking them to login for new threads is the best way of linking accounts.
Yes. You can get details like first name, last name, profile pic url, locale, timezone, gender from an api. Only you have to pass is their recipient id/sender id and acccess_token of your messenger bot.
https://graph.facebook.com/v2.6/USER_ID?fields=first_name,last_name,profile_pic,locale,timezone,gender&access_token=TOKEN
I solved it different way but it works perfectly by graph API,i read mailbox of my page so that when any one can interact by messenger bot than i read pages inbox and iterate through,
Step 1:
Do a HTTP get request by graph API ,
you want a PAGE_UNIQUE_ID from Graph API ,
GET REQUEST
https://graph.facebook.com/v2.6/<PAGE_UNIQUE_ID>?fields=conversations.limit(10){participants,updated_time,id}&access_token=<PAGE_ACCESS_TOKEN>
PAGE_UNIQUE_ID Hints:
Go ===> https://developers.facebook.com/tools/explorer/ ==> Press "Get Token" ===> Select your desired page ===>Finally Submit , You show a id on output that is PAGE_UNIQUE_ID in here.
Check on browser for resoponse.
Step 2:
After doing above http request ,you get a JSON object that will show latest 10 conversation of pages where desired facebook id included.
Step 3:
Do iteration through by user full name or you can use lodash or underscore at your choice,
getUserID(response,'Zahid Rahman')
function getUserID(response, fullname) {
if (response && response.conversations && response.conversations.data) { //Check response is correct
var conversations = response.conversations.data; //Get all conversations
for (var j = 0; j < conversations.length; j++) {
var conversationsParticipants = conversations[j].participants.data;
for (var k = 0; k < conversationsParticipants.length; k++) { //Get all particiapnts of a single conversation.
var conversationsParticipantsEach = conversationsParticipants[k];
if (conversationsParticipantsEach.name === fullname) { //Check fullname match or not
console.log("Desired Facebook User ID : " + conversationsParticipants[k].id);
return conversationsParticipants[k].id;
}
}
}
}
}
Hope it will help you.
This is probably what you want: https://developers.facebook.com/docs/apps/for-business
It allows you to get all of the app-scoped user ids on a per-business basis.

Get user's gender using the old Facebook SDK

As you know facebook has moved to api 2.4, and now I can't get the user's gender with my previous code.
$f1 = new Fb_ypbox();
$user_data = $f1->getUserData();
$fb_user_id = $user_data['id'];
$name = $user_data['name];
$gender = $user_data['gender'];
$birthday = $user_data['birthday'];
Now this code only gets the user id & the usre name & his profile picture.
Not the gender or his birth date (although I have the extended permission of user_birthday).
Is there any chance to update my code or any other code to get the user's public info (gender for example) which doesn't request any extended permissions?
I just know that now it's not just making the GET request for "/me", but I also should add the "?fields=gender" addition.. I just can't manage to add it to my current sdk code.
I have read Facebook's API documentation couple of times and I can't figure it out..
Thanks :)
First of all you need to supply a more detailed description like the version of that "Fb_ypbox" class you are using. Probably there is a new version available that deals with the declarative fields changes in the 2.4 API already.
Since you did not supply these information we can only make a guess:
Search for "//graph.facebook.com/me?" in all class files and add the fields=name,gender,...

Not able to retrieve gender in google plus ios sdk

I used GTLQueryPlus.queryForPeopleGetWithUserId("me") for retrieving logged in user information. I am not getting the gender in json. When I set the gender visibility to 'public' instead of 'my circles' from my google plus profile, then I got the gender.
How to get the gender info without changing the settings from googe plus profile settings?
scopes used: signIn.scopes = [kGTLAuthScopePlusMe, kGTLAuthScopePlusUserinfoProfile, kGTLAuthScopePlusLogin];
You can only access what a user has set to public. If the user doesn't want this information public then you cant have the information.
Just because I authenticate your application doesn't mean that I want you to for example to see my address or in this case my gender. So I don't set them public you cant see them.