---
title: "tt_news Kommentare ohne einloggen"
url: "https://www.typo3.net/d/24979-tt-news-kommentare-ohne-einloggen"
source: "typo3.net"
tags: ["Extensions","PHP","Tipp","tt_news"]
created: "2005-05-19"
last_reply: "2006-02-01"
replies: 2
solved: true
page: 1
pages: 1
lang: "de"
---

# tt_news Kommentare ohne einloggen

Extensions · 2 Antworten · gelöst · gestartet 2005-05-19

## Frage

**Unbekannter Benutzer** · 2005-05-19 · [Beitrag #1](https://www.typo3.net/d/24979-tt-news-kommentare-ohne-einloggen/1)

tt_news mit ednewscomments ohne einloggen

Hallo typo3 Gemeinde,

ich habe mich hingesetzt und wollte bei tt_news Kommentare hinzufügen. Ich habe einen Tag gebraucht um herrauszufinden, dass man eingeloggt sein muss, um Kommentare schreiben zu können. Da hab ich mir gedacht, ne - so nicht!

Also, hier eine kleine Anleitung, wie man die Loginpremisse umgeben kann:

als erstes gehen wir ins phpmyadmin und ändern die struktur der Tabele tx_ednewscomments_items. fe_user wird von blob in varchar umgeschrieben.

Als nächstes fügen wir (/typo3conf/ext/ed_newscomments/pi1/class.tx_ednewscomments_pi1.php) das Inputfeld Name ein (Zeile: 391)

wir ändern:

```php
$markerArray["###COMMENT###"] = '<textarea name="tx_ednewscomments_pi1[comment]" rows="'.$this->conf["formAdd."]["rows"].'" cols="'.$this->conf["formAdd."]["cols"].'">'.$this->pi_getLL("pi_formAdd_comment").'</Textarea>';
```

in

```php
$markerArray["###COMMENT###"] = '<input name="kommentarname" type="text"><br><textarea name="tx_ednewscomments_pi1[comment]" rows="'.$this->conf["formAdd."]["rows"].'" cols="'.$this->conf["formAdd."]["cols"].'">'.$this->pi_getLL("pi_formAdd_comment").'</Textarea>';
```

Dann noch in Zeile 218:

Ersetze

```php
".$this->userData["uid"].",
```

durch

```php
".$_POST[kommentarname].",
```

und dann noch eine letzte Sache:

Zeile: 459

Ersetze:

```php
return $this->listValues["users"][$this->internal["currentRow"]["fe_user"]]["name"];
```

durch

```php
return $this->internal["currentRow"]["fe_user"];
```

Jetzt noch in Zeile 387 und 399 die if Abfrage entfernen.

dann müsste das klappen.

Falls Fragen oder Fehler in meiner Beschreibung sind, e-mail an mich.

Schönen Gruß Christian

P.S. ich arbeite an einer Version die erkennt ob man eingeloggt ist und dann entsprechend handelt.

## Beste Antwort

**Unbekannter Benutzer** · 2006-02-01 · [Beitrag #3](https://www.typo3.net/d/24979-tt-news-kommentare-ohne-einloggen/3)

Ich habe einen Hinweis bekommen, dass es bei der aktuellen Version mit meinen Änderungen zu einem kleinen Problem kommt. Leider weiß ich die Version nicht mehr, zu der ich dieses HOW-TO geschrieben habe.

Wenn ihr typo 3.8.0 und tt_news 2.2.24 benutzt müsst ihr noch folgendes ändern

Zeile 196

```php
"fe_user"=>$this->userData["uid"],
```

ersetzen durch

```php
"fe_user"=>$_POST[kommentarname],
```

Danke an Johannes Rusch.

## Antworten

### [#2](https://www.typo3.net/d/24979-tt-news-kommentare-ohne-einloggen/2) · Unbekannter Benutzer · 2005-05-21

Erweiterung:

Hierdruch wird der Name von eingeloggten Usern übernommen:

ab Zeile: 393

```php
		function addForm() {
			if (is_array($this->userData)) {
				$out = $this->cObj->getSubpart($this->templateCode, '###ADD_FORM###');
				$markerArray = array();
				$wrappedSubpartArray = array();
				
				$markerArray["###COMMENT###"] = '&nbsp;<b>'.$GLOBALS['TSFE']->fe_user->user['name'].'</b><br><textarea class="textfield" name="tx_ednewscomments_pi1[comment]">'.$this->pi_getLL("pi_formAdd_comment").'</Textarea><br>';
				$markerArray["###SUBMIT###"] = '<input type="submit" name="tx_ednewscomments_pi1[submit]" value="'.$this->pi_getLL("pi_formAdd_submit").'">';
				$markerArray["###IMAGE_SUBMIT###"] = '<input type="image" name="tx_ednewscomments_pi1[submit]" src="'.$this->cObj->cObjGetSingle("IMG_RESOURCE", $this->conf["formAdd."]["imageSubmit."]).'" value="'.$this->pi_getLL("pi_formAdd_submit").'">';
				
				$wrappedSubpartArray["###ADD_FORM_TAG###"]=array('<form method="post">','<input type="hidden" name="tx_ednewscomments_pi1[action]" value="add"><input type="hidden" name="no_cache" value="1"><input type="hidden" name="kommentarname" value="'.$GLOBALS['TSFE']->fe_user->user['name'].'"></form>');
				
				$out = $this->cObj->substituteMarkerArrayCached($out, $markerArray, array(), $wrappedSubpartArray);
			}
			else {
				$out = $this->cObj->getSubpart($this->templateCode, '###ADD_FORM###');
				$markerArray = array();
				$wrappedSubpartArray = array();
				
				$markerArray["###COMMENT###"] = '<input class="inputfield" name="kommentarname" type="text"><br><textarea class="textfield" name="tx_ednewscomments_pi1[comment]">'.$this->pi_getLL("pi_formAdd_comment").'</Textarea><br>';
				$markerArray["###SUBMIT###"] = '<input type="submit" name="tx_ednewscomments_pi1[submit]" value="'.$this->pi_getLL("pi_formAdd_submit").'">';
				$markerArray["###IMAGE_SUBMIT###"] = '<input type="image" name="tx_ednewscomments_pi1[submit]" src="'.$this->cObj->cObjGetSingle("IMG_RESOURCE", $this->conf["formAdd."]["imageSubmit."]).'" value="'.$this->pi_getLL("pi_formAdd_submit").'">';
				
				$wrappedSubpartArray["###ADD_FORM_TAG###"]=array('<form method="post">','<input type="hidden" name="tx_ednewscomments_pi1[action]" value="add"><input type="hidden" name="no_cache" value="1"></form>');
				
				$out = $this->cObj->substituteMarkerArrayCached($out, $markerArray, array(), $wrappedSubpartArray);
			}
			return $out;
		}
```

Der Rest wie oben beschrieben.

### [#3](https://www.typo3.net/d/24979-tt-news-kommentare-ohne-einloggen/3) · Unbekannter Benutzer · 2006-02-01 · Beste Antwort

(Text siehe oben unter „Beste Antwort“.)

---

Quelle: „tt_news Kommentare ohne einloggen“, typo3.net, https://www.typo3.net/d/24979-tt-news-kommentare-ohne-einloggen
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
