By Gene Teigland on Wednesday, 08 July 2015
Posted in General Issues
Likes 0
Views 1K
Votes 0
Trying to implement some of your API code into my Cobalt user pages.
Bascially what Im trying to do is use those embeds to grab data from ES and view it into their user pages.

Let's say I want to embed their points or any other custom fields so other artists can see that users data without going to easy social.

The issue I'm having is that the API you give for users only embed the LOGGED IN USERS data and not other users data.
http://stackideas.com/docs/easysocial/developers/users/users

Let me give you a real world example.

1. On this site ua.t12sites.com (i've provided credentials.)
2. I log in as Sara Bentley
3. When I go to Sam Johnson's Home cobalt page it grabs the avatar, name and even link to social profile so I can see data.
4. However when I start using you api (for example: Foundry::user()->getName() it grabs Sara' Name instead of Sam Johnson name.

5. You can see by my screen shot it does identify sam Johson user id # so I was hoping your api would see that and then embed Sam's data VERSUS THE LOGGED IN USERS DATA.

Please view screenshot with notes as that better demonstrates it.
http://www.awesomescreenshot.com/image/388345/b5bc0d73999a872b6190515277c49f7c
Hello Gene,

Ah I see. The url is actually include the user alias hence it will not fetching the correct user id. Try the following code instead and see how it goes.
$userIdRaw = JRequest::getVar('user_id');
$userId = strstr($userIdRaw, ':', true) ?: $userIdRaw;
echo Foundry::user($userId)->getName();
·
Wednesday, 08 July 2015 12:14
·
0 Likes
·
0 Votes
·
0 Comments
·
Another thought to add... basically I'm asking a way to use that the URL string of "user_id=65" (in my example above) to grab that info since that user id is being rendered as evident in the URL string... to add a piece of code in the php file and add it to to your api embed http://stackideas.com/docs/easysocial/developers/users/users

so it grabs that pages user id (as demonstrated in "user_id=65") in my example INSTEAD of the current logged in user.

I don't know php but written example such as....
<?php echo "get this page user's id" Foundry::user()->getName(); ?>

So a code to grab that pages user id versus the logged in id.

Hope that explains what I'm trying to achieve.

THanks
·
Wednesday, 08 July 2015 10:17
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Gene,

I am sorry for the delay of this reply.

Perhaps you can try to get the value from the url by using JRequest::getVar() function like per example below,
$userId = JRequest::getVar('user_id');
echo Foundry::user($userId)->getName();


Hope these help.
·
Wednesday, 08 July 2015 11:39
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks so much for your super quick response. We're getting closer and if we can get this it opens tons of doors for ES and Cobalt integration.

When i put in the code I get this:
COM_EASYSOCIAL_GUEST_NAME

Here is also the screen shot:
http://www.awesomescreenshot.com/image/388554/178010aae9d2aae5c41894c5a709b9b7
·
Wednesday, 08 July 2015 11:51
·
0 Likes
·
0 Votes
·
0 Comments
·
THAT WORKED. THANKS SO MUCH!
·
Wednesday, 08 July 2015 21:26
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Gene Teigland,

You're welcome, glad to heard your issues resolved.
·
Wednesday, 08 July 2015 22:26
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post