[TYPO3-english] problems with comments field when editing user profiles (FE)

Tomas Norre Mikkelsen tomas at pohldata.dk
Sun Nov 9 11:57:40 CET 2008


Hi,

I have a problem with the cwt_community and cwt_feedit plugin.

I have my user profile and what to edit the fe_users.comments field to, i
have added the fe_users.title-field too, but there is not errors here.

I have made following in the class.tx_cwtcommunity_pi1.php

/* Added - BEGIN */

	$items['title']['label'] =
htmlspecialchars(tslib_pibase::pi_getLL('CWT_PROFILE_EDIT_TITLE_LABEL'));

        //$items['title']['helptext'] =
htmlspecialchars(tslib_pibase::pi_getLL('CWT_PROFILE_EDIT_TITLE_HELPTEXT'));

        $items['title']['error_msg'] =
htmlspecialchars(tslib_pibase::pi_getLL('CWT_PROFILE_EDIT_TITLE_ERRMSG'));

	$items['comments']['label'] =
htmlspecialchars(tslib_pibase::pi_getLL('CWT_PROFILE_EDIT_COMMENT_LABEL'));

        //$items['comments']['helptext'] =
htmlspecialchars(tslib_pibase::pi_getLL('CWT_PROFILE_EDIT_COMMENT_HELPTEXT'));

        $items['comments']['error_msg'] =
htmlspecialchars(tslib_pibase::pi_getLL('CWT_PROFILE_EDIT_COMMENT_ERRMSG'));

I have also added:

$content.= $form->getElement("www");

$content.= $form->getElement("tx_cwtcommunityuser_image");

//$content.= $form->getElement("tx_cwtcommunityuser_sex");

//$content.= $form->getElement("tx_cwtcommunityuser_gallery_activated");

// new line
$content.= $form->getElement("comments");

When i use the debug mode for cwt_feedit, i get my field list in the top.

This list contains the "comments" info so it must know something about :)

See the screenshot here:
http://fritdrop.dk/fileadmin/debug/edit_profile_debug_0.png

but the list at beneth with text:
Fetching values from DATABASE...
Query: SELECT username FROM fe_users WHERE uid=52
Array ( [0] => Array ( [username] => mikkeltomas ) )

the array field [username] is not empty.. and the list does not have an
entry for "comments".

In the class.tx_feedit_pi1.php file has function:
FetchValueFromItem($item_key), i have test with:

// added to test directly to "comments" key
$item_key="comments";

function fetchValueFromItem($item_key){

		if ($this->mode == "VIEW_EDITPROFILE" &&
$this->postvars["submit_delete"] == null){

			// Check for eval_function twice

			$twice=(substr($item_key,-6)=="_again");

			if ($twice) {

				$item_key=substr($item_key,0,-6);

			}
			// added to test directly to "comments" key
			$item_key="comments";

			//Do the query

			if ($this->debug){ echo "Fetching values from DATABASE...<br>";}

			$res = $this->doDatabaseQuery("SELECT ".$item_key." FROM
".$this->table." WHERE uid=".intval($this->record_uid));

			$res = $res[0][$item_key];

		} elseif($this->mode == "VIEW_EDITPROFILE" &&
$this->postvars["submit_delete"] != null){

			if ($this->debug){ echo "Fetching values from POST VARS...<br>";}

			 $res = $this->postvars[$item_key];

		} elseif ($this->mode == "VIEW_EDITPROFILE_ERROR" || $this->mode ==
"VIEW_EDITPROFILE_PREVIEW" || $this->mode == "VIEW_EDITPROFILE_RESULT"){

			if ($this->debug){ echo "Fetching values from POST VARS...<br>";}

			$res = $this->postvars[$item_key];

		} elseif ($this->mode == 'VIEW_EDITPROFILE_NEW') {

			if ($this->debug){ echo "Fetching values from POST VARS...<br>";}

			$res = $this->postvars[$item_key];

		}

		//Return

		return $res;

	}

This hardcode results in following,

Fetching values from DATABASE...
Query: SELECT comments FROM fe_users WHERE uid=52
Array ( [0] => Array ( [comments] => ) )

the array field [comments] is empty, thats were i got confused.. the field
contain data in the DB.

See: http://fritdrop.dk/fileadmin/debug/edit_profile_debug_1.png

My thoughts were that it is not on the list on:
http://fritdrop.dk/fileadmin/debug/edit_profile_debug_0.png because its
empty, but i don't understand why its empty.

Hope Someone can help me.. i a bit lost what to do to get this working.

Best Regards
Tomas Norre Mikkelsen
Pohl Data A/S




More information about the TYPO3-english mailing list