Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-14-2012, 11:26 AM
jaffa123 jaffa123 is offline
 
Join Date: Dec 2012
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Check registered email against values in another database

Hello All

I would like to have a condition when people are registering for my forum. It is for an educational institue and all forum users must be registered students. The students are required to sign up on a wordpress site, to access the fourms they must also register on the forum BUT I need to be able to check the email that is being used on the forum exists in the student site.

Sounds so complicated, I have no idea where to start!

Any advice would be greatly appreciated, is this scenario even possible?

Thank you
Reply With Quote
  #2  
Old 12-14-2012, 01:32 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can create a new plugin using hook register_addmember_process. This will be called whne the registration form is submitted, and the email address that the user entered will be in $vbulletin->GPC['email']. If it's a bad email address you can set it to show an error message and go back to the registration page. However, I can't tell you how you'd go about checking the email address unless you have more details about that.

To set the error message you'd create an error phrase (using the Phrase Manager in the adminCP), then you'd use the phrase varname in a call to $userdata->error().
Reply With Quote
  #3  
Old 12-14-2012, 03:38 PM
jaffa123 jaffa123 is offline
 
Join Date: Dec 2012
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks kh99, vBulletin seems complicated!

Could you define a 'bad email address' as one that doesn't exist in database A therefore cannot be added to database B?

In answer to your last question, the problem here is that not all email addresses will be from the same domain. A user could have registered on the wordpress site using an email.

Thank you for your reply, I can't figure this out though. Need to think it through again.

Reply With Quote
  #4  
Old 12-14-2012, 03:55 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's actually not that difficult, at least the vb part. Like I said, create a plugin using hook location register_addmember_process (just go to Plugins & Products > Add New Product). For the code, it would be something like:

Code:
if ( /* check if $vbulletin->GPC['email'] is not in other database */)
{
    $userdata->error('email_not_in_other_database');
}

Then you'd need to go to Languages & Phrases > Phrase Manager and press the "Add New Phrase" button at the bottom. Choose Phrase Type "Error Messages" and enter varname email_not_in_other_database, and put in whatever message you want.

But like I mentioned before, I don't know how to tell you to do the " check if $vbulletin->GPC['email'] is not in other database" without more info. If you know how to do that part, then you're there.
Reply With Quote
  #5  
Old 12-14-2012, 10:38 PM
jaffa123 jaffa123 is offline
 
Join Date: Dec 2012
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
It's actually not that difficult, at least the vb part. Like I said, create a plugin using hook location register_addmember_process (just go to Plugins & Products > Add New Product). For the code, it would be something like:

Code:
if ( /* check if $vbulletin->GPC['email'] is not in other database */)
{
    $userdata->error('email_not_in_other_database');
}

Then you'd need to go to Languages & Phrases > Phrase Manager and press the "Add New Phrase" button at the bottom. Choose Phrase Type "Error Messages" and enter varname email_not_in_other_database, and put in whatever message you want.

But like I mentioned before, I don't know how to tell you to do the " check if $vbulletin->GPC['email'] is not in other database" without more info. If you know how to do that part, then you're there.
Thanks again for offering so much help. I wish I could say I know how to do this but I really don't.

What further info would be helpful? I understand I am asking a lot here, I'm just so lost and without this function I'm doomed.

The emails are stored in another database, a wordpress database and they're a range of hotmail, gmail, yahoo etc.

I'll keep researching as well, if I could just get past this hurdle I'd be so happy!
Reply With Quote
  #6  
Old 12-14-2012, 10:46 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If it's in another database, then you'd need to know where (like the table name and the field name in the table). Then you'd need to have the information to connect to that database (similar to what you put in the config.php for vbulletin. Wordpress must have something similar). From that point, the php code to do a query on the database is probably available in a lot of places on the net.

Another option might be to find a wordpress development site and see if someone there can tell you how to find out if an email address is in the database.

But to be honest, it kind of sounds like you might want to consider the option of paying someone to do it, unless the above sounds like something you're insterested in learning, and you have the time.
Reply With Quote
  #7  
Old 12-14-2012, 10:53 PM
jaffa123 jaffa123 is offline
 
Join Date: Dec 2012
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
If it's in another database, then you'd need to know where (like the table name and the field name in the table). Then you'd need to have the information to connect to that database (similar to what you put in the config.php for vbulletin. Wordpress must have something similar). From that point, the php code to do a query on the database is probably available in a lot of places on the net.

Another option might be to find a wordpress development site and see if someone there can tell you how to find out if an email address is in the database.

But to be honest, it kind of sounds like you might want to consider the option of paying someone to do it, unless the above sounds like something you're insterested in learning, and you have the time.
I have all those details relating to the database. I will try to learn and work with the info you have supplied.

One last question, would I place all this inside the vBulletin plugin section?

You have been great, thank you!
Reply With Quote
  #8  
Old 12-15-2012, 01:16 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, the code would go in the plugin. Of course if you want, your plugin can include a file. So if you don't want to work in the vb plugin editor you can just put an include or require statement in there and use an editor to edit a file.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:50 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07792 seconds
  • Memory Usage 2,235KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete