Elxis CMS Forum
Support => General => Topic started by: rentasite on November 23, 2017, 00:36:45
-
Hi. I'm developing a site that will work as locked (Website status: Online for users). I have set "User Registration: Yes" and the "Account activation: Manual by Administrator".
The purpose is the visitor to face the offline page, but to be able to Register for a user account on the site. And the admin to manually approve the registration.
How can this be done? Am i missing something? The offline page just shows the username/password fields. No ability to register.
* I'm using IOSX - Extra pages pack for Elxis Templates
-
This is opposite to the idea of the "Users only" site. However you can do it!
Here are 2 solutions:
1. (the hard solution) Develop a special exit page that will include user registration feature. (I have developed a similar - not as you want- solution for LDAP/Gmail registration on locked sites - See IOSX exit pages (https://www.elxis.net/edc/templates/131.html)
2. (the easy solution) Make your site available to public! Open your template's index.php and set up a redirection to component user for non logged-in users.
if ($elxis->user()->uid == 0) {
if (eFactory::getURI()->getComponent() != 'user') {
$link = $elxis->makeURL('user:register.html', '', true, false);
$elxis->redirect($link);
}
}
Explanation: If visitor is not an Elxis user and he doesn't see component user pages then redirect him to registration page.
Tip: As your site will be opened to visitors (even if they will only see component user) they will be able to see your menus, modules, etc. You can change the access level of these items to users only (level 2 or greater) so visitors will see almost nothing except the registration form.
-
Yes i have seen the LDAP/Gmail registration on locked sites solution.
I will proceed with the 2nd solution.
Thanks :)
-
Getting back to say that the 2nd solution works perfect! :D
Thanks Yianni
-
Good! :)
-
Hi Datahell,
Can I use the code at a specific page? For example, if non-register users visit this page (https://finteku.com/fintek-app/) so they will be redirected to register page.
if ($elxis->user()->uid == 0) {
if (eFactory::getURI()->getComponent() != 'user') {
$link = $elxis->makeURL('user:register.html', '', true, false);
$elxis->redirect($link);
}
}
Thank you
-
Wrap the code I already wrote with a check for the desired category ID.
if (defined('ELXIS_CATID') && (ELXIS_CATID == X)) {
...code here...
}
Replace X with the id of the category you want.
To do it for article use ELXIS_ARTID instead.
-
Hi Datahell,
It works! Anyway, does it work for a component as well? For example: https://finteku.com/topik-baru/ this link is menu to MyContent Component, I want to redirect non-register users who access that page to register page.
Thanks in advance
Regards
Komang
-
Yes, it works for a component too :D
In this case wrap the code with this :
if (eFactory::getURI()->getComponent() == 'X') {
... code here ...
}
Where X lowercase component name without "com_" prefix. In your case mycontent
if (eFactory::getURI()->getComponent() == 'mycontent') {
... code here ...
}
-
Thank you so much Datahell..it works.
You know, I tried to guess the code to do this. On your previous post, you said ELXIS_CATID for category and ELXIS_ARTID for articles, so I tried ELXIS_COMID for components... lol :)
-
It was a good guess but, unfortunately, does not work like this ;D
-
;D
again, thank you Datahell