Hi,
also gefühlt war das vorausfüllen der Kommentarform noch verzwickter
Die Ausgangssituation sieht gar nicht so schlecht aus. In der Datei include/functions_comments.php sieht die Funktion für die Kommenatre so aus:
Code: Select all
function serendipity_displayCommentForm($id, $url = '', $comments = NULL, $data = NULL, $showToolbar = true, $moderate_comments = true, $entry = null) {
global $serendipity;
...
$commentform_data = array(
'commentform_action' => $url,
'commentform_id' => (int)$id,
'commentform_name' => isset($data['name']) ? serendipity_specialchars($data['name']) : (isset($serendipity['COOKIE']['name']) ? serendipity_specialchars($serendipity['COOKIE']['name']) : ''),
'commentform_email' => isset($data['email']) ? serendipity_specialchars($data['email']) : (isset($serendipity['COOKIE']['email']) ? serendipity_specialchars($serendipity['COOKIE']['email']) : ''),
'commentform_url' => isset($data['url']) ? serendipity_specialchars($data['url']) : (isset($serendipity['COOKIE']['url']) ? serendipity_specialchars($serendipity['COOKIE']['url']) : ''),
Wenn ich das richtig sehe, kann man der Funktion ein Array an $data übergeben und aus diesem Array wird dann versucht Name, Email und URL auszulesen. Das Ganze landet dann im Array $commentform_data und wird $serendipity['smarty']. Von da hat das entsprechende Template ja eigentlich Zugriff auf die Werte.
Im Template 2k11 werden diese auch schon genutzt:
Code: Select all
<input id="serendipity_commentform_name" name="serendipity[name]" type="text" value="{$commentform_name}"
Das Hauptproblem ist eigentlich, dass in $serendipity['POST'] nichts drin steht, zumindest bei mir nicht
include/functions_entries.inc.php
Code: Select all
serendipity_displayCommentForm(
$entry['id'],
$serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?url=' . $entry['commURL'],
true,
$serendipity['POST'],
true,
serendipity_db_bool($entry['moderate_comments']),
$entry
);
Ich hab vorerst mal ein Array $codata angelegt und gefüllt.
Code: Select all
$codata = array();
$codata['use'] = true;
$codata['name'] = $serendipity['realname'];
$codata['email'] = $serendipity['email'];
serendipity_displayCommentForm(
$entry['id'],
$serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?url=' . $entry['commURL'],
true,
$codata,
true,
serendipity_db_bool($entry['moderate_comments']),
$entry
);
Das wars. Sobald jetzt ein Autor angemeldet ist, werden Die Felder Name und Email im Kommentarformular vorausgefüllt. Allerdings habe ich keine Ahnung wo wir den Wert URL her bekommen sollen. Der Autor hat im Backend -> persönliche Einstellungen gar keine Einstellmöglichkeiten für eine URL. Wir könnten bei allen Autoren $serendipity['baseURL'] rein schreiben, aber ich persönlich brauche da gar keine URL
Was sagst du zu dem Lösungsansatz? Ich hoffe ich hab nicht komplett daneben gegriffen
Sag bescheid wenn ich daraus einen Pull Request machen soll.
Viele Grüße