vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Check profile custom field for unique when registeration (https://vborg.vbsupport.ru/showthread.php?t=312868)

Heaven Knows 07-10-2014 06:04 AM

Check profile custom field for unique when registeration
 
Hi All

I add a custom field called "field5" for user profile and show on registeration form.
I want to force vbb to check if this value is unique on database when click "Complete Registration" just like username , email field checking.

Can anybody help me in this

Thanks alot

kh99 07-10-2014 08:19 AM

Try creating a plugin using hook location register_addmember_process, and do whatever checking you want on $vbulletin->GPC['userfield']['field5']. If it's bad, set an error like this;
Code:

$userdata->error("field5 must be unique");
or whatever message you want of course.

Heaven Knows 07-10-2014 09:14 AM

Quote:

Originally Posted by kh99 (Post 2506201)
Try creating a plugin using hook location register_addmember_process, and do whatever checking you want on $vbulletin->GPC['userfield']['field5']. If it's bad, set an error like this;
Code:

$userdata->error("field5 must be unique");
or whatever message you want of course.

thanks for help, can you show me more details?
im newbie on this

regards

kh99 07-10-2014 09:44 AM

Well, what is field5, is it a number, a string, an email address? If it's a number then checking for '=' might be enough, but if it's some other string then you'd probably want to trim white space and make it all the same case or something like that.

Or did you mean details on creating a plugin? You can look in the manual here: http://www.vbulletin.com/en/manual/ . Select your vb version from the dropdown first, then search for plugin and go to "Adding or Editing a plugin".

Heaven Knows 07-10-2014 11:43 AM

Quote:

Originally Posted by kh99 (Post 2506203)
Well, what is field5, is it a number, a string, an email address? If it's a number then checking for '=' might be enough, but if it's some other string then you'd probably want to trim white space and make it all the same case or something like that.

Or did you mean details on creating a plugin? You can look in the manual here: http://www.vbulletin.com/en/manual/ . Select your vb version from the dropdown first, then search for plugin and go to "Adding or Editing a plugin".

thanks, field5 is a string

i will try with your guide

regards

Max Taxable 07-10-2014 12:53 PM

I recommend against feeding any error or "gotcha" message to the spammer. Let 'em think they got registered okay. Give them the "thanks for registering" message but create no account.

kh99 07-10-2014 02:21 PM

Quote:

Originally Posted by Heaven Knows (Post 2506208)
thanks, field5 is a string

i will try with your guide

regards

I was assuming that you know how to query the database to see if the field is unique, but if not we could help you with that as well.

Heaven Knows 07-13-2014 01:56 PM

Quote:

Originally Posted by kh99 (Post 2506217)
I was assuming that you know how to query the database to see if the field is unique, but if not we could help you with that as well.

in "register" templates i added the following function to test

function checkdisplayname(displayname)
{
if(displayname.value == '')
{
alert('Blank Display Name');
return false;
}
else
{
return true;
}
return false;
}

and inside the function verify_passwords i add the function above to force it check for valid display name when i click the button to finish registering


function verify_passwords(password1, password2)
{
// do various checks, this will save people noticing mistakes on next page

if (!checkdisplayname(cfield_5))
{
return false;
}

...................

.......



I work ok

now i want the function "checkdisplayname" will check for the unique value in mysql database. Can you help me to call the result from an external php or how to query mysql from a template by editting the function above

THanks and regards


All times are GMT. The time now is 06:26 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01162 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete