Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Front End User Login Plugin (XML Or Database - ver: 3.0)
(2013-06-25, 10:18:20)ds10 Wrote: I've taken the Plugin and changed it somewhat to met my needs to support enhanced user management for my site. Maybe you will also find it useful. Even if I call this enhanced it is missing the database support because I don't need it. Instead it support additional fields like full name of the user and two groups of users developers and admins. You can change your password if you have forgotten it.

If there is demand I will upload this to extend but first it needs to be tested by someone else. I'm open for suggestions and tips what to do better. But don't ask me to add database support, I won't do it because I want to keep it simple.

front-end-user-login-enhanced.zip
Nice modification. It works great for me. However I need a little help. I need to set a condition in my template file based on group. So far i was able to set a condition based on username:
Code:
<?php
if(isset($_SESSION['LoggedIn']) && ($_SESSION['Username'] == "Jack"))
{ $discount = "0.95";}
?>
I would like to set something like this:
Code:
<?php
if(isset($_SESSION['LoggedIn']) && ($_SESSION['Group'] == "Group 1")
{ $discount = "0.95";}
?>
This one doesnt work obviously and i dont know how should this script look like. Basically i need the script to check which user is logged in and what is his group, and if the user is in group "Group 1" then...

Any help would be really appreciated.

EDIT: Ok, few days of thinking and i came up with solution.
To sum it up: If you are using this user-login-enhanced plugin and you want to use groups (use=add php condition based on what group is user in) here is my way.
Put this code in your template file, after the tag </head>
Code:
<?php
if (file_exists('data/enhanced-site-users/'.$_SESSION['Username'].'.xml')) {
    $xml = simplexml_load_file('data/enhanced-site-users/'.$_SESSION['Username'].'.xml');
    $group=$xml->Group;    

if ($group == "Group 1") {
echo "You are in Group 1";}
else if ($group == "Group 2") {
echo "You are in Group 2";}
else if ($group == "Group 3") {
echo "You are in Group 3";}
}
else {
echo "You are not logged in"}
?>
You need to edit "Group 1" (2,3) to whatever your groups are. And you should also edit "echo "You are in Group 1";" to whatever you want to happen.

Cheers.
Reply


Messages In This Thread
Example site down, having issues - by Rich_K - 2012-11-14, 07:36:37
RE: Front End User Login Plugin (XML Or Database - ver: 3.0) - by quish - 2014-03-24, 02:38:27
login box won't display - by horstuff - 2015-11-20, 04:57:25



Users browsing this thread: 2 Guest(s)