After updating our website to Drupal 6.9 we decided to use a new theme: Amor Azul. Everything works fine, except the display of 8 user warnings for every new or refreshed page. Better: if template.php is run. This is one of the warnings:
Duplicate entry 'Amor_Azul-block-1' for key 2 query: INSERT INTO blocks (module,delta,theme,status,weight,region,custom,throttle,visibility,pages,title) VALUES ('block', '1', 'Amor_Azul', 1, 0, 'footer_links', 0, 0, 0, '', '') in /home/httpd/vhosts/al-om.nl/httpdocs/sites/all/themes/Amor_Azul/template.php on line 239.
The problem is that template.php tries to insert the blocks content top, header images, header text and footer links into the table blocks and the corresponding boxes into the table boxes. These entries already exist. (I can see them, they were inserted the first time I used Amor Azul as a theme.)
With the litte knowledge I have of php I tried to find out if the function check_block is working. I think it is not: if I copy the SQL-statement to PhpMyAdmin I get the correct result (one row existing), but the function check_block always is true.
I fixed it by changing the >0 to >=0, but I doubt if this is the solution to the underlying problem...
Anyone recognizing this? Any other solutions?
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | New Picture.jpg | 200.98 KB | edegids |
Comments
Comment #1
info@zrix.com commentedWe have checked at our end and have found that we are not getting any user warnings. To get to the root of the problem please send us the URL of your website, the admin login details of it. Alternatively you can send us a screenshot of the page.
Comment #2
edegids commentedA screendump of the user warnings on our website www.al-om.nl is attached. However, not all warnings (there are 8 of them) fit on one screendump. I can post a full list, but I don't think that is necessary because they all have the same structure.
I want to describe what we did to test the function check_block, maybe that helps. We changed the function to:
function check_block($bid,$theme)
{
$result = db_query("SELECT * FROM {blocks} WHERE delta = %d and theme = '%s' and module = 'block'", $bid, $theme);
$test = db_result($result);
print("
test $test");
if(db_result($result)>0)
{
return false;
}
else
{
return true;
}
}
The result is
test
block
test
block
test
block
test
block
on the top of the page, so db_result of the SQL-statement is 'block'? Is it possibly the reason for the user warning, that 'block'>0 is not a correct statement?
Comment #3
info@zrix.com commentedThank you for getting back to us with the required information. Kindly replace the following code in template.php file:
with this:
This will fix the problem.
Comment #4
edegids commentedThanx! You were right, it fixed the problem!
May I ask if this was a general issue or specific problem on our website?
Comment #5
info@zrix.com commentedGlad to know your problem got resolved. This is not a specific problem but can be faced by anyone who will try to print in this manner.
Comment #6
edegids commented