News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Getting SMF avatar from SSI via member name (for use in WP)

Started by Vitti, June 14, 2011, 09:35:06 PM

Previous topic - Next topic

Vitti

I have a Wordpress 3.1.3 install running with SMF 2.0 RC5.  I am using a bridge to sync the SMF users and WP users.  Everything works great, except now I am trying to get the SMF avatar to show up on the WP comments.

I have a way to get the avatar via SSI if I have the member id.  Problem is the WP-SMF bridge stores different user ids for each (SMF has one id, WP has another).  The only thing that matches is the member name (display name, whatever you want to call it).

Long story short, has anyone ever used a member name to retrieve a member id from SMF?  Or more specifically an avatar?  If I can get the member id I can use the existing function I have to get the avatar.

Something like $member_id = getMemberID($theMemberName); ... need the getMemberID function.

Thanks.

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Vitti

Thanks for the reply.  However doesn't that just give you the avatar of the current logged in user?

I need to "look up" the avatars of each person who commented on the blog.  So each blog comment I have the users name and need to grab the associated avatar.  I have the user name, I just need to take that user name and get that users id from SMF.

Kindred

$context['member']['avatar']['image'] where you use the member ID as the member setting.

I think....
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Vitti

I will give that a try, but the thing is I don't actually have the member id.  That is what I am trying to find.  All I have on the WordPress side is member name.

Vitti

Anyone else know how to go about pulling the SMF member id using the member name?

All Colours Sam

mmm, does the member name is the same in SMF and  in wordpress?


try this:

// Get the user's data
   $user = // the member name
   loadMemberData($user,true, 'profile');
   loadMemberContext($user);
   $user = $memberContext[$user];


then you can use  $user['avatar']['image']


loadMemberData()  can be used with the ID or the name
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Vitti

You just saved my day!

I had to modify it slightly but I got it working.  Thank you!

Here is what I ended up with:

   $user = $member_name;
      $userID=loadMemberData($user, true, 'profile');
      loadMemberContext($userID[0]);
   echo $memberContext[$userID[0]]['avatar']['href'];

Shkic

Quote from: Vitti on June 21, 2011, 07:42:32 PM
You just saved my day!

I had to modify it slightly but I got it working.  Thank you!

Here is what I ended up with:

   $user = $member_name;
      $userID=loadMemberData($user, true, 'profile');
      loadMemberContext($userID[0]);
   echo $memberContext[$userID[0]]['avatar']['href'];

Hey, where you include in Wordpress (in which file) SSI from SMF?

Advertisement: