Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-07-2004, 09:38 PM
MegaHertz MegaHertz is offline
 
Join Date: Mar 2003
Location: U.S.A.
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Limiting registration to users of one email domain.

I am getting ready to setup a forum and want to know if it is possible to allow users to register only if their email address is from a certain domain.

In other words I would like to exclude all domains, but the ones I specify. This would be the exact opposite of the way it is now.

I am just unsure of how to accomplish it. Any help or guidance would be greatly appreciated.
Reply With Quote
  #2  
Old 04-09-2004, 04:01 PM
Hurricane Hurricane is offline
 
Join Date: Feb 2002
Location: Central Florida
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am looking into this for you.
Reply With Quote
  #3  
Old 04-09-2004, 08:03 PM
MegaHertz MegaHertz is offline
 
Join Date: Mar 2003
Location: U.S.A.
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Hurricane. I appreciate your help.
Reply With Quote
  #4  
Old 04-10-2004, 05:04 AM
Hurricane Hurricane is offline
 
Join Date: Feb 2002
Location: Central Florida
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I looked into doing this as a full blown hack, however, I do not think it will be worth going through the trouble. I do not think many people have the need for this. So I will come up with something for you that is quick and dirty.
Reply With Quote
  #5  
Old 04-10-2004, 05:23 AM
Hurricane Hurricane is offline
 
Join Date: Feb 2002
Location: Central Florida
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MegaHertz
I am getting ready to setup a forum and want to know if it is possible to allow users to register only if their email address is from a certain domain.

In other words I would like to exclude all domains, but the ones I specify. This would be the exact opposite of the way it is now.

I am just unsure of how to accomplish it. Any help or guidance would be greatly appreciated.

OK, here it is quick and dirty:

In your Admin Panel Options there is an area for email banning. (Which is the opposite of what you want as stated above.) What I have done is to allow you to reverse that function to only allow those who are listed.

Here you go:

Code:
Open includes/functions_user.php

Find This (Around Line 436)

// ###################### Start checkbannedemail #######################
function is_banned_email($email)
{
	global $vboptions, $datastore;

	if ($vboptions['enablebanning'] AND !empty($datastore['banemail']))
	{
		$bannedemails = preg_split('/\s+/', $datastore['banemail'], -1, PREG_SPLIT_NO_EMPTY);

		foreach ($bannedemails AS $bannedemail)
		{
			if (is_valid_email($bannedemail))
			{
				$regex = '^' . preg_quote($bannedemail, '#') . '$';
			}
			else
			{
				$regex = preg_quote($bannedemail, '#');
			}

			if (preg_match("#$regex#i", $email))
			{
				return 1;
			}
		}
	}

	return 0;
}



REPLACE WITH:


// ###################### Start checkbannedemail #######################
function is_banned_email($email)
{
	global $vboptions, $datastore;

	if ($vboptions['enablebanning'] AND !empty($datastore['banemail']))
	{
		$bannedemails = preg_split('/\s+/', $datastore['banemail'], -1, PREG_SPLIT_NO_EMPTY);

		foreach ($bannedemails AS $bannedemail)
		{
			if (is_valid_email($bannedemail))
			{
				$regex = '^' . preg_quote($bannedemail, '#') . '$';
			}
			else
			{
				$regex = preg_quote($bannedemail, '#');
			}

			if (preg_match("#$regex#i", $email))
			{
				return 0;
			}
		}
	}

	return 1;
}

Code:
What this has done is to switch the "return 0" and "return 1"
If you have any trouble with the above code let me know.

BTW: I did fully test this and it worked on my test BB.
Reply With Quote
  #6  
Old 04-11-2004, 03:57 PM
MegaHertz MegaHertz is offline
 
Join Date: Mar 2003
Location: U.S.A.
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wow! Thanks-A-Million Hurricane I will test this out ASAP and let you know how it goes.
Reply With Quote
  #7  
Old 04-18-2004, 03:58 PM
MegaHertz MegaHertz is offline
 
Join Date: Mar 2003
Location: U.S.A.
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just wanted to get back to you and let you know that this seems to be working perfectly. Thanks again for helping me out.
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 05:11 PM.


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.03825 seconds
  • Memory Usage 2,221KB
  • 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
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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