bwong789 / webtrees-favorites-menu

Webtrees module that presents Favorites as a menu item
GNU General Public License v3.0
5 stars 0 forks source link

Same issue - Cannot add or update a child row: a foreign key constraint fails #3

Closed dax29 closed 2 weeks ago

dax29 commented 1 year ago

Hi I'm getting the same error message after installing your module as Hartenthaler had last week. I downloaded and installed version 1.8 today and this is the error message

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails ("kuilboer"."wt_user_setting", CONSTRAINT "wt_user_setting_ibfk_1" FOREIGN KEY ("user_id") REFERENCES "wt_user" ("user_id")) (SQL: insert into wt_user_setting (user_id, setting_name, setting_value) values (0, favorites-menu-settings, a:2:{s:13:"default_group";s:0:"";s:9:"secondary";a:0:{}})) …/vendor/illuminate/database/Connection.php:712

0 …/vendor/illuminate/database/Connection.php(672): Illuminate\Database\Connection->runQueryCallback()

1 …/vendor/illuminate/database/Connection.php(490): Illuminate\Database\Connection->run()

2 …/vendor/illuminate/database/Connection.php(454): Illuminate\Database\Connection->statement()

3 …/vendor/illuminate/database/Query/Builder.php(2978): Illuminate\Database\Connection->insert()

4 …/modules_v4/favorites-menu/module.php(604): Illuminate\Database\Query\Builder->insert()

5 …/modules_v4/favorites-menu/module.php(253): Fisharebest\Webtrees\Module\AbstractModule@anonymous->getSettings()

kiwi3685 commented 9 months ago

I have the same issue AND I am running webtrees 2.1.18. (You should not close issues without discussion with the originator of the issue IMHO )

This error appears when not logged in, and blocks all access to the site. When logged in, the site works OK, but the Favorites Menu does NOT appear.

bwong789 commented 9 months ago

See if 1.9 fixes the foreign key issue.

Not sure if this addresess the Favorites Menu not appearing. Please provide more details (i.e. URL) on what pages do and do not work.

dax29 commented 9 months ago

Downloaded version 1.9 and it still didn't work. After rereading the installation notes, I noticed that the folder needs to be renamed "favorites-menu ", once I did this it now works. Suggest that renaming the folder to "favorites-menu " is better highlighted in the installation instructions. Cheers Dax

kiwi3685 commented 9 months ago

This issue now fixed for me also.

The closed issue regarding the favorites menu not appearing (on any page), I have found where the issue is. The module only works when the site has "pretty urls" configured. I haven't been using them as I am still setting up my site for webtrees. Now on my development site I have enabled pretty urls and the menu has appeared.

I recommend either change the routing code, or at least make it clear in ReadMe that pretty urls are required.

Thanks for your work though. A handy module.

bwong789 commented 9 months ago

I will see how to handle the default URLs and updating the docs in the next version. Thanks for figuring this out.

bwong789 commented 2 weeks ago

Just added a note to the README.md in 1.10. That should be enough for now.