What/Where is the SMF Userbase? [Cbox Integration Question]

Started by jusplay77, March 08, 2008, 03:18:44 PM

Previous topic - Next topic

jusplay77

Developer Website: http://cbox.ws/

~

I have a Cbox Account and would like to integrate the memberbase with my SMF Forums.  Here is the message I get from my cbox admin panel:

QuoteIf you host your own website with its own userbase, it is quite easy to integrate Cbox so that it automatically assigns the correct names to users logged in to your website.

If your site is PHP-based (e.g. phpNuke, vBulletin, phpBB), alter your Cbox HTML code in the following way:

...&amp;sec=form&amp;nme=<?=urlencode($name)?>&amp;nmekey=<?=md5('xxxxxxxxxxxx'.$name)?>

QuoteWhere the variable $name appears, insert the variable that represents the user's name as retrieved from your userbase. This will vary depending on your CMS or forum system. After changing your code, enable user override below.

My question is, what variable in SMF represents the userbase.

jusplay77


Eliana Tamerin

If you want to use the username, use

$context['user']['username']

If you want to use the display name, use

$context['user']['name']
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

Kindred

actually, for the currently logged in user, the variable $user_info has most of what you need....

$user_info['username']
$user_info['name']
Сл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."

jusplay77

Thanks!  So it should look like this?

...&amp;sec=form&amp;nme=<?=urlencode($user_info['username'])?>&amp;nmekey=<?=md5('xxxxxxxxxxxx'.$user_info['username'])?>

or this?

...&amp;sec=form&amp;nme=<?=urlencode($user_info['username'])?>&amp;nmekey=<?=md5('xxxxxxxxxxxx'.$name)?>

Eliana Tamerin

Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

jusplay77

neither worked.. I got several errors in my index.template.php when adding that..

Cbox Code Prior to Integration:

<iframe frameborder="0" width="455" height="140" src="http://www.cbox.ws/box/?boxid=111111&amp;boxtag=1111&amp;sec=main" marginheight="2" marginwidth="2" scrolling="auto" allowtransparency="yes" name="cboxmain" style="border:#DBE2ED 1px solid;" id="cboxmain"></iframe>
<iframe frameborder="0" width="135" height="140" src="http://www.cbox.ws/box/?boxid=111111&amp;boxtag=1111&amp;sec=form" marginheight="2" marginwidth="2" scrolling="no" allowtransparency="yes" name="cboxform" style="border:#DBE2ED 1px solid;border-top:0px" id="cboxform"></iframe>


Instructions say:

QuoteIf your site is PHP-based (e.g. phpNuke, vBulletin, phpBB), alter your Cbox HTML code in the following way:

...&amp;sec=form&amp;nme=<?=urlencode($name)?>&amp;nmekey=<?=md5('1fbhp111mcb11iai'.$name)?>

Cbox code after I edited it, (and it didnt work):

[code]<iframe frameborder="0" width="455" height="140" src="http://www.cbox.ws/box/?boxid=111111&amp;boxtag=1111&amp;sec=main" marginheight="2" marginwidth="2" scrolling="auto" allowtranspareancy="yes" name="cboxmain" style="border:#DBE2ED 1px solid;" id="cboxmain"></iframe>
<iframe frameborder="0" width="135" height="140" src="http://www.cbox.ws/box/?boxid=111111&amp;boxtag=1111&amp;sec=form&amp;nme=<?=urlencode($user_info['username'])?>&amp;nmekey=<?=md5('1fbhp111mcb11iai'.$user_info['username'])?>" marginheight="2" marginwidth="2" scrolling="no" allowtransparency="yes" name="cboxform" style="border:#DBE2ED 1px solid;border-top:0px" id="cboxform">


--

Not sure why this isn't working /sigh

Eliana Tamerin

Try $context['user']['username'] then, and see if that works.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

Kindred

you can not use either one without first including SSI.php
Сл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."

Eliana Tamerin

If the code is put into one of the template files, I should think he'd be able to use it. If it's elsewhere, then yeah, he'd have to call SSI.php first.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

Kindred

wait....   is he pasting code into index.template.php?

Well then, you'll need to include the code within an echo statement...   and bump out of the echo for the variables. You can't just paste THAT code straight into a php file.
Сл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."

Eliana Tamerin

Not really, it has the <? and ?> tags around the variable. So long as its in an echo statement (likely lumped in with other html code) it should be alright.

Mind you, I've never tested that.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

Kindred

Eliana... no. You are incorrect.


in SMF, the template files all have <?php as the first and ?> as the last items in the file...   so the entire file is enclosed.


so, something like this would be used, if the code is to be included in on of the smf theme files.


$encodedname = urlencode($user_info['username']);
$md5name = md5('1fbhp111mcb11iai'.$user_info['username']);

echo '
<iframe frameborder="0" width="455" height="140" src="http://www.cbox.ws/box/?boxid=111111&amp;boxtag=1111&amp;sec=main" marginheight="2" marginwidth="2" scrolling="auto" allowtranspareancy="yes" name="cboxmain" style="border:#DBE2ED 1px solid;" id="cboxmain"></iframe>
<iframe frameborder="0" width="135" height="140" src="http://www.cbox.ws/box/?boxid=111111&amp;boxtag=1111&amp;sec=form&amp;nme=' . $encodedname . '&amp;nmekey=' . $md5name . '" marginheight="2" marginwidth="2" scrolling="no" allowtransparency="yes" name="cboxform" style="border:#DBE2ED 1px solid;border-top:0px" id="cboxform">';



I also notice that the second <iframe> tag is never closed.

running smf in an iframe will lead to issues.
Сл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."


FireDitto

Second Pass Weyr<br />An AU Pernse RPG<br /><br />SMF 2.0.6 with SP 2.3.5

Dragooon

Quote from: FireDitto on April 24, 2014, 12:17:41 AM
Will this hack work for the current release of SMF?
Yeah, the variables are pretty much the same.

Advertisement: