Forum

Thread tagged as: Members

Adding a field which must be Unique to members registration form

Hi

Is it possible to add a field which must be unique in a similar way that the email you enter must be unique to any that have been used for people to register previously.

Thanks

Neil

Neil Irwin

Neil Irwin 1 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

There's nothing built in to do that, but it could be done with a validation helper if you have the PHP chops.

Ah right I had the validation helper dropped in which does flag up the same content being used but I got an error at the top of the page because the method doesnt exist.

Warning: call_user_func() expects parameter 1 to be a valid callback, class 'PerchMembers_Members' does not have a method 'check_gui' in /home/bgctest/public_html/admin/core/lib/api/PerchAPI_SubmittedForm.class.php on line 272

Is there somewhere I should add this in?

Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to create the validation helper. The format is ClassName::static_method_name

The method gets passed an argument which is the value of the field. It needs to return true or false once you've established if the value is acceptable.

I have the validation helper added helper="PerchMembers_Members::check_gui"

Which is when I get the warning saying about the method not existing. Where should I add that in? Is there a way to do it without touching the core files?

Drew McLellan

Drew McLellan 2638 points
Perch Support

You can't add methods to our class. You need to create your own class.