FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » Open Forum To One Country Only
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Open Forum To One Country Only [message #182085] Sat, 05 October 2013 16:15 Go to next message
Blogeezer is currently offline  Blogeezer   Canada
Messages: 16
Registered: October 2013
Karma: 0
Junior Member
Hi, I wish to have my forum available to people from my country only. The forum is specific to my country dealing with everything from politics to eco systems to government issues, and input from people in other countries would not work, for obvious reasons.
Is there any way to accomplish this?
Thank you for any assistance anyone can offer.
Re: Open Forum To One Country Only [message #182186 is a reply to message #182085] Sat, 05 October 2013 17:22 Go to previous messageGo to next message
naudefj is currently offline  naudefj   
Messages: 3772
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Do you want to prevent users from other countries from registering, posting or viewing the forum?
Re: Open Forum To One Country Only [message #183059 is a reply to message #182186] Sun, 06 October 2013 05:03 Go to previous messageGo to next message
Blogeezer is currently offline  Blogeezer   Canada
Messages: 16
Registered: October 2013
Karma: 0
Junior Member
From registering.
Re: Open Forum To One Country Only [message #183060 is a reply to message #183059] Sun, 06 October 2013 06:57 Go to previous messageGo to next message
naudefj is currently offline  naudefj   
Messages: 3772
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
OK, one possible solution is to upload/ activate a plugin like this:
<?php
plugin_add_hook('PRE_REGISTER', 'plugin_canada');
function plugin_canada($uent) {
	if (file_get_contents('http://ipinfo.io/'. get_ip() .'/country') !== 'CA') {
		die('<h2>Sorry, we only allow registratiosns from users in Canada!</h2>');
	}
	return $uent;
}
Re: Open Forum To One Country Only [message #183061 is a reply to message #183060] Sun, 06 October 2013 12:29 Go to previous messageGo to next message
Blogeezer is currently offline  Blogeezer   Canada
Messages: 16
Registered: October 2013
Karma: 0
Junior Member
Thank you so much, will give it a try and let you know.
Re: Open Forum To One Country Only [message #183063 is a reply to message #183060] Sun, 06 October 2013 18:43 Go to previous messageGo to next message
Blogeezer is currently offline  Blogeezer   Canada
Messages: 16
Registered: October 2013
Karma: 0
Junior Member
Ok, I enabled plugins, but of the 25 that popped up nothing comes remotely close to having anything to do with this. Can this code you have written out be embedded in one of the script pages somewhere to serve the same purpose? This is all new to me, so am I just missing something with the plugins?
Re: Open Forum To One Country Only [message #183064 is a reply to message #183063] Sun, 06 October 2013 18:46 Go to previous messageGo to next message
naudefj is currently offline  naudefj   
Messages: 3772
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Put the code in a file called 'canada.plugin' and upload it to your forum's plugin directory.
After that, you should see it in the list of plugins you can enable.
Re: Open Forum To One Country Only [message #183068 is a reply to message #183064] Mon, 07 October 2013 03:48 Go to previous messageGo to next message
Blogeezer is currently offline  Blogeezer   Canada
Messages: 16
Registered: October 2013
Karma: 0
Junior Member
Once again thank you so much, the plugin worked. I had to laugh though when I tried to set up a new registration on one of my other email addresses, it told me Registration was for Canada only! It would not allow me to register. That's great, just what I wanted to happen, was it not for the fact I live in Canada. So it is not accepting my IP address which is wholly Canadian. Go figure. I'll try and play around with it, there must be something amiss here, maybe some minor tweak to the code is necessary. Heck, I was just happy to see the whole plugin process work. Even if I cannot get it to work, thanks again for your assistance.
Re: Open Forum To One Country Only [message #183075 is a reply to message #183068] Mon, 07 October 2013 09:05 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3772
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Are you running FUDforum on your PC?
If so, you are probably using IP 127.0.0.1, which isn't in any particular country.
Re: Open Forum To One Country Only [message #183078 is a reply to message #183075] Mon, 07 October 2013 10:55 Go to previous messageGo to next message
Blogeezer is currently offline  Blogeezer   Canada
Messages: 16
Registered: October 2013
Karma: 0
Junior Member
As a matter of fact I am. Thanks for clearing that up. I will get others to register and see how it works on their computers.
Thanks.
Re: Open Forum To One Country Only [message #183387 is a reply to message #183078] Mon, 21 October 2013 20:10 Go to previous messageGo to next message
Blogeezer is currently offline  Blogeezer   Canada
Messages: 16
Registered: October 2013
Karma: 0
Junior Member
Sorry for not getting back sooner. I must change my last reply that "no, I am not running fud on my computer." And secondly, I have now had a number of people on different computers try and register, all in Canada by the way, with the same message returned that the registration is only available to Canadians.
So while the idea worked and is a good one, it is not allowing Canadians to register. Any further suggestions?
Re: Open Forum To One Country Only [message #183388 is a reply to message #183387] Mon, 21 October 2013 20:43 Go to previous messageGo to next message
naudefj is currently offline  naudefj   
Messages: 3772
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Is it working for some, but not for others?
Can some Canadians have American IP addresses, for example?
If so, it may explain what's going on.
Re: Open Forum To One Country Only [message #183391 is a reply to message #183078] Tue, 22 October 2013 03:06 Go to previous message
Blogeezer is currently offline  Blogeezer   Canada
Messages: 16
Registered: October 2013
Karma: 0
Junior Member
Four different people from two different provinces tried and all were rejected.

[Updated on: Tue, 22 October 2013 03:09]

Report message to a moderator

  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How do I change the register page contents
Next Topic: Moderator for all forums?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Dec 19 14:02:24 GMT 2024

Total time taken to generate the page: 0.02474 seconds