Khaled Afiouni's plugins:
11
Recommendations
Secures elgg by allowing non-members to only see some pages available for public viewing.
Require logged in user for all pages except for:
For developers: If you would like to add more allowed public view pages, you can register your own hook:
register_plugin_hook('login_required','login_required', 'your_function_name');
Make sure to return an array of page URL's. For more information, I have a working example in the plugin itself made for demonstration purposes.
To allow access to profile pages: Change the following:
if (!in_array(strtolower(trim($current_url)), array_map('strtolower', $allow)))
gatekeeper();
to
if (!in_array(strtolower(trim($current_url)), array_map('strtolower', $allow)) && get_context() !== 'profile' && get_context() !== 'widget')
gatekeeper();
Note: If you do not want the widgets to show any content, you can remove the
&& get_context() !== 'widget'
from the end of this statement. It will allow access to the profile page showing the profile information only.
Require logged in user for all pages except for:
Offers a hook to add more public URL's for developers.
Thank you for this nice plugin. works great on elgg 1.7
I added 2 lines to allow jscript and css after line 36 (on the start.php)
$allow[] = $CONFIG->url . '_css/js.php';
$allow[] = $CONFIG->url . '_css/css.css';
Francis Sitorus 762 days ago
I used it with version 1.7 with site access and seems to be working great. Did not want to enable walled garden on site access due to the trouble having to approve everyone. This is just what the doctor ordered. Thanks. You get another recommendation.
Fred Phillips 713 days ago
Hello. It will be much attractive when user get system message: "You must be logged in to view that page." How can I enable something like this?
David Stawowy 702 days ago
There's a problem if both this plugin and izap_videos (latest release) are being used in Elgg 1.7.1 together. The conversion jobs of uploaded videos won't finish completely in izap_videos. The problem might be caused due to the notification message that izap_videos sends after the conversion getting blocked by "Log in required". But I'm not sure if the notification message is the reason for the problem or if some other tasks that izap_videos tries to do is blocked by "Log in required" and the missing notification message is just another consequence of that.
Other plugins don't seem to have problems with sending notification messages if "Log in required" is used. I'm not sure if the solution of this issue involves adjustments in "Log in required" or in izap_videos. Has anyone else made similar observations? Any advice how to use both plugins together?
iionly 699 days ago
Found a nice (very big) bug! When a user does a password reset on my site, the email sent to the user for resetting the password has a link (/pg/passwordreset...), and when the user follows this email, it gives the "please log in" thing.
I added the line to the "//Allow should have pages" (line 32):
"$allow[] = $CONFIG->url . 'pg/resetpassword';
Grizwald 682 days ago
How can I create a link to a page with login and registration?
David Stawowy 679 days ago
work with riverdashboard ?
Jose Chaves 666 days ago
Wow! It took me awhile to discover the same problem that Grizwald found. The user could not reset his password. Made the change suggested by Grizwald and all is well again. Thanks Grizwald. Looks like this should be put into an update soon. This is a big bug.
Fred Phillips 626 days ago
@Khaled:- Thanks for this wonderful plugin
bujji1 607 days ago
Excelent plug in, works in version 1.7.6, thanks
David SOS 491 days ago
Hi, this plugin is awesome.
I have one little problem with it, and siteaccess though. When I send a conformation email and the person clicks on it... it says they need to link in to confirm..
I can't seem to find the correct "$allow[] = $CONFIG->url . '*********'; to enter.
If anyone could kindly let me know how I can fix it so people can confirm I'd really appreicate it. Thank you.
zeroflares 417 days ago
try this codes
$allow[] = $CONFIG->url . 'pg/register';
$allow[] = $CONFIG->url . 'pg/register/';
$allow[] = $CONFIG->url . 'account/register.php';
$allow[] = $CONFIG->url . 'account/forgotten_password.php';
$allow[] = $CONFIG->url . 'action/register';
$allow[] = $CONFIG->url . 'action/user/requestnewpassword';
$allow[] = $CONFIG->url . 'action/user/passwordreset';
$allow[] = $CONFIG->url . 'action/logout';
$allow[] = $CONFIG->url . 'pg/resetpassword';
$allow[] = $CONFIG->url . 'pg/register';
Satheesh PM 417 days ago
Thanks. I'd also like to add I had success with this line for the uservalidationbyemail.
$allow[] = $CONFIG->url . 'action/confirmlink';
zeroflares 395 days ago
How do you allow access to groups only?
seth101 291 days ago
Hi all! How do you allow access to blog only. My site www.zoneprivacy.com
zoneprivacy 275 days ago
@Mike : Elgg 1.8 comes with these feature inbuilt. Go to the settings page and turn on the walled garden.
Team Webgalli 158 days ago
@Mike: in case you need a 1.8 compatible version you can use my Elgg 1.8 port of the login required plugin:
http:/
Though the walled-garden option built in to Elgg 1.8 might be enough for you as Team Webgalli suggested.
iionly 158 days ago

DhrupDeScoop
Profile
Friends
Friends of
Plugins
intewesting code ;-)
i can recreate the whole plugin from yr code snippet ;;)
but...
why don't you just post yr plugin anyway ?
if you not want to.. understood ;-)
thx
a new twist on "walled garden"
;-)
I had a peek into yr code.. rather very interesting coding and extensibility style ! I hope more people download and check this out -- even though a little bit of coding may be required to extend the functionality, I believe that this will help people cure some headaches they are having with the other, heavier plugins.
DhrupDeScoop 768 days ago