Advertisement:

Author Topic: Database Error: Field 'join_reason' doesn't have a default value  (Read 507 times)

Offline NFG

  • Semi-Newbie
  • *
  • Posts: 38
It seems like the upgrade to 2.1 may have left some detritus behind.  I suspect I used to have a mod asking for a 'join reason', but I don't know for sure where it's getting this from.  Attempts to register new users result in an error shown to the user, and the following error in the admin log:

Code: [Select]
Database Error: Field 'join_reason' doesn't have a default value
 https://<domain>/forum2/index.php?action=signup2
 /var/www/forum2/Sources/Subs-Members.php (Line 712)

I didn't see any offending code on line 712, so I checked out the database.  Turning off 'not null' on that column solved the problem. 


Offline @rjen

  • Full Member
  • ***
  • Posts: 607
  • Gender: Male
    • FJR-club Nederland
Re: Database Error: Field 'join_reason' doesn't have a default value
« Reply #1 on: June 21, 2019, 02:55:41 AM »
The join reason mod (https://custom.simplemachines.org/mods/index.php?mod=2326) adds that column to the members table but does not adhere to the stricter MySQL rules...

If you are no longer using the mod you can delete the column from the table altogether...

Code: [Select]

$column = array(
'name' => 'join_reason',
'type' => 'tinytext',
);

$smcFunc['db_add_column']('{db_prefix}members', $column);
Running SMF 2.0 with Tinyportal 2.0.0 at www.fjr-club.nl
Testing SMF 2.1 with Tinyportal 2.0.0 at test2.fjr-club.nl

Offline NFG

  • Semi-Newbie
  • *
  • Posts: 38
Re: Database Error: Field 'join_reason' doesn't have a default value
« Reply #2 on: June 21, 2019, 07:07:22 AM »
Thanks @rjen, I deleted that column and nothing exploded.  =)