[TYPO3-english] Typoscript usergroup condition with values from page record

Edmund Huggett ehuggett at xact.uk.com
Thu Dec 12 15:04:35 CET 2013


Quick and dirty user function solution I ended up with by copying and 
modifying Typo's usergroup condition, if anyone finds this useful you 
have my sympathy...

<?php
function user_checkProductGroup() {
         $groupList = $GLOBALS['TSFE']->gr_list;
         if ($groupList != '0,-1') { // '0,-1' is the default usergroups 
when not logged in!
                 $value = $GLOBALS['TSFE']->page['custom_field_name'];
                 $values = t3lib_div::trimExplode(',', $value, TRUE);
                 foreach ($values as $test) {
                         if ($test == '*' || 
t3lib_div::inList($groupList, $test)) {
                                 return TRUE;
                         }
                 }
         }
         return FALSE;
}
?>

Any comments / improvements will still be appreciated!

Thanks for taking the time to read my request

Edmund


More information about the TYPO3-english mailing list