Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Obrieden on December 07, 2017, 01:38:07 PM

Title: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Obrieden on December 07, 2017, 01:38:07 PM
I'm not sure how it happened, but somewhere along the way my forum was update with 2.0.13 after which people could not post to old topics or add new one. Kept getting message that I needed to run Update.php which I did not have.

Among other things I tried updating to 2.0.15 and although people can see the boards, not one can post and when they try they get the following message:

Field 'edit_reason' doesn't have a default value
File: /home/frayed6/public_html/eq/boards/Sources/Subs-Post.php
Line: 1817

Please help, we're pretty much dead in the water.

Thanks,
Otis
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Colin on December 07, 2017, 01:40:54 PM
Were there errors during the update?

What mods do you have installed?
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Obrieden on December 07, 2017, 01:47:30 PM
The errors occurred after the updates, the last one being what I posted previously.

The installed mods are:

smf 2.0.13 update, bot buster, better smf parser, and smf 2.0.12
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Illori on December 07, 2017, 01:48:15 PM
did you have a reason for edit mod installed at some point in the past?
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Obrieden on December 07, 2017, 01:49:36 PM
I don't know what edit mod is
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Sir Osis of Liver on December 07, 2017, 03:39:50 PM
Do I understand correctly that this problem appeared when you upgraded to 2.0.13, and you've since upgraded to 2.0.15 and still have same problem?  Did you install all of the upgrades with package manager?

Illori is referring to this mod - https://custom.simplemachines.org/mods/index.php?mod=349
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Gwenwyfar on December 07, 2017, 03:47:30 PM
Did you have the update to 2.0.14 before you installed 2.0.15?
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Sir Osis of Liver on December 07, 2017, 03:52:24 PM
Don't think you can install patches out of order using package manager.  If full upgrade package was used, doesn't matter if it was uploaded over .13 or .14, there were no changes to database.
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Obrieden on December 07, 2017, 04:04:14 PM
I installed 2.0.15 without installing 2.0.14. I installed it via PHP, not with the package installer. Yes, the problem started after installing 2.0.13 which installed over 2.0.11 without 2.0.12 and it installed with the package installer. I did not install edit mod.
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Sir Osis of Liver on December 07, 2017, 04:32:18 PM
The field edit_reason is not in core code, it's added by the 'Reason For Editing Mod' mod.  Appears you had the mod installed prior to upgrading .11 -> .13.  Uploading the upgrade package would have removed the mod, but some code would remain if you're using a theme other than Curve.  The mod adds edit_reason to Subs-Post.php, which would have been overwritten with clean file, and a couple of templates, which are not overwritten in custom theme. 

Your theme should have a Display.template.php, look for this -

Code: [Select]

&#171; <em>', $txt['last_edit'], ': ', $message['modified']['time'], ' ', $txt['by'], ' ', $message['modified']['name'], !empty($message['modified']['edit_reason']) ? ', '.$txt['reason'].': ' . $message['modified']['edit_reason'] : '' , '  </em> &#187;';


change to this -

Code: [Select]

&#171; <em>', $txt['last_edit'], ': ', $message['modified']['time'], ' ', $txt['by'], ' ', $message['modified']['name'], '</em> &#187;';



If your theme also has a Post.template.php, find this -

Code: [Select]

// Reason for Editing Mod
if ((!$context['is_new_post']) && (allowedTo('reason_edit')))
echo '
<div class="padding smalltext">
<strong>'.$txt['reason_edit'].':</strong>
<input type="text" name="edit_reason" size="50" value="" />
</div>';

// If this message has been edited in the past - display when it was.
if (isset($context['last_modified']))
echo '
<div class="padding smalltext">
<strong>', $txt['last_edit'], ':</strong>
', $context['last_modified'], '
</div>';


change to this -

Code: [Select]

// If this message has been edited in the past - display when it was.
if (isset($context['last_modified']))
echo '
<div class="padding smalltext">
<strong>', $txt['last_edit'], ':</strong>
', $context['last_modified'], '
</div>';


Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Illori on December 07, 2017, 04:39:07 PM
the error is because there is no default value for the column in the database, the column needs a default value added or to drop that column from the database
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Sir Osis of Liver on December 07, 2017, 04:41:24 PM
How about reinstalling/uninstalling the mod, would that remove the column?  May be safer than sending OP into database.
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Illori on December 07, 2017, 04:45:17 PM
that depends on the mod, not all offer the abliity to remove the database changes.
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Kindred on December 07, 2017, 06:33:18 PM
also, the default value error is specific to certain versions of mySQL...  get your host to update mySQL and the issue should be resolved as well.


However, by using the upgrade zip instead of the patch through package manager, you now need to reinstall all of your mods - not reinstalling some mods will put your system in a weird state, especially for mods that have some hooks and some code changes
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Obrieden on December 07, 2017, 06:41:39 PM
I found a Display.template.php in "Core" and in Default" with the statement as follows:

&#38;#38;#38;#38;#38;#171; <em>', $txt['last_edit'], ': ', $message['modified']['time'], ' ', $txt['by'], ' ', $message['modified']['name'], '</em> &#38;#38;#38;#38;#38;#187;';

but nothing that looks like

&#38;#38;#38;#38;#38;#171; <em>', $txt['last_edit'], ': ', $message['modified']['time'], ' ', $txt['by'], ' ', $message['modified']['name'], !empty($message['modified']['edit_reason']) ? ', '.$txt['reason'].': ' . $message['modified']['edit_reason'] : '' , '  </em> &#38;#38;#38;#38;#38;#187;';

And there is no Post.Template.php
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Obrieden on December 07, 2017, 06:50:23 PM
It appears that updating the version of php to 7.0 has fixed the problem. Thank you very much for your time.

Otis
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Obrieden on December 07, 2017, 07:18:58 PM
well, my jubilation was a bit premature. The post problem was fixed by changing the phop version, but we are still having a problem with administrators having to log in even though they are logged in to view and perform administrator things.
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Kindred on December 07, 2017, 08:41:10 PM
You do know that it is normal to have a password check when an admin goes into the admin section?
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Obrieden on December 08, 2017, 01:39:47 PM
It never has before.
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Arantor on December 08, 2017, 02:31:28 PM
The double login has been a feature of SMF for well over a decade. You can change it by going to admin, and using the admin search for "admin security"
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Sir Osis of Liver on December 08, 2017, 09:09:10 PM
Admin -> Security and Moderation -> Disable administration security
Title: Re: Unable to Post, have to Log in Every time to do Admin after installing 2.0.15
Post by: Kindred on December 09, 2017, 09:29:28 PM
Although that is, IMO, a poor choice and potentially insecure if you ever use a computer that is not your own personal computer