Beschreibung:
Mit dieser Tutorial kann man in bestimmten Kategorie(n) automatisch eine Forenumfrage anhängen. Optimal für Gilden etc, die Bewerbungen über das Forum laufen lassen & über eine Aufnahme abstimmen. Dieses Tutorial dient mehr als Leitfaden & PHP-Kenntnisse sind vom Vorteil, vor allem wenn man es noch abändern möchte!
Voraussetzung ist das Du Forum Umfrage installiert hast & die Forum Umfrage deaktiviert hast für die gewünschte Kategorie(n).
Installation:
Suche in der pkinc/public/forumsnewpost.php nach:
|
PHP - Code Anfang: (23 Zeilen) | Code markieren
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
$SQL->query("INSERT INTO ".pkSQLTAB_FORUM_THREAD."
(forumthread_autor,forumthread_autorid,forumthread_catid,
forumthread_icon,forumthread_title,forumthread_lastreply_time,
forumthread_lastreply_autor,
forumthread_votetitle,forumthread_votestatus,
forumthread_voterights,forumthread_votemultiple,
forumthread_votehideresult,forumthread_voteshowtoall,
forumthread_lastreply_autorid)
VALUES
('".$SQL->f($_POST['post_autor'])."',
'".$SQL->i(pkGetUservalue('id'))."',
'".$SQL->i($catid)."',
'".$SQL->f($_POST['post_icon'])."',
'".$SQL->f($_POST['post_title'])."',
'".pkTIME."',
'".$SQL->f($_POST['post_autor'])."',
'".$post_vote_title."',
'1',
'".$SQL->f($_POST['vote_rights'])."',
'".$SQL->i($_POST['post_vote_multiple'])."',
'".$SQL->i($_POST['post_vote_hideresult'])."',
'".$SQL->i($_POST['post_vote_showtoall'])."',
'".$SQL->i(pkGetUservalue('id'))."')");
|
|
|
|
|
PHP - Code Ende: (23 Zeilen) | Code markieren
|
und ersetze mit:
|
PHP - Code Anfang: (61 Zeilen) | Code markieren
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
/* Spaetere Optionen
'".$SQL->f($_POST['post_autor'])."',
'Aufnahme ".$SQL->f($_POST['post_autor'])."', -> Titel der Umfrage
'1',
'member', -> Benoetigter Status für Teilnahme
'0', -> multiple 0=Nein 1=Ja
'0', -> Ergebniss verstecken 0=Nein 1=Ja
'0', -> Umfrage auch Leuten ohne benoetigten Status zeigen 0=Nein 1=Ja
'".$SQL->i(pkGetUservalue('id'))."')");
*/
if($forumcat['forumcat_id'] == 1)
{
$SQL->query("INSERT INTO ".pkSQLTAB_FORUM_THREAD."
(forumthread_autor,forumthread_autorid,forumthread_catid,
forumthread_icon,forumthread_title,forumthread_lastreply_time,
forumthread_lastreply_autor,
forumthread_votetitle,forumthread_votestatus,
forumthread_voterights,forumthread_votemultiple,
forumthread_votehideresult,forumthread_voteshowtoall,
forumthread_lastreply_autorid)
VALUES
('".$SQL->f($_POST['post_autor'])."',
'".$SQL->i(pkGetUservalue('id'))."',
'".$SQL->i($catid)."',
'".$SQL->f($_POST['post_icon'])."',
'".$SQL->f($_POST['post_title'])."',
'".pkTIME."',
'".$SQL->f($_POST['post_autor'])."',
'Aufnahme ".$SQL->f($_POST['post_autor'])."',
'1',
'member',
'0',
'0',
'0',
'".$SQL->i(pkGetUservalue('id'))."')");
}else{
$SQL->query("INSERT INTO ".pkSQLTAB_FORUM_THREAD."
(forumthread_autor,forumthread_autorid,forumthread_catid,
forumthread_icon,forumthread_title,forumthread_lastreply_time,
forumthread_lastreply_autor,
forumthread_votetitle,forumthread_votestatus,
forumthread_voterights,forumthread_votemultiple,
forumthread_votehideresult,forumthread_voteshowtoall,
forumthread_lastreply_autorid)
VALUES
('".$SQL->f($_POST['post_autor'])."',
'".$SQL->i(pkGetUservalue('id'))."',
'".$SQL->i($catid)."',
'".$SQL->f($_POST['post_icon'])."',
'".$SQL->f($_POST['post_title'])."',
'".pkTIME."',
'".$SQL->f($_POST['post_autor'])."',
'".$post_vote_title."',
'1',
'".$SQL->f($_POST['vote_rights'])."',
'".$SQL->i($_POST['post_vote_multiple'])."',
'".$SQL->i($_POST['post_vote_hideresult'])."',
'".$SQL->i($_POST['post_vote_showtoall'])."',
'".$SQL->i(pkGetUservalue('id'))."')");
}
/* Automatische Umfrage by Muetze */
|
|
|
|
|
PHP - Code Ende: (61 Zeilen) | Code markieren
|
suche weiter nach:
|
PHP - Code Anfang: (1 Zeile) | Code markieren
|
|
$update_threadcount=", forumcat_threadcount=forumcat_threadcount+1";
|
|
|
|
|
PHP - Code Ende: (1 Zeile) | Code markieren
|
und füge DARUNTER folgendes ein:
|
PHP - Code Anfang: (15 Zeilen) | Code markieren
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
/* Automatische Umfrage by Muetze */
if($forumcat['forumcat_id'] == 1 && $threadid>0)
{
// Antwort 1
$SQL->query("INSERT INTO ".pkSQLPREFIX."_forumvote
(forumvote_threadid,forumvote_answer)
VALUES
('".$threadid."','Ja')");
// Antwort 2
$SQL->query("INSERT INTO ".pkSQLPREFIX."_forumvote
(forumvote_threadid,forumvote_answer)
VALUES
('".$threadid."','Nein')");
}
/* Automatische Umfrage by Muetze */
|
|
|
|
|
PHP - Code Ende: (15 Zeilen) | Code markieren
|
Beispiele für individuelle Anpassung
Wenn man das zum Beispiel in 2 Kategorien haben möchte, muss man 2 mal folgende Zeilen ändern
in zum Beispiel folgendes:
|
PHP - Code Anfang: (1 Zeile) | Code markieren
|
|
if($forumcat['forumcat_id'] == 1 | $forumcat['forumcat_id'] == 2 && $threadid>0)
|
|
|
|
|
PHP - Code Ende: (1 Zeile) | Code markieren
|
Bei Antwortmöglichkeiten kann man dann auch noch unterscheiden:
|
PHP - Code Anfang: (27 Zeilen) | Code markieren
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
/* Automatische Umfrage by Muetze */
if($forumcat['forumcat_id'] == 1 && $threadid>0)
{
// Antwort 1.1
$SQL->query("INSERT INTO ".pkSQLPREFIX."_forumvote
(forumvote_threadid,forumvote_answer)
VALUES
('".$threadid."','Ja')");
// Antwort 1.2
$SQL->query("INSERT INTO ".pkSQLPREFIX."_forumvote
(forumvote_threadid,forumvote_answer)
VALUES
('".$threadid."','Nein')");
}elseif($forumcat['forumcat_id'] == 2 && $threadid>0)
{
// Antwort 2.1
$SQL->query("INSERT INTO ".pkSQLPREFIX."_forumvote
(forumvote_threadid,forumvote_answer)
VALUES
('".$threadid."','Yes')");
// Antwort 2.2
$SQL->query("INSERT INTO ".pkSQLPREFIX."_forumvote
(forumvote_threadid,forumvote_answer)
VALUES
('".$threadid."','No')");
}
/* Automatische Umfrage by Muetze */
|
|
|
|
|
PHP - Code Ende: (27 Zeilen) | Code markieren
|
Naja, und halt die Optionen für die Umfrage,
Titel der Umfrage: 'Aufnahme ".$SQL->f($_POST['post_autor'])."',
'1',
Benötigter Status für Teilnahme: 'member',
multiple Umfrage 0=Nein 1=Ja: '0',
Ergebnis verstecken 0=Nein 1=Ja: '0',
Auch ohne benötigten Staus die Umfrage sichtbar? 0=Nein 1=Ja: '0', |