NAVIGATION
Legt eine Klasse um den CP, wenn ein FE-User (froentend-login) angemeldet ist.
→ <div class="logged-in-class"> ... </div>
In diesem Fall werden alle CPs ohne Ausnahme geparst. Der Trigger schaut einfach nach ob
("$data['acontent_granted'] == true") (also der Schalter "[x] nur für angemeldete Frontend Benutzer" im CP gesetzt)
und legt eine Klasse um die jeweilige CP-Ausgabe.
Docu: –
Forum: http://forum.phpwcms.org/viewtopic.php?f=4&t=21284
Autor: K.Heermann (flip-flop) http://planmatrix.de
CMS Version: >= 1.3x
Version: V1.0 (07.04.2011)
Bedingung: → /config/phpwcms/conf.inc.php
Datei: /template/inc_script/frontend_init/cp_trig_cp_logged_in_fe_user.php
cp_trig_cp_logged_in_fe_user.php
<?php // ------------------------------------------------------------------------------------------- // obligate check for phpwcms constants if (!defined('PHPWCMS_ROOT')) { die("You Cannot Access This Script Directly, Have a Nice Day."); } // ------------------------------------------------------------------------------------------- // // 07.04.11 KH (flip-flop) Returns a class around this CP, if "for logged-in frontend users only" // is set // Forum: http://forum.phpwcms.org/viewtopic.php?f=4&t=21284 // ------------------------------------------------------------------------------------------- // http://forum.phpwcms.org/viewtopic.php?p=107107#p107107 /* ------------------------------------------------------------------ function cp_trigger_function_name($param1, & $param2) { if($param2['acontent_type'] == 14) { // 14 is CP WYSIWYG $param1 = do_this_or_that($param2['acontent_id']); } return $param1; } * cp_trigger_function_name - the unique function name * $param1 - holds the content part html source on which you can parse or do custom processing * $param2 - is a reference to an array which holds content part values like ID, dates and other values - see db table phpwcms_articlecontent Always return $param1; */ // ------------------------------------------------------------------ // obligate check for phpwcms constants if (!defined('PHPWCMS_ROOT')) { die("You Cannot Access This Script Directly, Have a Nice Day."); } // ------------------------------------------------------------------ function CLASS_for_logged_in_user($text, & $data) { // Abfrage nach bestimmten CP Typ entfaellt, da alle gemeint sind // if($data['acontent_type'] == 29) { // 29 is CP img div if ($data['acontent_granted']) { $text = '<div class="logged-in-class">'.LF.$text.LF.'</div>'; } return $text; } register_cp_trigger('CLASS_for_logged_in_user'); /* ------- and the next one function CP_Other_CP($text, & $data) { if($data['acontent_type'] == XX) { // XX is CP Other CP $text = custom processing ; } return $text; } register_cp_trigger('CP_Other_CP'); ---------- and so on */ ?>
Kurzform:
cp_trig_cp_logged_in_fe_user.php
<?php // ------------------------------------------------------------------ // obligate check for phpwcms constants if (!defined('PHPWCMS_ROOT')) { die("You Cannot Access This Script Directly, Have a Nice Day."); } // ------------------------------------------------------------------ // 07.04.11 KH (flip-flop) Returns a class around this CP, if "for logged-in frontend users only" // is set // Forum: http://forum.phpwcms.org/viewtopic.php?f=4&t=21284 // ------------------------------------------------------------------------------------------- function CLASS_for_logged_in_user($text, & $data) { return ($data['acontent_granted']) ? '<div class="logged-in-class">'.LF.$text.LF.'</div>': $text; } register_cp_trigger('CLASS_for_logged_in_user'); ?>