Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: kL on March 11, 2007, 07:42:58 PM

Title: help with ssi.php on my wordpress blog
Post by: kL on March 11, 2007, 07:42:58 PM
i have required ssi.php on my main site - http://www.kanyetalk.com/
now the only problem is, i cant use ssi.php to check if the user is a guest or logged. the same exact code works in the actual forum, but not on the main site. $context['user']['is_logged'] returns nothing.
it should show (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.kanyetalk.com%2Fimages%2Fmenu2_logged.png&hash=8528196e25da793e6bbb24d129a26479c2a17fe8) when the user is logged in, yet it doesnt. but it does in the forum itself.
there isnt anything wrong with my code, so it must be something wrong with ssi.php.
other things relating to ssi.php work fine, as you can see.
so what is the problem!!?
Title: Re: help with ssi.php on my wordpress blog
Post by: kL on March 13, 2007, 05:33:11 PM
anybody?
Title: Re: help with ssi.php on my wordpress blog
Post by: codenaught on March 13, 2007, 06:33:46 PM
Can you show us how you are using it? If you are using the code inside a function you need to make sure that you global $context like: global $context;  
Title: Re: help with ssi.php on my wordpress blog
Post by: kL on March 16, 2007, 12:48:41 PM
i have
require("/home/.mogadishu/ktalk/kanyetalk.com/talk/SSI.php"); at the top of the wordpress index.php file (not the theme file), so it is before everything

and in the theme dir in header.php:


<?php if ($context['user']['is_logged']) {$menu2='/images/menu2_logged.png';} else {$menu2='/images/menu2_guest.png';} 
if (
$context['user']['unread_messages'] > )  {$menu2='/images/menu2_logged_new.png';} 
?>

<img src="<?php bloginfo('template_directory'); echo $menu2?>" border="0" usemap="#menu2x" />


the same code works fine in smf itself.
Title: Re: help with ssi.php on my wordpress blog
Post by: kL on March 19, 2007, 06:54:13 PM
anyone?
Title: Re: help with ssi.php on my wordpress blog
Post by: kL on March 25, 2007, 05:38:37 AM
ughhh
Title: Re: help with ssi.php on my wordpress blog
Post by: kL on April 02, 2007, 03:59:18 PM
nobody?!?!?!?!??
Title: Re: help with ssi.php on my wordpress blog
Post by: codenaught on April 02, 2007, 09:22:26 PM
Is that code in a function? If so, you want to make sure you global $context like this:

<?php

function some_function()
{
        global 
$context;

        <
other php code>
}

?>
Title: Re: help with ssi.php on my wordpress blog
Post by: spl1nter on August 23, 2007, 09:28:01 AM
I'm having this exact same problem. My code is not inside any function.
Title: Re: help with ssi.php on my wordpress blog
Post by: spottedhog on August 23, 2007, 10:20:07 AM
sometimes you may need to disable local cookies and enable subdomain cookies
Title: Re: help with ssi.php on my wordpress blog
Post by: spl1nter on August 23, 2007, 11:09:19 AM
I did as you suggested and unfortunately that didn't work. I can get SSI.php to work on every page on my site that I've coded myself, but when I try to use it within wordpress I get nothing. I'm just try to use $context['user']. I tried print_r($context['user']) but it doesn't display anything, the variable just doesn't exist.

I tried editing SSI.php to echo something just to check it was being called properly and it is. I've tried placing the require() in the template header, wp-config.php and wp-settings.php to no success.
Title: Re: help with ssi.php on my wordpress blog
Post by: spottedhog on August 23, 2007, 02:45:17 PM
Try placing this above where you are using $context:

global $context;