Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Showing Registration Page to Only...
Showing Registration Page to Only Specific Country Users
Showing Registration Page to Only Specific Country Users
Hello,
I am using the latest Joomla 1.5.14 and metamod 2.2.
I was wondering if I can show the registration page only to specific countries say Malaysia , Singapore and exclude the rest of the other countries. I thought this is a nice way to reject spam posters from other countries since this is a local site.
So is there a way I can show the registration page and redirect the rest back to the Home Page.
This is what I got from the debug for the page where I want this working. I didn't know how to replace it for a Page I could do it for a module(not showing for specific countries) but how to not show a page ?
It would be a great help. Thank You.
if (
$option == 'com_alpharegistration'
and $view == 'register'
and JRequest::getVar('post') == '' /*!*/
and JRequest::getVar('task') == 'register'
and JRequest::getVar('lang') == 'en'
) return XXX; /* replace XXX with the module ID or position to display */
Re: Showing Registration Page to Only Specific Country Users
Hi Coolsage,
Thanks for including the advanced debug output - that really helps
We'll trim that down a bit and use it to redirect from there back to the home page if the user is not from particular countries. Make sure you have the GeoIP database installed, and enabled in MetaMod.
Code:
if ($option == 'com_alpharegistration'
and $view == 'register'
and JRequest::getVar('task') == 'register'
and ( $fromCountryId == 'MY' or $fromCountryId == 'SG' ) ) {
$app = &JFactory::getApplication();
$app->redirect("http://www.mysite.com/");
}
Cheers,
Stephen
Re: Showing Registration Page to Only Specific Country Users
Hi Stephen,
Thanks for the reply. It works, Great. But what I really wanted was the other way round.
1. www.mysite.com/registration.html (Here I want only countries MY and SG to have access)
2. The rest of the countries get redirected to home page www.mysite.com/ (in other words they cant register because the form doesn't turn up)
What you gave is working reverse. If I put MY and SG then users from these 2 countries will not able to access the registration page and the rest of the countries can.
Though I am using it by putting the countries from where I don't want registrations from. The list is pretty huge . Is there a work around ? I also didn't fill the parameters
Only these Countries and Exclude these Countries, since it wasn't working when I filled them.
Trust me this by far this will be the best way to beat spam registrations originating from certain countries. You've created a great module.
Re: Showing Registration Page to Only Specific Country Users
D'Oh! You're right, sorry I got that around the wrong way.
In fact you have now reminded me of the include- and exclude-countries boxes - they should make things even easier.
So just put "SG,MY" into the EXCLUDE country box, and use the following rule:
Code:
if ($option == 'com_alpharegistration'
and $view == 'register'
and JRequest::getVar('task') == 'register'
) {
$app = &JFactory::getApplication();
$app->redirect("http://www.mysite.com/");
}
If for any reason the exclude countries box is not working, please let me know! If you want to bypass the exclude countries box entirely, you could re-write the rule like this:
Code:
if ($option == 'com_alpharegistration'
and $view == 'register'
and JRequest::getVar('task') == 'register'
and ! ($fromCountryId == 'MY' or $fromCountryId == 'SG')
) {
$app = &JFactory::getApplication();
$app->redirect("http://www.mysite.com/");
}
Hope that works this time!
Hey another thing you should do is to only display the "join now" module to people in SG and MY as well. Just wrap it in a MetaMod, put "SG,MY" in the "include countries" box, and the module id for the "join now" module into the "quick module id include" box.
Cheers,
Stephen
- Index
- » MetaMod
- » MetaMod General Support
- » Showing Registration Page to Only...
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5944
- Posts this week:
- 2
- User Info:
- Total Users:
- 7660
- Newest User:
- marino9885
- Members Online:
- 0
- Guests Online:
- 173
- Online:
- There are no members online
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked