Simple Machines Community Forum

Customizing SMF => Bridges and Integrations => Topic started by: -Dave on September 10, 2012, 03:46:32 AM

Title: lightirc
Post by: -Dave on September 10, 2012, 03:46:32 AM
hi all i have got this bit of code i want to bring smf usernames into lightirc but it is not working  so i was after some help please

<?php
require_once('../ccn/SSI.php');
global 
$context;

if (
$context['user']['is_guest']) {
    
$userchatname 'chatz-Guest_' rand(1,10000);
} else {
    
$userchatname $context['user']['name'];
}

$userchatname str_replace(" ","_",$userchatname);
$userchatname str_replace(".","_",$userchatname);

?>


params.nick                         = "<?php echo($userchatname); ?>";
Title: Re: lightirc
Post by: Kindred on September 10, 2012, 11:16:49 AM
echo?   that doesn't seem right.
Title: Re: lightirc
Post by: -Dave on September 10, 2012, 10:43:40 PM
Thanx kindred  what would you use  to pull the usernames?
Title: Re: lightirc
Post by: Kindred on September 10, 2012, 11:54:53 PM
Not sure... But including the whole file would be a help...
Title: Re: lightirc
Post by: -Dave on September 11, 2012, 12:32:19 AM
this is whole file Kindred and thanx
Title: Re: lightirc
Post by: Kindred on September 11, 2012, 07:53:09 AM
ok....   I am confused as all heck now...

this is a .php file...   You open with the <?php and include/require SSI...   but then you close the php with the ?> and go on to the rest of the file and settings and functions.  huh? ???

Please attach the ORIGINAL file from your lightirc installation, before you added the SSI code.
Title: Re: lightirc
Post by: -Dave on September 12, 2012, 05:09:00 AM
here is the file
Title: Re: lightirc
Post by: -Dave on September 12, 2012, 07:38:03 AM
This is solved  thanx  Kindred for your help i went back thru the code and found my mistakes  ::)
Title: Re: lightirc
Post by: Kindred on September 12, 2012, 09:37:53 AM
glad you were able to fix it. Mind stating how, for future references?

Also, sorry I didn't respond faster; I was going to take a look at it tomorrow, when I got some free time with a real computer rather than an iDevice.
Title: Re: lightirc
Post by: -Dave on September 12, 2012, 07:18:07 PM
Sure i can do that  if it will help others with lightirc
<?php
require_once('../ccn/SSI.php');
global 
$context;

/*if ($context['user']['is_guest']) {*/
if ($context["user"]["id"]<1) {
    
$userchatname 'chatz-Guest_' rand(1,10000);
} else {
    
$userchatname $context['user']['name'];
}
$userchatname str_replace(" ","_",$userchatname);
$userchatname str_replace(".","_",$userchatname);

?>



params.nick                         = "<?php echo $userchatname?>";
Title: Re: lightirc
Post by: Kindred on September 12, 2012, 07:24:54 PM
hmmm.... that should not have made a difference.

$context["user"]["id"]<1 should return the same thing as $context['user']['is_guest']
Title: Re: lightirc
Post by: -Dave on September 12, 2012, 09:44:41 PM
well that is what i thought but it does work