Hi Toton,
No need 2 get angry. This question is been asked and answered
many times in this forum. I think they should include this in FAQ.
Well 2 get the users all details here is the code.
/* gets owner and viewer info */
function sendRequest()
{
if(gadgets.window)
{
gadgets.window.adjustHeight('800px');
}
document.getElementById('main').innerHTML="Loading
Seedhi Baat
Messages...";
var idspec = opensocial.newIdSpec({'userId' : 'OWNER',
'groupId' :
'FRIENDS'});
var idspecviewer = opensocial.newIdSpec({'userId' :
'VIEWER',
'groupId' : 'FRIENDS'});
var req = opensocial.newDataRequest();
var owner_params = { };
owner_params
[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
[opensocial.Person.Field.NAME,opensocial.Person.Field.GENDER,
opensocial.Person.Field.CURRENT_LOCATION,
opensocial.Person.Field.PROFILE_URL];
var viewer_params={};
viewer_params
[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS]=
[opensocial.Person.Field.NAME,opensocial.Person.Field.PROFILE_URL];
req.add(req.newFetchPersonRequest
(opensocial.IdSpec.PersonId.OWNER,owner_params),"owner");
req.add(req.newFetchPersonRequest
(opensocial.IdSpec.PersonId.VIEWER,viewer_params),"viewer");
/* get owner friends */
var friends_params = {};
friends_params[opensocial.DataRequest.PeopleRequestFields.MAX]
=1000;
req.add(req.newFetchPeopleRequest
(idspec,friends_params),'friends');
req.add(req.newFetchPeopleRequest
(idspecviewer,friends_params),'friendsviewer');
req.send(getResponse);
/*end owner friends */
}
/*end*/
function getResponse(data)
{
viewer = data.get("viewer").getData();
owner = data.get("owner").getData();
friends = data.get('friends').getData();
friendsviewer = data.get('friendsviewer').getData();
/*set friends html*/
initFriends(friends,owner);
friendsHtml = getFriendsHtml(null);
/*end friends html */
orkut_owner_pic_url=owner.getField
(opensocial.Person.Field.THUMBNAIL_URL);
/*get viewer and owner of application*/
orkut_profile_owner_id = getOrkutId(owner);
orkut_opensocial_user_id = gadgets.util.getUrlParameters()
["gadgetOwner"];//to generate user's open social id
orkut_owner_name=owner.getDisplayName();
orkut_profile_owner_id=orkut_profile_owner_id
owner_gender=owner.getField(opensocial.Person.Field.GENDER);
owner_gender=owner_gender.getDisplayValue();
orkut_owner_location=owner.getField
(opensocial.Person.Field.CURRENT_LOCATION);
/*generate users location*/
var Currlocation='';
Currlocation='Country:
'+orkut_owner_location.getField
(opensocial.Address.Field.COUNTRY);//country
Currlocation=Currlocation+'
State:
'+orkut_owner_location.getField(opensocial.Address.Field.REGION);//
state
Currlocation=Currlocation+'
City:'+orkut_owner_location.getField
(opensocial.Address.Field.LOCALITY);//city
orkut_owner_location=Currlocation;
}
I think this will solve many of your doubts.
--
You received this message because you are subscribed to the Google Groups
"Orkut Developer Forum" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/opensocial-orkut?hl=en.