Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
coding-topic
Trying to call Simplepress profile and avatar into a CBox chat box
Avatar
Nate
Member
sp_UserOfflineSmall Offline
Apr 11, 2013 - 5:35 pm

Yea man, I'm totally lost lol. I'll pass along the info to the cbox admin and see what he says

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 11, 2013 - 5:36 pm

okay, will be here...

Avatar
Nate
Member
sp_UserOfflineSmall Offline
Apr 12, 2013 - 7:40 am

Here's what he said:

I'm glad to see that your own profile/avatar linking is working -- this suggests the code is fine, but that the other users are not configured with avatars, or something else is getting in the way. It sounds like you are getting good support from the platform provider. This information may be useful:

Cbox only requires three variables from the platform, which it inserts into the iframe source query string:

$user_identity -- this is just the current user's display name, a UTF-8 string.
$profile_url -- this is an absolute URI for the current user's profile page, a string as above.
$avatar_url -- this is an absolute URI for the current user's picture, a string as above. This URI needs to end in a supported image format extension, e.g. .gif, .jpg, or .png.

Your Integration code does the urlencoding necessary on these strings, so they just need to be available (in scope) at the point that your Integrated Cbox code is inserted.

The names of these variables are not important; only their position in the Integrated Cbox code matters.

But as mentioned, the fact that your own avatar/profile is working suggests the Integrated code is already okay, and that there's some other problem preventing other users' details being brought into scope -- perhaps a platform setting is preventing other user groups' info from being retrieved from the database or session?

Avatar
Nate
Member
sp_UserOfflineSmall Offline
Apr 12, 2013 - 7:42 am

And here's the code that shows my avatar, so something's on the right track, it's just not showing other member's avatars or the correct profile url:

<?php 
 global $user_ID, $user_identity; 
 sp_forum_api_support();
 $user_login = get_user_meta($user_ID, 'user_login', true);
 $profile_url = sp_url().urlencode($user_login);
 $avatar = sp_UserAvatar('get=1&context=user', $user_ID);
 $avatar_url = $avatar->url;
 ?>
<!-- BEGIN CBOX - www.cbox.ws - v001 -->
<div id="cboxdiv" style="text-align:center; line-height:0">
<ul><li>
<i.f.rame frameborder="0" width="286" height="185" src="http://www5.cbox.ws/box/?boxid=377963&boxtag=6685&sec=main" scrolling="auto" allowtransparency="yes" name="cboxmain" style="border:#DBE2ED 0px solid;" id="cboxmain"></iframe>
<i.f.rame frameborder="0" width="286" height="75" src="http://www5.cbox.ws/box/?boxid=377963&boxtag=6685&sec=form&nme=<?php echo urlencode($user_identity)?>&nmekey=<?php echo md5('PRIVATEKEY'.$user_identity)?>&pic=<?php echo urlencode($avatar_url)?>&lnk=<?php echo urlencode($profile_url)?>&ekey=<?php echo md5("PRIVATEKEY"."\t".$avatar_url."\t".$profile_url)?>" scrolling="no" allowtransparency="yes" name="cboxform" style="border:#DBE2ED 0px solid;border-top:0px" id="cboxform"></iframe>
</li></ul>
</div></div>
<!-- END CBOX -->
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 12, 2013 - 9:30 am

good that these guys are staying with you here...

but they are right, if its working for you, it should be working for them...

have any other users posted a chat since you put the above code in place??? it cannot go back in time and create the profile and avatar urls.  But when a user make a new chat entry, it should get them...

Avatar
Nate
Member
sp_UserOfflineSmall Offline
Apr 12, 2013 - 9:59 am

Avatars are working. I just created a new user, uploaded an avatar and posted a message http://www.rockitpro.com and it's showing the avatar.

Now we just need to figure out why the username is linking to http://www.rockitpro.com/sf-forum/ instead of http://www.rockitpro.com/sf-fo.....ernamehere

Avatar
Nate
Member
sp_UserOfflineSmall Offline
Apr 12, 2013 - 10:04 am

Also, shouldn't this work: $avatar = sp_UserAvatar('get=1&width=20px&context=user', $user_ID);

I'm trying to resize the avatar from 45 to 20px but it's still coming up 45x45

Edit: Nevermind, avatar size is controlled by CBox css, got sizes changed.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 12, 2013 - 11:16 am

on avatar size, okay... but the argument in our template function is size, not width...

if it worked for you and worked for their avatar, should for profile too...

looking more at the cbox code, since they already do a urlencode(), I would change:

$profile_url = sp_url().urlencode($user_login);

to

$profile_url = sp_url().$user_login;

but not likely to matter...  what is the login name of this account?

Avatar
Nate
Member
sp_UserOfflineSmall Offline
Apr 12, 2013 - 11:26 am

Yea that didn't change anything, still linking to http://www.rockitpro.com/sf-forum/

Log in name of which account?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 12, 2013 - 11:46 am

the user account you created and tested with...  but I think I see the issue... lets try this instead - think I was over complicating it... just the part before the cbox stuff...

<?php 
 global $user_ID, $user_identity, $user_login; 
 sp_forum_api_support();
 $profile_url = sp_url().$user_login;
 $avatar = sp_UserAvatar('get=1&context=user', $user_ID);
 $avatar_url = $avatar->url;
 ?>

 

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626