collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 856
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: Getting errors in my logs - 8: Undefined variable: user_info  (Read 5383 times)

0 Members and 1 Guest are viewing this topic.

Offline cloksin

  • Jr. Member
  • **
  • Posts: 56
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
I'm working on rebuilding my site and I have a fresh install of the final 2.0 release, SP 2.3.3, and the default admin, nothing more, yet I am getting this error:

Code: [Select]
http://www.mysite.net/forum/index.php?action=forum
8: Undefined variable: user_info
File: /var/www/html/forum/Themes/default/BoardIndex.template.php (portal_above sub template - eval?)
Line: 83

I have six blocks setup, Recent topics, Calendar, a shoutbox, and three custom ones.

custom block 1:
Code: [Select]
global $txt, $modSettings, $scripturl, $context, $sourcedir, $settings;

if (!$user_info['is_guest']) {
//echo '<a href="', $scripturl, '?action=dxrecent;style=full;type=last">Topics - Last 50 </a><br />';
//echo '<a href="', $scripturl, '?action=dxrecent;style=full;type=hours">Topics - Last 24 hrs</a><br />';
echo 'Topics - Last 50 (disabled)<br />';
echo 'Topics - Last 24hrs (disabled)<br />';
echo '<a href="', $scripturl, '?action=profile;area=notification;">Topics - You\'re Watching</a><br />';
echo '<a href="', $scripturl, '?action=bookmarks">Topics - You\'ve Bookmarked</a><br />';

echo '<hr>';

// Get the user online list.
require_once($sourcedir . '/Subs-MembersOnline.php');
$membersOnlineOptions = array(
'show_hidden' => allowedTo('moderate_forum'),
'sort' => 'log_time',
'reverse_sort' => true,
);
$context += getMembersOnlineStats($membersOnlineOptions);

// "Users online" - in order of activity.
echo ' <a href="' . $scripturl . '?action=who">Who\'s Online</a><br />';
echo '
<div class="infocenter_section">
<div class="windowbg">
<div>
', $context['num_guests'], ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'],' ', '(' . $context['num_users_hidden'], ' ', $context['num_users_hidden'] == 1 ? $txt['hidden'] : $txt['hidden'], ')';

// Handle hidden users and buddies.
$bracketList = array();
if ($context['show_buddies'])
$bracketList[] = $context['num_buddies'] . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
if (!empty($context['num_spiders']))
$bracketList[] = $context['num_spiders'] . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
//if (!empty($context['num_users_hidden']))
//$bracketList[] = $context['num_users_hidden'] . ' ' . $txt['hidden'];

if (!empty($bracketList))
echo ' (' . implode(', ', $bracketList) . ')';

echo $context['show_who'] ? '</a>': '', '
<div class="smalltext">';

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online']))
{
echo '
', sprintf($txt['users_active'], $modSettings['lastActive']), ':<br />', implode(', ', $context['list_users_online']);

echo '
</div>
<hr />
<div class="smalltext">';

// Showing membergroups?

$context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array());

if (!empty($settings['show_group_key']) && !empty($context['membergroups']))

echo '

[' . implode('][', $context['membergroups']) . ']';

}

echo '
</div>
<hr />
<div class="smalltext">
', $txt['most_online_today'], ': <b>', $modSettings['mostOnlineToday'], '</b>.
', $txt['most_online_ever'], ': ', $modSettings['mostOnline'], ' (' , timeformat($modSettings['mostDate']), ')
</div>
</div>
</div>
</div>';
echo '<hr>';

}

// Admin only
if ($user_info['is_admin']) {
echo '<a href="', $scripturl , '?action=admin;area=viewmembers;sa=browse;type=activate', '">', sprintf($txt['admin_browse_awaiting_activate'], $context['awaiting_activation']), '</a><br />';
}

custom block 2:
Code: [Select]
<center><h5>If you would like to help pay our bills and keep us online click the image below.</h5></center>
<center><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
                <input type="hidden" name="cmd" value="_s-xclick" />
                <input type="hidden" name="hosted_button_id" value="xxxxx" />
                <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
                <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
            </form></center>

custom block 3:
Code: [Select]
<br /><font style="color:black; font-size:25px;"><u>Welcome to xxxxxx</u></font><br /><br />

xxxxx<br /><br />

xxxxx<br /><br />

xxxxxx<a href=xxxxxxx><u>xxxxxxx</u></a> xxxxxxxx<br /><br />

xxxxxxx<u><font style="color:#33cc00;">xxxxxxxx</font></u>xxxxxxxxx<br /><br />

<u><b><font style="color:#ff3366;">xxxxxx</font></b></u>xxxxxxxx<b>xxxxxxxx</b>xxxxxx <u><b>xxxxxxx</b></u>xxxxxxxxxx<b>xxxxxxxxxx</b><br /><br />

xxxxxxxxxx<br /><br />

xxxxxxxxxxxxxxxxxxxxx

Any help on figuring out how to correct this error in my logs would be greatly appreciated.

Offline Kryzen

  • Localizer
  • Language
  • *
  • Posts: 826
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Getting errors in my logs - 8: Undefined variable: user_info
« Reply #1 on: June 23, 2011, 03:15:37 PM »
Hi, does this work for custom block one:
Code: [Select]
global $txt, $modSettings, $scripturl, $context, $sourcedir, $settings, $user_info;

if (!$user_info['is_guest']) {
//echo '<a href="', $scripturl, '?action=dxrecent;style=full;type=last">Topics - Last 50 </a><br />';
//echo '<a href="', $scripturl, '?action=dxrecent;style=full;type=hours">Topics - Last 24 hrs</a><br />';
echo 'Topics - Last 50 (disabled)<br />';
echo 'Topics - Last 24hrs (disabled)<br />';
echo '<a href="', $scripturl, '?action=profile;area=notification;">Topics - You\'re Watching</a><br />';
echo '<a href="', $scripturl, '?action=bookmarks">Topics - You\'ve Bookmarked</a><br />';

echo '<hr>';

// Get the user online list.
require_once($sourcedir . '/Subs-MembersOnline.php');
$membersOnlineOptions = array(
'show_hidden' => allowedTo('moderate_forum'),
'sort' => 'log_time',
'reverse_sort' => true,
);
$context += getMembersOnlineStats($membersOnlineOptions);

// "Users online" - in order of activity.
echo ' <a href="' . $scripturl . '?action=who">Who\'s Online</a><br />';
echo '
<div class="infocenter_section">
<div class="windowbg">
<div>
', $context['num_guests'], ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'],' ', '(' . $context['num_users_hidden'], ' ', $context['num_users_hidden'] == 1 ? $txt['hidden'] : $txt['hidden'], ')';

// Handle hidden users and buddies.
$bracketList = array();
if ($context['show_buddies'])
$bracketList[] = $context['num_buddies'] . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
if (!empty($context['num_spiders']))
$bracketList[] = $context['num_spiders'] . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
//if (!empty($context['num_users_hidden']))
//$bracketList[] = $context['num_users_hidden'] . ' ' . $txt['hidden'];

if (!empty($bracketList))
echo ' (' . implode(', ', $bracketList) . ')';

echo $context['show_who'] ? '</a>': '', '
<div class="smalltext">';

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online']))
{
echo '
', sprintf($txt['users_active'], $modSettings['lastActive']), ':<br />', implode(', ', $context['list_users_online']);

echo '
</div>
<hr />
<div class="smalltext">';

// Showing membergroups?

$context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array());

if (!empty($settings['show_group_key']) && !empty($context['membergroups']))

echo '

[' . implode('][', $context['membergroups']) . ']';

}

echo '
</div>
<hr />
<div class="smalltext">
', $txt['most_online_today'], ': <b>', $modSettings['mostOnlineToday'], '</b>.
', $txt['most_online_ever'], ': ', $modSettings['mostOnline'], ' (' , timeformat($modSettings['mostDate']), ')
</div>
</div>
</div>
</div>';
echo '<hr>';

}

// Admin only
if ($user_info['is_admin']) {
echo '<a href="', $scripturl , '?action=admin;area=viewmembers;sa=browse;type=activate', '">', sprintf($txt['admin_browse_awaiting_activate'], $context['awaiting_activation']), '</a><br />';
}
?

Tah Zonemaster

Offline cloksin

  • Jr. Member
  • **
  • Posts: 56
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Getting errors in my logs - 8: Undefined variable: user_info
« Reply #2 on: June 23, 2011, 04:12:41 PM »
Well, I verified that the problem IS with that block, I removed the block and my errors are all gone, but when I put the block back, and use the code you posted, I still get the same error.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Getting errors in my logs - 8: Undefined variable: user_info
« Reply #3 on: June 24, 2011, 12:44:51 PM »
Were you able to solve this issue?

The problem is with custom block 1. You need to add $user_info variable to the function globals. (the first line)
And slowly, you come to realize... It's all as it should be...

Offline cloksin

  • Jr. Member
  • **
  • Posts: 56
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Getting errors in my logs - 8: Undefined variable: user_info
« Reply #4 on: July 07, 2011, 11:46:24 AM »
I've added the $user_info variable and am still getting the same error

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Getting errors in my logs - 8: Undefined variable: user_info
« Reply #5 on: July 07, 2011, 11:52:26 AM »
Can you copy the exact current code saved for that custom block?
And slowly, you come to realize... It's all as it should be...

Offline cloksin

  • Jr. Member
  • **
  • Posts: 56
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Getting errors in my logs - 8: Undefined variable: user_info
« Reply #6 on: July 07, 2011, 12:01:54 PM »
Code: [Select]
global $txt, $modSettings, $scripturl, $context, $sourcedir, $settings; $user_info; $awaiting_activation;

if (!$user_info['is_guest']) {
//echo '<a href="', $scripturl, '?action=dxrecent;style=full;type=last">Topics - Last 50 </a><br />';
//echo '<a href="', $scripturl, '?action=dxrecent;style=full;type=hours">Topics - Last 24 hrs</a><br />';
echo 'Topics - Last 50 (disabled)<br />';
echo 'Topics - Last 24hrs (disabled)<br />';
echo '<a href="', $scripturl, '?action=profile;area=notification;">Topics - You\'re Watching</a><br />';
echo '<a href="', $scripturl, '?action=bookmarks">Topics - You\'ve Bookmarked</a><br />';

echo '<hr>';

// Get the user online list.
require_once($sourcedir . '/Subs-MembersOnline.php');
$membersOnlineOptions = array(
'show_hidden' => allowedTo('moderate_forum'),
'sort' => 'log_time',
'reverse_sort' => true,
);
$context += getMembersOnlineStats($membersOnlineOptions);

// "Users online" - in order of activity.
echo ' <a href="' . $scripturl . '?action=who">Who\'s Online</a><br />';
echo '
<div class="infocenter_section">
<div class="windowbg">
<div>
', $context['num_guests'], ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'],' ', '(' . $context['num_users_hidden'], ' ', $context['num_users_hidden'] == 1 ? $txt['hidden'] : $txt['hidden'], ')';

// Handle hidden users and buddies.
$bracketList = array();
if ($context['show_buddies'])
$bracketList[] = $context['num_buddies'] . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
if (!empty($context['num_spiders']))
$bracketList[] = $context['num_spiders'] . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
//if (!empty($context['num_users_hidden']))
//$bracketList[] = $context['num_users_hidden'] . ' ' . $txt['hidden'];

if (!empty($bracketList))
echo ' (' . implode(', ', $bracketList) . ')';

echo $context['show_who'] ? '</a>': '', '
<div class="smalltext">';

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online']))
{
echo '
', sprintf($txt['users_active'], $modSettings['lastActive']), ':<br />', implode(', ', $context['list_users_online']);

echo '
</div>
<hr />
<div class="smalltext">';

// Showing membergroups?

$context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array());

if (!empty($settings['show_group_key']) && !empty($context['membergroups']))

echo '

[' . implode('][', $context['membergroups']) . ']';

}

echo '
</div>
<hr />
<div class="smalltext">
', $txt['most_online_today'], ': <b>', $modSettings['mostOnlineToday'], '</b>.
', $txt['most_online_ever'], ': ', $modSettings['mostOnline'], ' (' , timeformat($modSettings['mostDate']), ')
</div>
</div>
</div>
</div>';
echo '<hr>';

}

// Admin only
if ($user_info['is_admin']) {
echo '<a href="', $scripturl , '?action=admin;area=viewmembers;sa=browse;type=activate', '">', sprintf($txt['admin_browse_awaiting_activate'], $context['awaiting_activation']), '</a><br />';
}

This is a fresh install of SMF 2.0 final, I'm rebuilding my current site and just installed it this morning, all I've done is installed the forum, copied the default theme 10 times to make 10 templates that I can later change the color on, moved the portal.css file into the css folder of each of these themes, and installed simple portal 2.3.3.  I can PM you with the link and an admin logon if necessary.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Getting errors in my logs - 8: Undefined variable: user_info
« Reply #7 on: July 07, 2011, 12:24:47 PM »
You need to separate variables for global definition by a comma, not semicolon. First line should be:

Code: [Select]
global $txt, $modSettings, $scripturl, $context, $sourcedir, $settings, $user_info, $awaiting_activation;
And slowly, you come to realize... It's all as it should be...

Offline cloksin

  • Jr. Member
  • **
  • Posts: 56
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Getting errors in my logs - 8: Undefined variable: user_info
« Reply #8 on: July 07, 2011, 12:56:57 PM »
Duh.... *face_palm*  I should've caught that.  It got rid of the original error, thanks.  I still have two other errors and I'm sure they have to do with the same block.  I've commented out the last section of the code:

Code: [Select]
// Admin only
if ($user_info['is_admin']) {
echo '<a href="', $scripturl , '?action=admin;area=viewmembers;sa=browse;type=activate', '">', sprintf($txt['admin_browse_awaiting_activate'], $context['awaiting_activation']), '</a><br />';
}

That was giving me an error, and it never worked anyway, but even with that commented out I am getting the following errors:

Code: [Select]
Apply Filter: Only show the error messages of this URL
http://www.myforum.net/forum/index.php?
Apply Filter: Only show the errors with the same message
8: Undefined index: show_who
Apply Filter: Only show the errors from this file
File: /var/www/html/forum/Themes/default/PortalArticles.template.php (portal_above sub template - eval?)
Line: 42

and

Code: [Select]
Apply Filter: Only show the error messages of this URL
http://www.myforum.net/forum/index.php?
Apply Filter: Only show the errors with the same message
8: Undefined index: show_buddies
Apply Filter: Only show the errors from this file
File: /var/www/html/forum/Themes/default/PortalArticles.template.php (portal_above sub template - eval?)
Line: 32

Any idea what's causing these?

I have "enable articles articles" UNchecked in the SP settings.

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Getting errors in my logs - 8: Undefined variable: user_info
« Reply #9 on: July 25, 2011, 11:43:36 AM »
You are getting that error because you are trying to use $context['show_who'], but have never defined it. you can't use it if it doesn't exist.
You need to call something that sets up that part of $context properly. Then it will work
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?