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
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 11, 2013 - 2:48 pm

is this on a standard page within the wp hierarchy???  if so, that wp global should be available... you could try using the SP global instead which should be set up by the api call...

    <?php 
    sp_forum_api_support();
    global $spThisUser;
    $profile_url = sp_url().urlencode($spThisUser->user_login);
    $avatar = sp_UserAvatar('get=1&context=user', $spThisUser->ID);
    $avatar_url = $avatar->url;
    global $user_ID, $user_identity; 
    ?>
Avatar
Nate
Member
sp_UserOfflineSmall Offline
Apr 11, 2013 - 3:20 pm

It's in the sidebar303.php on this page http://www.rockitpro.com/testimonies/ (right sidebar)

I tried your latest code and that didn't work either. I've spent all day on this so I think I'm going to bow out lol, I've been defeated.

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

defeated?  never...  but looking at that page, and what is actually going on, I am going to go back to my very first question... is this for the logged in user???

now I can see the answer is no...  so whole different ball game...

not sure where some of the variables in your code come from - should be cbox... so try this:

    <?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;
    ?>

lol, would be a lot easier if I was on the server and could inspect stuff! ;)

Avatar
Nate
Member
sp_UserOfflineSmall Offline
Apr 11, 2013 - 3:51 pm

I guess you're right, guests can see the chat box and see all users that have posted in it, the guests just can't post a message in the chat box until they log in to my website.

That new code doesn't change anything. I can send you my sidebar303.php file if you give me an email or a way to send through here.

The chat box settings are in my account on http://www.CBox.ws, so the only cbox code on my website is what I posted in my last pastebin and this is the integration page in my cbox account:

cbox settingsImage Enlarger

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

well, still not sure we are talking apples to apples...  what is $user_id???  is the id of the user INSIDE the chatbox that you want a profile for?  its going to be up to the cbox to tell us the ID of that user within the chatbox who posted...  given that variable - and I have been assuming you are saying its $user_ID - I can create the urls for you... 

but from the last post, I cannot tell if that is true...

at this point, easiest thing to do, if you are willing, is to send me via pm, a temp wp admin account for the site and ftp credentials...  then I can play and debug and try to get it working...

Avatar
Nate
Member
sp_UserOfflineSmall Offline
Apr 11, 2013 - 4:23 pm

Isn't $user_id the get user Wordpress call? http://codex.wordpress.org/WPM.....nt_user_id

CBox is totally separate from Wordpress but CBox recently made it so that you can integrate the CBox chat box with your Wordpress users. Before integration, guests and members of my site had to pick a username for the chat box and then post their message in the chat box, but now the integration allows members already logged in to my site to post messages on the chat box.

What I'm trying to do is get the usernames INSIDE the chat box (which are the same usernames of my Wordpress members) to link to their SimplePress profiles and show their SimplePress avatars. It's the exact same username as they use on my forums because the cbox is pulling them from my Wordpress database.

Well avatars sorta work now all of a sudden...I just posted a message in the chat box and it shows my avatar http://www.rockitpro.com/testimonies/ but it's not showing the member's avatar below me. He should have the standard avatar showing. My Sho-Down name is also linking to http://www.rockitpro.com/sf-forum/ instead of my profile.

The code you gave me is having no effect though, CBox is pulling my avatar with &pic=<?php echo urlencode($avatar_url)?>

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

well first, that function is not getting called... just $user_ID being used...  and that gets back to the CURRENT logged in user...  when you want to show those avatars in the chat, you want the user id of that user, NOT the current logged in user...  so the chat box has to be providing the user id...  or giving us a prototype such that we can insert a url with a placeholder for the user id...

as I said, I have not idea where $user_ID and $user_identity are coming from in the code snippet you have...  which is why I asked if cbox was filling it for each user in the chat window where you want an avatar and profile link...

I can give you the url prototype, but I cannot create the IDs for the users in the chat box...  but they must know how to do it...

Avatar
Nate
Member
sp_UserOfflineSmall Offline
Apr 11, 2013 - 5:18 pm

Check the image I posted above, the $user_ID and $user_identity are in Step 1 on my CBox integration set up page where it tells me to post this into my theme:

<?php global $user_ID, $user_identity ?> <?php if ( $user_ID ) : ?> [your Cbox HTML code] <?php endif; ?>
Avatar
Nate
Member
sp_UserOfflineSmall Offline
Apr 11, 2013 - 5:20 pm

So this is the original CBox code that I have on http://www.rockitpro.com/testimonies/ right now, it's pulling my avatar and linking my username to http://www.rockitpro.com/sf-forum/

<?php global $user_ID, $user_identity ?>
<!-- BEGIN CBOX - www.cbox.ws - v001 -->
<div id="cboxdiv" style="text-align: center; line-height: 0">
<ul><li>
<div><i.f.r.ame frameborder="0" width="286" height="185" src="http://www5.cbox.ws/box/?boxid=377963&boxtag=6685&sec=main" scrolling="auto" allowtransparency="yes" name="cboxmain5-377963" style="border:#DBE2ED 0px solid;" id="cboxmain5-377963"></iframe></div>
<div><i.f.r.ame 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="cboxform5-377963" style="border:#DBE2ED 0px solid;border-top:0px" id="cboxform5-377963"></iframe>
</li></ul>
</div></div>
<!-- END CBOX -->
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 11, 2013 - 5:28 pm

you are missing my point... where is $user_ID actually getting a value??  is it filled by cbox??? 

what form do they want for $avatar_url and $profile_url??? 

each of those urls are based on the specific user that you want see them for...  at this point in the code, we do not know the user id of each user you are going to show an avatar for...

I can of course give the prototype or form of the urls but I cannot fill the data at this point...  its likely they are using placeholders for the data - would just need to know the format...  and it they want a user id for the profile, we dont use that... its user_login not the id...

this may seem complex, but in the world of APIs, its quite straight forward... just have to know the details of both sides (ie expected inputs and outputs)..

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