YAFLogo

smlemmon
  • smlemmon
  • 56% (Neutral)
  • YAF Camper Topic Starter
13 years ago
Hi,

I had a problem registering a new user on my forum yesterday.

It is a new forum, and this is only my 4th user that I am adding.

At the moment, I am registering users using the control panel rather than allowing users to register themselves.

Anyway, the user has quite a long email address, actually 52 characters.

This causes YAF.NET to throw an error when calling the yaf_user_save stored procedure as the email address is too long for the yaf_user table.

The unfortunate side effect is that it also now leaves orphan records in the yaf_prov_membership and yaf_prov_profile tables after the error has occurred, and if I try again to add a user with the same email address (which obviously I now wouldnt knowing what the problem is), it tells me the email address already exists.

Anyway, two queries...

1. Is it possible to increase the size of the yaf_user email address field to say 100. Is there an easy way to do this in the short term as if I try and modify the table in sql server management studio, it tells me that it is going to cause some issues removing links to schemas etc when I resave the new version of the table.

2. Should there be some validation in the application to check the length of the email address, before saving.

Many thanks in advance.

Simon

Sponsor
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
13 years ago

1. Is it possible to increase the size of the yaf_user email address field to say 100. Is there an easy way to do this in the short term as if I try and modify the table in sql server management studio, it tells me that it is going to cause some issues removing links to schemas etc when I resave the new version of the table.

The easiest way is to use the sql files in the install/mssql folder and run the update installer.

- Add this to the tables sql..

if exists(select top 1 1 from dbo.syscolumns where id = object_id(N'[{databaseOwner}].[{objectQualifier}User]') and name=N'Email' and prec<255)
	alter table [{databaseOwner}].[{objectQualifier}User] alter column [Email] nvarchar(255) null
GO

if exists(select top 1 1 from dbo.syscolumns where id = object_id(N'[{databaseOwner}].[{objectQualifier}CheckEmail]') and name=N'Email' and prec<255)
	alter table [{databaseOwner}].[{objectQualifier}CheckEmail] alter column [Email] nvarchar(255) null
GO

and you also need to update all procedures (procedures.sql)

find all values

@Email nvarchar(50)

and replace them with

@Email nvarchar(255)
bbobb
  • bbobb
  • 100% (Exalted)
  • YAF Developer
13 years ago
And even if he makes so he'll surely fail, because of Memebership 🙂
smlemmon
  • smlemmon
  • 56% (Neutral)
  • YAF Camper Topic Starter
13 years ago
Hi,

That's great thanks.

I will give that a try.

Do you think that this will be increased in the future, or will I have to do this for any new forums I create.

Cheers

Simon

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
13 years ago

Hi,

That's great thanks.

I will give that a try.

Do you think that this will be increased in the future, or will I have to do this for any new forums I create.

Cheers

Simon

Originally Posted by: smlemmon 

Yes it will be with YAF 1.9.5.6 it will be increased to 255.