(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.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:
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
Code:
<?php
if(isset($_SESSION['LoggedIn']) && ($_SESSION['Username'] == "Jack"))
{ $discount = "0.95";}
?>
Code:
<?php
if(isset($_SESSION['LoggedIn']) && ($_SESSION['Group'] == "Group 1")
{ $discount = "0.95";}
?>
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"}
?>
Cheers.