thanks Jason
But sitll that problem is not resolved,
Below is the code that i used Getting friends data weahter the user
may be profle user or login user,
Please check it, if it proper or not or give suggestion where i change
the code.
<script type="text/javascript">
function getData() {
var params = {};
params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
[opensocial.Person.Field.PROFILE_URL];
params[opensocial.DataRequest.PeopleRequestFields.MAX] = 2000; //---
> Set the count how many friend you want in ur application
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER,params),
'viewer');
req.add(req.newFetchPeopleRequest('VIEWER_FRIENDS',params),'viewerFriends');
req.send(onLoadFriends);
};
function onLoadFriends(dataResponse)
{
var viewer = dataResponse.get('viewer').getData();
var profileUrl =
viewer.getField(opensocial.Person.Field.PROFILE_URL);
alert("OrkutuserloginProfileurl=>"+profileUrl);
var user_name = viewer.getDisplayName();
//alert(user_name);
var login_user_thumb =
viewer.getField(opensocial.Person.Field.THUMBNAIL_URL);
//alert(user_name+'=>ThumbnailPicture=>'+login_user_thumb);
var regex2 = /uid=([^&#]+)/;
var result2 = profileUrl.match(regex2);
if (result2.length == 2)
{
var uid = result2[1];
alert("OrkutuserLoginID=>"+uid);
// uid now contains the viewer's orkut UID
} else
{
// there was a problem getting the UID
}
var viewerFriends =
dataResponse.get('viewerFriends').getData();
viewerFriends.each(function(person)
{
var friendprofileUrl =
person.getField(opensocial.Person.Field.PROFILE_URL);
// alert("profile: " + friendprofileUrl);
var regex = /uid=([^&#]+)/;
var result = friendprofileUrl.match(regex);
if (result.length == 2)
{
var userfienduid = result[1];
//alert(userfienduid);
//uid now contains the viewer's orkut
UID
}
else
{
//there was a problem getting the UID
}
var userfiendthmub = person.getField('thumbnailUrl');
var userfriendname = person.getDisplayName();
//alert(userfriendname+'=>Thumbnail=>'+userfiendthmub);
});
document.getElementById('message').innerHTML=html;
};
gadgets.util.registerOnLoadHandler(getData);
</script>
<div id="message"></div>
Thanks for giving the suggestion ,
I will wait ur reply and hope u send this as soon as possible.
Jagdish Joshi
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
On Aug 20, 11:08 pm, Jason <[EMAIL PROTECTED]> wrote:
> Yep, I believe Preetam is right.
>
> OpenSocial has two distinct users: the OWNER which represents the
> individual whose profile is hosting the application and the VIEWER
> which represents the user who is currently using the application.
>
> If you always want to display the friends of the current user, you
> should specify opensocial.DataRequest.Group.VIEWER_FRIENDS in your
> data request, not OWNER_FRIENDS. Please let me know if this answers
> your question.
>
> - Jason
>
> On Aug 19, 12:43 pm, Preetam Purbia <[EMAIL PROTECTED]> wrote:
>
> > hi
> > i think u r using owner data.
> > use viewer data
> > that can solve your problem
> > thanks
> > Preetam Purbiawww.100india.com
>
> > On Aug 19, 10:28 am, Jag <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
> > > I am developing the application for orkut, and i face the problem
> > > described as below,
>
> > > When user login to orkut and open my application in canvas view
> > > then we got the login users friend data, at the same time when we see
> > > the profile of another user at that time we got the same friends data
> > > and not that profile users friends data like their id or profile
> > > names.
>
> > > So that it becomes difficult to show login user friends on my
> > > application.
>
> > > Or how i can differenciate between orkut login user and profile user ?
> > > is there any key for identifying those users.
>
> > > Please send the suggestion or samplecode for this as early as
> > > possible.
>
> > > Thanks
> > > Jagdish Joshi
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---