latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Conditional field validation with DB

Home Forums Community Forum Unofficial Extensions/Hacks Conditional field validation with DB

This topic contains 9 replies, has 2 voices. Last updated by  Cristián Lávaque 3 years, 3 months ago.

Topic Author Topic
Posted: Tuesday Sep 24th, 2013 at 3:09 pm #59815
Palmtop
Username: palmtop

Hello,

I need to allow user registration only if during registration itself the user will insert a correct serial number (already stored into a db table).

Is it possible to do it using S2Member please?

If yes, how to do it, please?

If some custom code is needed, as I thought, which files should be edited?

Is there a way to use hooks so that the original code will not be affected by editing?

Of course I am interested in the paid version.

Thanks in advance!

List Of Topic Replies

Viewing 9 replies - 1 through 9 (of 9 total)
Author Replies
Author Replies
Posted: Wednesday Sep 25th, 2013 at 6:25 am #59849

Yeah, this would require some customization.

The s2Member Pro form templates can be customized to add something like this, I guess. See: http://www.s2member.com/kb/pro-forms/#customizing-pro-forms

If you want to do it with the default WP registration, try googling how to customize it with hooks. I’m not familiar with editing that particular area to give much advice.

I hope that helps. :)

Posted: Wednesday Sep 25th, 2013 at 7:10 am #59856
Palmtop
Username: palmtop

Thanks Cristian, for your kind reply.

Just to clarify my needs a little better than what I already wrote in my previous post:

I don’t need my users to pay or to checkout or to buy something; I only need them to validate their product’s warranties on my website in an automatic way (validating the serial numbers of the products they already bought) and then let they access the private areas on my website.

So, when a customer start registration, he will have a serial number field to fill.

He will insert the serial number of his product.

My website will check this serial number polling a DB of valid serial numbers.

If the serial number will be found and considered valid, then the registration form will be completed and the user will access the private areas.

Instead, if the serial number will not be found, then the registration process will fail and the user will not be entitled to access these private areas.

Do you think that I can create this schema using S2member, please?

Thanks for your help!

Posted: Wednesday Sep 25th, 2013 at 7:16 am #59858

Well, you can have a customization that lets the user enter his serial and you validate it and if it’s fine, then change his WP role to one of the s2Member level ones, or give him an s2Member custom capability. See: Knowledge Base » Changing Roles/Capabilities via PHP

Once he has an s2Member level, or ccap, he’ll have access to the content you protected with those.

I hope that helps. :)

Posted: Wednesday Sep 25th, 2013 at 7:17 am #59859
Palmtop
Username: palmtop

Great! I will have a look to it!

Thanks

Posted: Wednesday Sep 25th, 2013 at 7:20 am #59861

No problem. :)

Posted: Wednesday Sep 25th, 2013 at 7:22 am #59862
Palmtop
Username: palmtop

Hi Cristian,

Yes, this can be the solution.

Do you know which files should I edit to add the php/mysql verification code, please?

Thanks one more time!

Posted: Wednesday Sep 25th, 2013 at 7:28 am #59865

That’ll depend on your customization, I’m afraid that’s beyond what I can help you with here.

But remember you can use must-use plugins with hooks (maybe wp_loaded), or you can use PHP in a WP post/page if you have a PHP execution plugin to allow it.

Knowledge Base » Hacking s2Member® Via Hooks/Filters
Knowledge Base » ezPHP Plugin for WordPress®

I hope that helps. :)

Posted: Wednesday Sep 25th, 2013 at 7:31 am #59866
Palmtop
Username: palmtop

Thanks! Now I have all needed elements to try!

Posted: Wednesday Sep 25th, 2013 at 7:36 am #59868

:)

Viewing 9 replies - 1 through 9 (of 9 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.