Pick Themes 8: Undefined index: title

Started by searchgr, December 02, 2011, 03:13:41 PM

Previous topic - Next topic

searchgr

When i pick a theme i get the following error and the selected theme is not working.

http://www.****.com/index.php?action=theme;sa=pick;u=1;c249a5e=82b0223c98a4d8880458bb4f96158fdf
8: Undefined index: title
File: /home/*****/public_html/Themes/default/Themes.template.php (body_above sub template - eval?)
Line: 553



Any ideas please?

SMF 2.0.1

Illori

Admin -> Server Settings -> Disable evaluation of templates
Then post any new error messages without eval in them

searchgr

Thanks for the prompt reply.

The error now is the following:


http://www.****.com/index.php?action=theme;sa=pick;u=1;c249a5e=82b0223c98a4d8880458bb4f96158fdf
8: Undefined index: title
File: /home/****/public_html/Themes/default/index.template.php
Line: 559

searchgr

Line 559:

                  <span class="', isset($button['is_last']) ? 'last ' : '', 'firstlevel">', $button['title'], '</span>

Kays

Hi, are you using a portal by any chance?

Also, are you also getting a similar error with "href"?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

searchgr

Quote from: Kays on December 02, 2011, 04:48:59 PM
Hi, are you using a portal by any chance?

No.



Quote from: Kays on December 02, 2011, 04:48:59 PM
Also, are you also getting a similar error with "href"?

Yes, same error with href.

Kays

Darn, can't blame it on a portal then.. :)

I am suspecting that it's mod related though. Do you have any mods which adds a button to the menu bar? Also, which version SMF 2.0 are you using?

Something to try. In index.template just above the line where the error occurs look for:


foreach ($context['menu_buttons'] as $act => $button)
{


And add after it:


if (empty($button['href']) || empty($button['title']))
{
$b = array();
foreach ($context['menu_buttons'] as $k => $v)
$b[] = $k . ' - ' . $v['title'] . ' - ' . $v['href'];

log_error(implode('<br />', $b), 'critical');
}


This will print out the button list in the error log whenever that error happens. I've labeled them as critical so that they'll be easy to see. Take a look at this list and try to determine which button is missing or causing this problem.

Then can you post that list and as well attach Subs.php to that post.


If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

searchgr

home - <img align="absMiddle" src="http://www..net/Themes/default/images/menu_icons/house.png" alt="Home"/>  Home - http://www.**.net/index.php
website - **.com - http://www.**.com
golden - <img align="absMiddle" src="http://www.**.net/Themes/default/images/menu_icons/star.png" alt="Home"/>  Golden Star - http://www.**.net/index.php?action=profile;area=subscriptions
search - <img align="absMiddle" src="http://www.**.net/Themes/default/images/menu_icons/magnifier.png" alt="Search"/>  Search - http://www.**.net/index.php?action=search
admin - <img align="absMiddle" src="http://www.**.net/Themes/default/images/menu_icons/star.png" alt="Admin"/>  Admin - http://www.**.net/index.php?action=admin
moderate - <img align="absMiddle" src="http://www.**.net/Themes/default/images/menu_icons/star.png" alt="Moderate"/>  Moderate - http://www.**.net/index.php?action=moderate
usercp - User CP - http://www.**.net/index.php?action=usercp
pm - <img align="absMiddle" src="http://www.**.net/Themes/default/images/menu_icons/email.png" alt="My Messages"/>  My Messages - http://www.**.net/index.php?action=pm
bookmarks - My Bookmarks - http://www.**.net/index.php?action=bookmarks
calendar - <img align="absMiddle" src="http://www.**.net/Themes/default/images/menu_icons/date.png" alt="Calendar"/>  Calendar - http://www.**.net/index.php?action=calendar
mlist - <img align="absMiddle" src="http://www.**.net/Themes/default/images/menu_icons/group.png" alt="Members"/>  Members - http://www.**.net/index.php?action=mlist;sa=search
logout - <img align="absMiddle" src="http://www.**.net/Themes/default/images/menu_icons/delete.png" alt="Logout"/>  Logout - http://www.**.net/index.php?action=logout;cc0f86e=a200153efe9ee6b66d9f28ffac6b6a64
profile - -



Kays

It looks like it's the Profile button. Can't quite see why though. ???

Is this happening to everyone? Or if only to select users. What's different about them? Are they guests?

Which mod is that which adds the icons to the menu button?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

searchgr

Yes, it seems that the problem is the 'Profile' that is not appearing at the menu.

The mod is the Menu Icons (http://custom.simplemachines.org/mods/index.php?mod=2857).

Not sure if the problem is this menu or the Cpanel mod.

I try to find out why the 'Profile' does not appears in the menu.

Kays

I can't replicate it. Neat mod BTW. :)

What is that "usercp" mod that's added after the profile button?

Who is it happening to?

Quote
Is this happening to everyone? Or if only to select users. What's different about them? Are they guests?


If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

searchgr

It happens to everyone.

The profile is inside the user control panel, that's why it doesn't appears at the menu.

http://custom.simplemachines.org/mods/index.php?mod=698

Kays

Hmm, even with that mod installed. I can't replicate the original error.

If you disable the user cp mod. Does the profile button reappear and does the original error stop happening?

BTW, that user cp mod does give a ton of undefined index errors. But none for title and href.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

searchgr

I'm afraid to disable it because it has been modified in order to work with the smf 2.0.1. Hmmm ...

Kays

Just disable it. There's a setting to do so in the Admin CP >> Modification settings >> User CP.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

searchgr

Aha, you are right. The profile button appears and there are no errors in the log file :)
Is it possible to find where is the error in the User Cpanel mod?

Kays

It's not something which is happening in Subs.php since I copied the one you posted to my test forum.

1/ The profile button shouldn't appear in that list you posted at all.
2/ It's in the wrong spot. It shouldn't be at the end.

The only thing I can think of is a hook. But I can't see any additional buttons in that list you posted.

Do you have any mods which should add a button up there but doesn't?
Do you have any other profile related mods installed?

Maybe a list of your installed mods might be an idea.

I can make that error disappear. But it would be nice to figure out what's causing it.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

searchgr

Don't you think that the problem is in the User CPanel mod? When i enable it, i see that errors logs. When i disable it, the 'Profile' button appears at the menu and there are no errors when i switch themes.

Kays

It looks that way but I can't replicate it. Plus I don't see anything odd in the code.

1/ When you interchange the buttons. You only get an error when the User CP button is showing. But other than that it appears to be working properly since one button is being created and not the other and vice versa

2/ It is added to the end after the last button. So I don't think that it's occurring where that array is defined in Subs.php but rather after that. A poorly coded hook could do that.

When the User CP mod is disabled, is the profile button in the correct spot.

Other than that, I'm running out of ideas on where this could be happening. ::)

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

searchgr

Hi Kays,

Thanks for the help, i really appreciate.

I remember that before a long time i have removed the 'View the membership' from the Members button. Is it possible to cause the error?

Kays

Don't think so. The code there looks good.

BTW if you do wish to hide a button, just change "show" to false rather than deleting the code for it..

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Kays

Hi, I just came up with something which might rectify this. If it's still a problem. :)

In Subs.php look for:


$context['menu_buttons'][$current_action]['active_button'] = true;


And change it to:


if (isset($context['menu_buttons'][$current_action]))
$context['menu_buttons'][$current_action]['active_button'] = true;

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

LakeXeno

Now for some humor, I was about to say "it's cause you have *** in your URL." Then I realized it was letters replaced...  O:)

Advertisement: