CWT Community um eigene Benutzerfelder erweitern

Veröffentlicht am

Verwendete Extensions: cwt_community 1.0.3, cwt_feedit 0.8.2, sr_feuser_register 2.5.19.

Schritte:

  1. Per kickstarter eine Extension erstellen, die fe_users um die gewünschten Felder erweitert
  2. Die Datei typo3conf/ext/cwt_community/pi1/class.tx_cwtcommunity_pi1.php um das gewünschte Feld aus der neuen Extension ergänzen. In unserem Beispiel heißt die Extension "dtifeuserfields" und das Feld "aktivals". Der untenstehende Code müsste natürlich an Ihre Extension und Ihr Feld angepasst werden.
    /** PROFIL EDIT **/
    [...]
    $items['tx_dtifeuserfields_aktivals']['label'] = htmlspecialchars(tslib_pibase::pi_getLL('CWT_PROFILE_EDIT_AKTIVALS_LABEL'));
    $items['tx_dtifeuserfields_aktivals']['error_msg'] = htmlspecialchars(tslib_pibase::pi_getLL('CWT_PROFILE_EDIT_AKTIVALS_ERRMSG'));
    [...]
    //
    Generate content
    [...]
    $content.=$form->getElement("tx_dtifeuserfields_aktivals");
    [...]
    *
    Displays the user profile page for a user.
    [...]
    if($user['tx_dtifeuserfields_aktivals']){
    $markerArray["###AKTIVALS_LABEL###"]= '<p>'.$cObj->stdWrap(htmlspecialchars(tslib_pibase::pi_getLL('CWT_PROFILE_AKTIVALS')),"").'</p><div>
    $markerArray["###AKTIVALS###"] = '<p>'.$cObj->stdWrap($this->pi_getLL('fe_users.tx_dtifeuserfields_aktivals.I.'.$user['tx_dtifeuserfields_aktivals']), "").'</p><div>style="height:20px;"></div>';
    }else{
    $markerArray["###AKTIVALS_LABEL###"] = '';
    $markerArray["###AKTIVALS###"] = '';
    }
    [...]
    $form->init($table,$items, $record_uid, $cruser_id, $GLOBALS["TSFE"]->id,array(), $this, array("dtifeuserfields","cwt_community_user"),false, $isHashingEnabled);
  3. Die locallang.xml von CWT Community anpassen:
    <label index="CWT_PROFILE_EDIT_AKTIVALS_LABEL">Ich bin aktiv als:</label>
    <label index="CWT_PROFILE_EDIT_AKTIVALS_HELPTEXT">Hier bitte eingeben, was du so machst.</label>
    <label index="CWT_PROFILE_EDIT_AKTIVALS_ERRMSG">Hier bitte eingeben, was du so machst.</label>
    <label index="CWT_PROFILE_AKTIVALS">Ich bin aktiv als:</label>
    <label index="AKTIVALS">Aktiv als</label>
  4. Die für die Checkbox relevanten Inhalte der locallang_db der eigenen Extension in die locallang.xml von CWT Community kopieren.
  5. tx_cwtcommunity_pi1_profile.html anpassen:
    ###AKTIVALS_LABEL### ###AKTIVALS###<!-- Was ich mache -->

Weitere Hinweise:

TYPO3