custom email validation

euge

New member
We have a series of validator classes, including an Email validator. It is fairly trivial to extend most classes within XenForo, including this one. It would just involve extending the isValid method in that class and adding your own logic to it (which is presumably reading information from your customer database)

Hi,
this is not a pre-sales question anymore so I am not sure if this is the right place to ask but I will try.
I have seen the isValid method and yes, it will be easy to customize it. I also need an additional case in the verifyEmail method of the user class if I want to display a different error message if a non-customer tries to register.
Is it safe (even across upgrades) to edit the User.php file as well?
 
Any edits to files will be overwritten when upgrading.

You should consider creating an add-on to avoid that.

Ok, I'll consider that. But I don't understand what @Chris D meant here then:

Yeah class extensions are preserved across upgrades. The only fully incompatible changes we've ever made were from XF1 to XF2 but that was because XF2 was basically a full rewrite. Something which, I don't feel, is an approach we would look to take again in the future.
 
Class extensions are a tool for add-on developers. I wasn’t particularly clear but my original post was talking about creating an add-on that contains these Class extensions in order for your custom code to run without being wiped out on upgrades.

Editing files will always result in changes being lost because even the upgrade package overwrites all files.

But add-on changes including Class extensions persist across upgrades.

I’ve moved the posts over to dev discussions.
 
Ok, thanks. In fact it sounded strange to me that such file wasn't subject to replacement during upgrades; now everything is clear.

FYI: I guess the reason is that you moved the post (and therefore this is a new post) but I haven't received any notification for your reply (no email, no alert), which was an unexpected behaviour.
 
Top Bottom