Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Error while adding tags to discussion
rotaecho
New
Hello, I recently enabled tagging and wasn't able to add tags to the interface. I then tried to use the plugin Tagging Enhanced, but it didn't work as I expected, and reading the comments it was recommended to disable it. Then remove, place the VF core tagging plugin (in my case from 2.1.6) and re-enable.
I did that and I see the tagging option and settings to add new tags. That works fine. When I edit a discussion to add a tag that I've added through the tagging-settings page, I end up with the following error:
{"Code":256,"Exception":"Field 'DateInserted' doesn't have a default value|Gdn_Database|Query|insert GDN_TagDiscussion \n(`TagID`, `DiscussionID`, `CategoryID`) \nvalues (:TagID, :DiscussionID, :CategoryID)","Class":"Gdn_ErrorException"}
Has anyone else seen this or have an idea how to correct it?
0
Comments
run utility structure and always enable plugins via dashboard.
and always disable plugins before changing contents of plugins folder.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@peregrine I found the location for utility: /index.php?p=/utility/structure
I'll give that a shot. Thanks.
To run them
www.yoursite.com/utility/update
www.yoursite.com/utility/structure
or
www.yoursite.com/forum/utility/update
www.yoursite.com/forum/utility/structure
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
@vrijvlinder thank you!
When you run utility/structure do it from the dashboard because if there is something that needs to be fixed it will show you a button to fix the structure of the database.
Run it several times until no errors are found.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
I ran the structure and didn't see any errors with that. I went ahead and recreated a new discussion post and added some tags. Upon saving the post I got the same error:
"Code":256,"Exception":"Field 'DateInserted' doesn't have a default value|Gdn_Database|Query|insert GDN_TagDiscussion \n(
TagID,
DiscussionID,
CategoryID) \nvalues (:TagID, :DiscussionID, :CategoryID)","Class":"Gdn_ErrorException"}
The tag appears on the post later, but always has this error upon new tags on a post.
@vrijvlinder I put the URL complete on the line before getting that message. Where can you find these tools under the dashboard?
It does not matter just be in the dashboard when you run the structure link , then a window will open in the dashboard with the info and the button to press to get the structure fixed.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
@vrijvlinder okay I was originally in the dash when I ran it, so I'll keep that in mind.
I think something got jumbled up with the tagging tables between the two plugins.
I may drop the current tagging tables and reimport clean tables from a new 2.1.6 DB dump. I am not sure how else to fix this issue. I'll hold off a bit in-case someone provides a better solution.
I backed my DB up before doing this:
Disabled tagging plugin
Dropped the tables from the suspected DB that got borked with the tagging plugin fiasco.
Imported new tables from a clean 2.1.6 DB
None of the tags were there in the tables, looked clean. I went ahead and enabled the plugin and went to the settings. I didn't see any values there so added the tag #sample
I went back to a new discussion and created a tag and got this error.
{"Code":256,"Exception":"Duplicate entry '#sample--1' for key 'UX_Tag'|Gdn_Database|Query|insert GDN_Tag \n(
Name,
InsertUserID,
DateInserted,
CountDiscussions) \nvalues (:Name, :InsertUserID, :DateInserted, :CountDiscussions)","Class":"Gdn_ErrorException"}
I'm really at a loss now. I'm not sure why / how it has a duplicate as it was a clean slate.
Okay, correction, it only gives that error with discussions already having hash tags defined and adding new tags to them. New discussions appear fine.
I spoke too soon.
I got the error again.
For shits and giggles. I created a new forum fresh. Enabled only the authentication plugins (FB, Google, Twitter), and the tagging plugin.
I enabled the stock tagging plugin and then added my tags. Some discussions add the tags no problem. However, other newly created discussions provide the following error.
{"Code":256,"Exception":"Duplicate entry '#samplehash--1' for key 'UX_Tag'|Gdn_Database|Query|insert GDN_Tag \n(
Name,
InsertUserID,
DateInserted,
CountDiscussions) \nvalues (:Name, :InsertUserID, :DateInserted, :CountDiscussions)","Class":"Gdn_ErrorException"}
I'm seriously out of ideas at this point.
So doing some research I found something related here:
http://vanillaforums.org/discussion/26678/exception-popup-code-256
I disabled strict mode to the MySQL DB, but didn't seem to resolve my problem.
More hunting
I think part of this relates to the lower-case only with hashtags. As suggested here:
http://vanillaforums.org/discussion/27501/error-after-add-tags-to-a-discussion
However, I'm now back to the error:
{"Code":256,"Exception":"Field 'DateInserted' doesn't have a default value|Gdn_Database|Query|insert GDN_TagDiscussion \n(
TagID,
DiscussionID,
CategoryID) \nvalues (:TagID, :DiscussionID, :CategoryID)","Class":"Gdn_ErrorException"}
Getting closer, least I know not to use caps
Think the DB isn't taking setting properly. Let me dig
Okay, this has been resolved.
I'm using MySQL 5.6 on CentOS 6.5.
Even though I have my own /etc/my.cnf definition it still didn't disable the strict mode, because it was looking at: /usr/my.cnf just comment the line:
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
Then the tagging should function properly.