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!!?
anybody?
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;
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'] > 0 ) {$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.
anyone?
ughhh
nobody?!?!?!?!??
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>
}
?>
I'm having this exact same problem. My code is not inside any function.
sometimes you may need to disable local cookies and enable subdomain cookies
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.
Try placing this above where you are using $context:
global $context;