CP-Class if (FE-User)

Defines a class for the CP when a FE user (Frontend login) is logged on.
<div class="logged-in-class"> ... </div>

Description:

In this case, all CPs to be parsed without exception. The trigger simply looks for whether
("$data['acontent_granted'] == true") (so the switch "[x] for logged-in frontend users only " is set)
and defines a class to the respective CP output.


Docu: –
Forum: http://forum.phpwcms.org/viewtopic.php?f=4&t=21284

Author: K.Heermann (flip-flop) http://planmatrix.de
CMS Version: >= 1.3x
Version: V1.0 (07.04.2011)

Condition:/config/phpwcms/conf.inc.php

  • $phpwcms['allow_ext_init'] = 1;



PHP:

File: /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 */
 
?>


Short form:

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');
?>


english/phpwcms_replacer_rts/frontend_init/cp_trigger/cp-class-fe_user.txt · Last modified: 2018/06/03 18:09 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0