Problem Upgrading

I recently upgraded from 1.31 to 1.4 and now I get the following error when I try to go to the admin page (the public site seems to be alright).

Fatal error: Cannot redeclare show_untitled_items() (previously declared in /home4/jtarchiv/public_html/admin/themes/default/custom.php:15) in /home4/jtarchiv/public_html/application/views/scripts/functions.php on line 17

I could be wrong, but I think the function show_untitled_items() was rolled into Omeka 1.4, so it needs to be removed from your theme's custom.php file, along with the filter that is declared just above the function.

So basically, remove this...

add_filter(array('Display', 'Item', 'Dublin Core', 'Title'), 'show_untitled_items');

function show_untitled_items($title)
{
    // Remove all whitespace and formatting before checking to see if the title
    // is empty.
    $prepTitle = trim(strip_formatting($title));
    if (empty($prepTitle)) {
        return '[Untitled]';
    }
    return $title;
}

Basically right.

admin/themes/default/custom.php isn't actually shipped with Omeka 1.4, so the entire file can be safely deleted if you haven't customized it at all.

In general, following the instructions on upgrading from the documentation should prevent these types of problems.

Okay, I deleted that portion of that file, and as I was deactivating plugins that I didn't need, now I get this error on each of the items on the public side.

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'show_untitled_items' was given in /home4/jtarchiv/public_html/application/libraries/Omeka/Plugin/Filters.php on line 172

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'show_untitled_items' was given in /home4/jtarchiv/public_html/application/libraries/Omeka/Plugin/Filters.php on line 172

When I try to access the admin page, I get this error ...

Fatal error: Cannot redeclare url_to_link() (previously declared in /home4/jtarchiv/public_html/admin/themes/default/custom.php:54) in /home4/jtarchiv/public_html/application/helpers/StringFunctions.php on line 211

I'm not sure you deleted the correct file.

The file that doesn't exist in Omeka anymore, and should be deleted, is admin/themes/default/custom.php.

From the new messages you posted, it looks like you edited the file application/views/scripts/functions.php, which should have been left alone (you can restore it from your Omeka 1.4 zip if needed).

Well, I modified the functions.php page because I was told to delete those lines. To ensure that the custom.php file is gone I did delete that entire folder, besides I use the ThanksRoy theme.

You can view the site here, jtarchives.org and /admin

So, this is what you should do:

  • Delete admin/themes/default/custom.php. This is the admin theme's custom file, which no longer exists in Omeka. This file existing is the reason you're seeing the errors on the admin pages.
  • Restore application/views/scripts/functions.php. This is a "shared" file, functions here can be used on both the admin and all public themes. The show_untitled_items code that you removed from this file is important, and should have remained there. That code being missing is the reason you're seeing errors on the public pages.

Sorry @gspiro, my initial advice was off, which sent you down the wrong path -- I thought that error was with your public - not admin - theme. Obviously, I need to read more closely.

I was getting the same error after upgrading to 1.4 (followed Upgrade instructions to a T). Even did a fresh download and reinstall several times.

The official Upgrade instructions are missing a step, though -- which you guys might want to fix.

Many of the supported themes (even copies of the most recent versions) already declare show_untitled_items code in their own functions.php file. So, when upgrading to 1.4, the shared application/views/scripts/functions.php file generates the error by trying to re-declare show_untitled_items code.

Once I realized from the error that this function was 1st being declared and parsed from within the functions.php file of each theme, I simply went into each theme I'm experimenting with and removed that code snippet from the theme-specific functions.php file.

In non-default themes, the deprecated show_untitled_items code snippet can be found in either the /themes/themename/custom.php file or the /themes/themename/functions.php file.

Yes, thanks for pointing this out.

Not all of the themes on the Addons section have yet had 1.4-compatible releases, which is why you can still get this error on the latest versions of some themes.

An update:

The Dark, Emiglio, and Santa Fe themes all now have updated versions that are compatible with Omeka 1.4.