MySQL error message (Website membership add on)

10 posts by 2 authors in: Forums > CMS Builder
Last Post: August 22, 2018   (RSS)

By CommonSenseDesign - August 10, 2018 - edited: August 10, 2018

Hi, there.

I'm revisiting a client's site that was built several years ago so I can make some changes. We're using the Website Membership add on (v1.07) with an older version of CMSB (v2.15). It was working fine before, but we're getting an error message when we try to add a new user to the system:

MySQL Error: Data truncated for column 'longitude' at row 1

Everything else about CMSB and the add on work fine. The only problem is with new members.

Anyone know what's causing this, please? Is it due to the software being older versions?

By daniel - August 10, 2018

Hello,

It sounds like this may be related to the Geocoding plugin.

Does the User Accounts table in the Section Editor have a "longitude" field? If yes, what is its Field Type and Column Type? (Column type is the unlabeled column to the left of the Action column. It should have values like "int(10) unsigned" and "mediumtext")

Thanks,

Daniel
Technical Lead
interactivetools.com

By CommonSenseDesign - August 10, 2018 - edited: August 10, 2018

Hi, Daniel.

When I go to "Edit section" for the User Accounts, there is a longitude field. However, it isn't used for collecting information about users when we set up their accounts. I've attached a screenshot of the columns we're using.

One other thing I've noticed. There are already some user accounts that were created a while ago. If I change the password for one of them to something else, the username and new password don't work and the user can't log in. Is that connected to this problem?

Attachments:

cmsb.jpg 153K

cmsb2.jpg 210K

By daniel - August 14, 2018

Hello,

The Geocoder plugin will automatically attempt to fill the latitude/longitude values when a record is saved in a table where they exist. If those fields are not being used by the user accounts at all, it should be safe to simply remove them to stop the error (after backing up the database, just in case). If those fields are necessary for some site function, then my next recommendation would be to check the required CMSB version for all active plugins - especially any that have been installed or updated more recently - to see if there is a compatibility issue, as well as checking the Developer Log (under Admin Menu) for any additional errors that appear when creating a new user.

It's unclear if the new password issue you mention is related or not. The best way to find out will be to solve the first error and then see if the second still persists.

Let me know if I can help any further.

Thanks,

Daniel
Technical Lead
interactivetools.com

By CommonSenseDesign - August 19, 2018 - edited: August 20, 2018

Hi, Daniel.

That seems to have worked, thank you. However, when I login, there's an error message that appears at the top of the page:

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/globalmedelite/web/htdocs/cmsAdmin/lib/login_functions.php on line 153

This also appears on all the pages when the user has logged in to see the members-only pages.

Is there a way to stop that showing, please? Everything else seems to be working fine.

EDIT: We're using version 2.15 of the CMS (which was launched May 2012) and version 1.07 of the website membership add-on (launched January 2012), so it might be that an upgrade is in order.

Attachments:

login_functions.php 20K

screen.jpg 230K

By daniel - August 20, 2018

Hello,

I can see that there's some custom code in your login_functions.php file which is the source of both this and the previous error. At first glance, it looks like it tries to save the account's location based on its address, and prevent logins to that account if the user isn't close enough geographically.

Upgrading is one way to get rid of this error, as it would simply overwrite the custom code. Another simple option would be to modify lines 247-248 in that file from:

$isValidLocation=LocationCheck ();
$isValidLogin=$user&&$isValidPassword&&$isValidLocation;

To:

//$isValidLocation=LocationCheck ();
$isValidLogin=$user&&$isValidPassword;//&&$isValidLocation;

This would disable the custom code without removing it entirely.

If instead, you'd like to try to salvage this functionality, it would require a more hands-on look to determine what caused it to stop working in the first place.

Let me know if you have any more questions.

Thanks!

Daniel
Technical Lead
interactivetools.com

Hi, Daniel.

My client has noticed another issue with the membership login page.

Is there a way of making sure the login fields aren't already populated with info when the user visits the login page? i.e. a way to set up the page so that the browser cache is cleared each time the user leaves and revisits the page? (See attachment 01-login.jpg)

http://www.globalmedelite.com/

Thanks!

Attachments:

01-login.jpg 50K

index0.php 6K

By daniel - August 21, 2018 - edited: August 21, 2018

Hello,

From the screenshot, it looks like your client has a browser plugin (LastPass) that is auto-filling the login info. I wouldn't recommend trying to override browser plugin behavior. The login page itself does not store/load any login details to/from the cache.

Thanks,

Daniel
Technical Lead
interactivetools.com

Thank you, Daniel.