After creating a block with this snippet:

<?
$nid = 10;
$node_for_TOC = node_load($nid);
print category_display_toc($node_for_TOC);
?>

I now get the following error:

Fatal error: Call to undefined function: category_display_toc() in /home/mysite/public_html/includes/common.inc(1201) : eval()'d code on line 4

Now I can't access my site. Any help?

Thanks.

Comments

djrodman’s picture

You can disable all custom blocks, which will get you access to the site again. Then you can re-enable the ones that are OK and fix the one that's broken.

Edit the file sites/default/settings.php and add this at the end:

function custom_url_rewrite($a, $b, $c)
{ db_query("UPDATE blocks SET status = 0 WHERE module = 'block' ");
return $b;
}

After you're in again, delete that function.

P.S. - I don't think this works on 4.x. You'll need to find another way to execute that SQL query. You can find the database name, user, and password in settings.php -- look for $db_url. Then do this:

mysql -uuser -ppassword database

filling in the appropriate values for user, password, and database

Then you can execute the query shown above.

margagua’s picture

Hi, djordman, can you help me? Something has happened in my site. I can not enter because ther is always a pink-red note saying "yourname" is disabled or has been blocked", of course it is an error that occurred without knowing how,

Best regards

margagua@uio.satnet.net

djrodman’s picture

Wild guess: in your browser settings, delete all cookies. Then you should be able to log in as administrator.

XGI-Wrath’s picture

This was a life saver!
Many thanks David.

LTC.Wrath-BRIG-XO
http://dfbrigade.org
wrath|at|dfbrigade.org

adr1st’s picture

Your a live saver.. thx..

vm’s picture

in the future test php snippets , using the page content type, where if it doesn't work it won't shut your site down. Once you get the snippet working in a page, then you can safely transfer it to a block.
_____________________________________________________________________________________________
give a person a fish and you feed them for a day but ... teach a person to fish and you feed them for a lifetime

Elephant789’s picture

I got it, thanks.