TinyPortal

Development => Support => Topic started by: leftezi on November 02, 2016, 12:29:27 AM

Title: Undefined index: forum_name
Post by: leftezi on November 02, 2016, 12:29:27 AM
SMF version: SMF 2.0.12
TP version: TP 1.2
Default Forum Language: Greek UTF8
Theme name and version: Curve (Default)
Related Error messages:

....index.php?action=dlattach;attach=7959;type=avatar
8: Undefined index: forum_name
File: ...Themes/default/languages/TPortal.english.php
Line: 305

line 305 is:
==>305:   $txt['whoall_forum'] = 'Viewing the board index of <a href="' . $scripturl . '">' . $context['forum_name'] . '[/url].';


and

..../index.php?action=dlattach;attach=9716;type=avatar
8: Undefined index: forum_name
File: ...Themes/default/languages/TPortal.greek-utf8.php
Line: 291

line 291 is:
==>291:$txt['whoall_forum'] = 'Εμφάνιση του καταλόγου του φόρουμ του <a href="' . $scripturl . '">' . $context['forum_name'] . '[/url].';


There are thousands of this errors
Title: Re: Undefined index: forum_name
Post by: illori on November 02, 2016, 09:56:55 AM
this has been reported a few times and the only real fix we have found is to move avatars out of the attachments folder. it will solve the issue and may help with performance on your forum. it is not an ideal fix but SMF 2.1 is going this way moving forward anyway. http://www.simplemachines.org/community/index.php?topic=197938.0
Title: Re: Undefined index: forum_name
Post by: bloc on November 02, 2016, 08:06:56 PM
I would think putting a small logic in there might help with the error. Have you guys tried exchanging:

$txt['whoall_forum'] = 'Viewing the board index of <a href="' . $scripturl . '">' . $context['forum_name'] . '</a>.';

with:

$txt['whoall_forum'] = 'Viewing the board index of <a href="' . $scripturl . '">' . (!empty($context['forum_name']) ? $context['forum_name'] : '*') . '</a>.';
Title: Re: Undefined index: forum_name
Post by: illori on November 03, 2016, 09:17:06 AM
that does seem to resolve the error, but i wonder what is causing it in the first place and why not everyone that has the $context['forum_name'] defined has this error.
Title: Re: Undefined index: forum_name
Post by: bloc on November 04, 2016, 12:42:38 AM
Well, the attach/download routine of avatars skips quite abit of code normally introduced in other actions. $context['forum_name'] probably never gets set...or at least not in every scenario.
Title: Re: Undefined index: forum_name
Post by: leftezi on November 14, 2016, 10:45:32 PM
Sorry for my late answer. Although i have notifications turned on for the topic, i received no email notification.

Thank you all for your time and special thanks to Bloc.  O0

The solution with the code was easier for me. I replaced the code and now i have no errors.