[TYPO3-english] How to Display FE_user name instead of feuser_id in menu - 'WEC Staff Directory'

Jogvan Olsen jo at atlanticvideo.dk
Thu Dec 20 13:14:50 CET 2012


Hi List


I am using a modified version of this menu:
http://typo3.toaster-schwerin.de/typo3_english/2007_01/msg00900.html
to display a list-menu of all staff members in 'WEC Staff Directory'. It 
works as supposed, but I have one problem.

I use 'Use Front-End users to store data': meaning that the members 
names are stored in the fe_users table.

My problem is: I can't figure out how to display the fe_users name 
instead of the feuser_id.  I can't figure out how to read the name from 
the fe_users table with the feuser_id from tx_wecstaffdirectory_info

Can somebody please help me with the problem.

Thanks in advance
Jogvan Olsen



Here is the code I use

-------
menuFunc_2.inc

<?php
class user_menuFunc {
      function makeMenuArray($content,$conf) {
         $GLOBALS["TSFE"]->set_no_cache();
          $menuArr = array();
          $lConf = $conf["userFunc."];
          $overridehref = $lConf['_OVERRIDE_HREF'];
          $res =
$this->cObj->exec_getQuery($lConf["table"],$lConf["select."]);
          if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
              $GLOBALS['TT']->setTSlogMessage($error,3);
          } else {
              $GLOBALS['TT']->setTSlogMessage('NUMROWS:
'.$GLOBALS['TYPO3_DB']->sql_num_rows($res));
              while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {

                 $row['_OVERRIDE_HREF'] = 'index.php?id=' . $overridehref
                                         . 
'&tx_wecstaffdirectory_pi1[curstaff]=' . $row['uid'];

                  $menuArr[] = $row;
              }
          }
          return $menuArr;
      }
}
?>
-----



TS setup:
---------------------
## STAFF menu start
page.includeLibs.usermenu = fileadmin/script/menuFunc_2.inc

lib.field_wec_staff_list = HMENU
lib.field_wec_staff_list.protectLvar = 1
lib.field_wec_staff_list.wrap = <ul>|</ul>
lib.field_wec_staff_list.special = userfunction
lib.field_wec_staff_list.special.userFunc = user_menuFunc->makeMenuArray
lib.field_wec_staff_list.special.userFunc.table = tx_wecstaffdirectory_info
lib.field_wec_staff_list.special.userFunc.select.pidInList = 27
lib.field_wec_staff_list.special.userFunc._OVERRIDE_HREF = 17
lib.field_wec_staff_list.1 = TMENU
lib.field_wec_staff_list.1 {
   NO {
     stdWrap.cObject = CASE
     stdWrap.cObject {
       default = COA
       default {
         10 = TEXT
         10.stdWrap.data = field:feuser_id
         10.wrap = | <br/>
         20 = TEXT
         20.stdWrap.data = field:position_title
       }
     }
     allWrap = <li>|</li>
   }
   ACT < .NO
   ACT = 1
   ACT {
     ATagParams = class="selected"
   }
}
## STAFF menu end

-----------------------------------------


More information about the TYPO3-english mailing list