Do you use phpwcms 1.2.6?///// Please take one second to read this header
/////
///// http://www.enym.com
///// Konstantin Schultes
/////
///// LOGIN-LOGOUT PANEL CONTENT-PART
///// ===============================
/////
///// Successfully tested with fresh install of 1.2.6
/////
///// Special thanx to the whole community and Oliver Georgi
/////
///// Login-Logout Panel lets you set up and customize a panel that fits most needs
///// everything can be changed via admin.
/////
/////
///// Installation time: ~ 5 min
///// Level: "easy"
/////
///// Languages included: GERMAN & ENGLISH
///// If you like please translate appropriate file in include/inc_lang/add to lang_inc.txt
///// and send it to info@enym.com
/////
///// Any help is much appreciated
/////
///// Have fun and don't forget phpwcms is great
/////
///// Thanks:
///// special thanks to julius for the netherlands - translation
///// thanx to markoehl for the basis and pwmod
/////
/////////////////////////////////////////////////
/////////////////////////////////////////////////
///// USE VTS ONLY IF YOU DO HAVE IT INSTALLED! <---------------------------------!!!!!!!!!!!!!!!
/////////////////////////////////////////////////
/////////////////////////////////////////////////
1. Files: Easy Installation (just copy include folder)
------------------------------------------------------
Put all files in the appropriate folders (there are none to overwrite)
Add the language texts into the language files (see mentioned files \include\inc_lang\backend\de or en\add to lang.inc.txt)
/////
/////
/////
/////
/////
/////
2. Some minor code changes:
---------------------------
add
to include/inc_lib/article.contenttype.inc.php
203 => $BL['be_ctype_login']
Or alternitavely (its the same):
replace this:
24 => $BL['be_ctype_alias']
with that:
24 => $BL['be_ctype_alias'],
203 => $BL['be_ctype_login']
(just to make you mind that comma - no comma in the last line!!)
/////
/////
Replace in index.php
(search for "visible_mode")
// define VISIBLE_MODE
// 0 = frontend (all) mode
// 1 = article user mode
// 2 = admin user mode
if(empty($_SESSION["wcs_user_id"])) {
define('VISIBLE_MODE', 0);
} else {
define('VISIBLE_MODE', $_SESSION["wcs_user_admin"] != 1 ? 0 : 2);
}
WITH
// define VISIBLE_MODE
// 0 = frontend (all) mode
// 1 = article user mode
// 2 = admin user mode
if(empty($_SESSION["wcs_user_id"])) {
define('VISIBLE_MODE', 0);
} else if($_SESSION["wcs_user_fe"] == 0) {
define('VISIBLE_MODE', 2);
} else {
define('VISIBLE_MODE', $_SESSION["wcs_user_admin"] != 1 ? 0 : 2);
}
/////
/////
finished
------------------------------------------------------
THE REST IS OPTIONAL! BUT WORTH BEING IMPLEMENTED TOO!
------------------------------------------------------
Change logout-target page (target after logout from admin, or frontend)
In phpwcms.php edit the following:
replace this:
//ENYM.com login-logout-panel
case "logout": //Logout
mysql_query("UPDATE ".DB_PREPEND."phpwcms_userlog SET logged_change=".time().", logged_in=0 WHERE logged_user='".$_SESSION["wcs_user"]."' AND logged_in=1;");
session_destroy();
header("Location: ".PHPWCMS_URL."login.php");
exit();
break;
//ENYM.com login-logout-panel
with that:
//ENYM.com login-logout-panel: changed logout target
case "logout": //Logout
mysql_query("UPDATE ".DB_PREPEND."phpwcms_userlog SET logged_change=".time().", logged_in=0 WHERE logged_user='".$_SESSION["wcs_user"]."' AND logged_in=1;");
session_destroy();
header("Location: ".PHPWCMS_URL."index.php"); //Target Site you want to be shown after logout
exit();
break;
//ENYM.com login-logout-panel: changed logout target
/////
/////
/////
/////
/////
/////
Thats it!
- Got to Admin:
- Create an article and add "Login-Logout Panel" Content Part - add infos there
- Now create users and set them to frontend only (they can go to backend anyway)
3. Make articles visible for logged in users only:
--------------------------------------------------
(with not having the bug to be able to alter the url to get into the hidden content):
Structure level set:
visible 1 (rest is 0)
Articles inside this level set to
visible 1
BUT
not public!!!!! (red eye)
BTW: I have all Frontend users set to FE only, anyway: they can log in into backend. Dont know. Doesn't matter.
Just for your consideration.
/////
/////
/////
/////
/////
/////
Further hints:
--------------
Restrict FE Users possiblities in Admin:
phpwcms.php Add the enym part of the following in the follwing code context
(find the following and change what is commented as the enym part in the next code sample)
//Wenn der User kein Admin ist, anderenfalls
if(!isset($_SESSION["wcs_user_admin"]) || !intval($_SESSION["wcs_user_admin"])) {
unset($wcsnav["admin"]);
//ENYM: wenn sich ein frontenduser anmeldet dann das alles auch nicht zeigen:
unset($wcsnav["admin"]);
unset($wcsnav["articles"]);
unset($wcsnav["modules"]);
unset($wcsnav["vts"]);
//ENYM RESTRICT
//$wcsnav["admin"] = '';
} else {
if($do == "admin") {
//$do = $_GET["do"];
$wcsnav["admin"] = '<strong class="navtexta">'.$wcsnav["admin"].'</strong>';
}
}
How to make the permission thing work. So that you can assign users to be able to access only certain structure levels:
(Thanx to markoehl again)
search in include/inc_front/front.func.inc.php
Code:
$data[$row["acat_id"]] = array( "acat_id" => $row["acat_id"],
"acat_name" => $row["acat_name"],
"acat_info" => $row["acat_info"],
"acat_struct" => $row["acat_struct"],
"acat_sort" => $row["acat_sort"],
"acat_hidden" => $row["acat_hidden"],
"acat_regonly" => $row["acat_regonly"],
"acat_ssl" => $row["acat_ssl"],
"acat_template" => $row["acat_template"],
"acat_alias" => $row["acat_alias"],
"acat_topcount" => $row["acat_topcount"],
"acat_redirect" => $row["acat_redirect"],
"acat_order" => $row["acat_order"],
"acat_timeout" => $row["acat_cache"],
"acat_nosearch" => $row["acat_nosearch"],
"acat_nositemap"=> $row["acat_nositemap"],
"acat_permit" => !empty($row["acat_permit"]) ? explode(',', $row["acat_permit"]) : array()
);
replace with
Code:
//PWmod by markkoehl
$permissioncheck = !$row["acat_permit"] ? 1 : 0;
if (isset($_SESSION["wcs_user_id"]) AND $row["acat_permit"]) {
$temparray = explode(',', $row["acat_permit"]);
foreach($temparray as $value) {
if ($_SESSION["wcs_user_id"] == $value) {
$permissioncheck = 1;
break;
}
}
}
if ($permissioncheck == 1) {
$data[$row["acat_id"]] = array( "acat_id" => $row["acat_id"],
"acat_name" => $row["acat_name"],
"acat_info" => $row["acat_info"],
"acat_struct" => $row["acat_struct"],
"acat_sort" => $row["acat_sort"],
"acat_hidden" => $row["acat_hidden"],
"acat_regonly" => $row["acat_regonly"],
"acat_ssl" => $row["acat_ssl"],
"acat_template" => $row["acat_template"],
"acat_alias" => $row["acat_alias"],
"acat_topcount" => $row["acat_topcount"],
"acat_redirect" => $row["acat_redirect"],
"acat_order" => $row["acat_order"],
"acat_timeout" => $row["acat_cache"],
"acat_nosearch" => $row["acat_nosearch"],
"acat_nositemap"=> $row["acat_nositemap"],
"acat_permit" => !empty($row["acat_permit"]) ? explode(',', $row["acat_permit"]) : array()
);
}
//End PWmod
To make frontend user really frontend users: alter the following in
inc_lib/checklogin.inc.php
replace this line
$sql .= "WHERE logged_user='".aporeplace($_SESSION["wcs_user"])."' AND logged_in=1";
woith this one:
$sql .= "WHERE logged_user='".aporeplace($_SESSION["wcs_user"])."' AND logged_in=1 AND logged_section>0";
wait no this does not yet work for me.... sorry
Well then the users cannot acces both Backend and frontend - Sorry no solution yet
THANX: You are done, please send feedback to info@enym.com if you like it
much appreciated
Did you download phpwcms_userpanel_v2.01.rar?
Did you install all the files from phpwcms_userpanel_v2.01.rar?
Did you do all the code changes mentioned in install.txt?
Did you then create a userpanel content part?
[http://www.phpwcms-docu.de/content_parts_en.phtml]
Can we see your site online?
Success!