Hallo, Gast! (Registrieren)

Letzte Ankündigung: MyBB 1.8.38 veröffentlicht (30.04.24)


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste
Thread Description: Zweites Beschreibungsfeld
#1
Hallo und guten Abend!

Nun bin ich auf diesen Support-Thread für das entsprechende PlugIn gestoßen:
https://www.mybb.de/forum/thread-27581-p...escription

Ich habe also die "threaddescription.php" herunter geladen und installiert. Entsprechend habe ich auch neue Templates angelegt. forumdisplay_thread_description_2 und description_2. Die Codes habe ich aus den Originalen entnommen und nur eben die Variable {§description} unbenannt in {description_2}.

Aber irgendwie wird mir das nicht angezeigt. Im Editor kann ich eine zweite Beschreibung angeben, jedoch taucht sie nicht in der Forenübersicht auf. Irgendwo mach ich definitiv was falsch.

Aber ich will ja gern dazu lernen und brauche Hilfe.

Aktuelle Codes:
Code:
<?php
/**
* Thread Description
* Copyright 2013 Starpaul20
*/

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
   die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

// Neat trick for caching our custom template(s)
if(my_strpos($_SERVER['PHP_SELF'], 'forumdisplay.php'))
{
   global $templatelist;
   if(isset($templatelist))
   {
       $templatelist .= ',';
   }
   $templatelist .= 'forumdisplay_thread_description,forumdisplay_thread_description_2,forumdisplay_thread_description_3,forumdisplay_thread_description_4';
}

if(my_strpos($_SERVER['PHP_SELF'], 'newthread.php'))
{
   global $templatelist;
   if(isset($templatelist))
   {
       $templatelist .= ',';
   }
   $templatelist .= 'description,description_2,description,description_3,description,description_4';
}

if(my_strpos($_SERVER['PHP_SELF'], 'editpost.php'))
{
   global $templatelist;
   if(isset($templatelist))
   {
       $templatelist .= ',';
   }
   $templatelist .= 'description,description_2,description,description_3,description,description_4';
}

if(my_strpos($_SERVER['PHP_SELF'], 'search.php'))
{
   global $templatelist;
   if(isset($templatelist))
   {
       $templatelist .= ',';
   }
   $templatelist .= 'forumdisplay_thread_description,forumdisplay_thread_description_2,forumdisplay_thread_description_3,forumdisplay_thread_description_4';
}

// Tell MyBB when to run the hooks
$plugins->add_hook("forumdisplay_thread", "threaddescription_forum_description");
$plugins->add_hook("showthread_start", "threaddescription_description");
$plugins->add_hook("search_results_thread", "threaddescription_forum_description");
$plugins->add_hook("newthread_start", "threaddescription_newthread");
$plugins->add_hook("newthread_do_newthread_end", "threaddescription_do_newthread");
$plugins->add_hook("editpost_end", "threaddescription_editpost");
$plugins->add_hook("editpost_do_editpost_end", "threaddescription_do_editpost");

// The information that shows up on the plugin manager
function threaddescription_info()
{
   return array(
       "name"                => "Thread Description",
       "description"        => "Allows users to enter a short description underneath the thread subject.",
       "website"            => "http://galaxiesrealm.com/index.php",
       "author"            => "Starpaul20",
       "authorsite"        => "http://galaxiesrealm.com/index.php",
       "version"            => "1.0",
       "guid"                => "c8ec620e5d6ef6208474dcba023d2219",
       "compatibility"        => "18*"
   );
}

// This function runs when the plugin is installed.
function threaddescription_install()
{
   global $db;
   threaddescription_uninstall();

   $db->add_column("threads", "description", "varchar(240) NOT NULL AFTER subject");
   $db->add_column("threads", "description_2", "varchar(240) NOT NULL AFTER subject");
   $db->add_column("threads", "description_3", "varchar(240) NOT NULL AFTER subject");
   $db->add_column("threads", "description_4", "varchar(240) NOT NULL AFTER subject");
}

// Checks to make sure plugin is installed
function threaddescription_is_installed()
{
   global $db;
   if($db->field_exists("description", "threads"))
   {
       return true;
   }
   return false;
   
   if($db->field_exists("description_2", "threads"))
   {
       return true;
   }
   return false;

if($db->field_exists("description_3", "threads"))
   {
       return true;
   }
   return false;

if($db->field_exists("description_4", "threads"))
   {
       return true;
   }
   return false;
}

// This function runs when the plugin is uninstalled.
function threaddescription_uninstall()
{
   global $db;
   if($db->field_exists("description", "threads"))
   {
       $db->drop_column("threads", "description");
   }
   
   if($db->field_exists("description_2", "threads"))
   {
       $db->drop_column("threads", "description_2");
   }
if($db->field_exists("description_3", "threads"))
   {
       $db->drop_column("threads", "description_3");
   }
if($db->field_exists("description_4", "threads"))
   {
       $db->drop_column("threads", "description_4");
   }
}

// This function runs when the plugin is activated.
function threaddescription_activate()
{
   global $db;

   $insert_array = array(
       'title'        => 'description',
       'template'    => $db->escape_string('<tr>
<td class="trow2"><strong>{$lang->description}1</strong></td>
<td class="trow2"><input type="text" class="textbox" name="description" size="40" maxlength="240" value="{$description}" tabindex="2" /></td>
</tr>'),
       'sid'        => '-1',
       'version'    => '',
       'dateline'    => TIME_NOW
   );
   $db->insert_query("templates", $insert_array);

   $insert_array = array(
       'title'        => 'forumdisplay_thread_description',
       'template'    => $db->escape_string('<em><span class="smalltext" style="background: url(\'images/nav_bit.gif\') no-repeat left; padding-left: 18px;">{$description}</span></em><br />'),
       'sid'        => '-1',
       'version'    => '',
       'dateline'    => TIME_NOW
   );
   $db->insert_query("templates", $insert_array);
   
   $insert_array = array(
       'title'        => 'description_2',
       'template'    => $db->escape_string('<tr>
<td class="trow2"><strong>{$lang->description}2</strong></td>
<td class="trow2"><input type="text" class="textbox" name="description_2" size="40" maxlength="240" value="{$description_2}" tabindex="2" /></td>
</tr>'),
       'sid'        => '-1',
       'version'    => '',
       'dateline'    => TIME_NOW
   );
   $db->insert_query("templates", $insert_array);

   $insert_array = array(
       'title'        => 'forumdisplay_thread_description_2',
       'template'    => $db->escape_string('<em><span class="smalltext" style="background: url(\'images/nav_bit.gif\') no-repeat left; padding-left: 18px;">{$description_2}</span></em><br />'),
       'sid'        => '-1',
       'version'    => '',
       'dateline'    => TIME_NOW
   );
   $db->insert_query("templates", $insert_array);

$insert_array = array(
       'title'        => 'description_3',
       'template'    => $db->escape_string('<tr>
<td class="trow2"><strong>{$lang->description}3</strong></td>
<td class="trow2"><input type="text" class="textbox" name="description_3" size="40" maxlength="240" value="{$description_3}" tabindex="2" /></td>
</tr>'),
       'sid'        => '-1',
       'version'    => '',
       'dateline'    => TIME_NOW
   );
   $db->insert_query("templates", $insert_array);

   $insert_array = array(
       'title'        => 'forumdisplay_thread_description_3',
       'template'    => $db->escape_string('<em><span class="smalltext" style="background: url(\'images/nav_bit.gif\') no-repeat left; padding-left: 18px;">{$description_3}</span></em><br />'),
       'sid'        => '-1',
       'version'    => '',
       'dateline'    => TIME_NOW
   );
   $db->insert_query("templates", $insert_array);

$insert_array = array(
       'title'        => 'description_4',
       'template'    => $db->escape_string('<tr>
<td class="trow2"><strong>{$lang->description}4</strong></td>
<td class="trow2"><input type="text" class="textbox" name="description_4" size="40" maxlength="240" value="{$description_4}" tabindex="2" /></td>
</tr>'),
       'sid'        => '-1',
       'version'    => '',
       'dateline'    => TIME_NOW
   );
   $db->insert_query("templates", $insert_array);

   $insert_array = array(
       'title'        => 'forumdisplay_thread_description_4',
       'template'    => $db->escape_string('<em><span class="smalltext" style="background: url(\'images/nav_bit.gif\') no-repeat left; padding-left: 18px;">{$description_4}</span></em><br />'),
       'sid'        => '-1',
       'version'    => '',
       'dateline'    => TIME_NOW
   );
   $db->insert_query("templates", $insert_array);

   include MYBB_ROOT."/inc/adminfunctions_templates.php";
   find_replace_templatesets("editpost", "#".preg_quote('{$posticons}')."#i", '{$threaddescription}{$threaddescription_2}{$threaddescription_3}{$threaddescription_4}{$posticons}');
   find_replace_templatesets("newthread", "#".preg_quote('{$posticons}')."#i", '{$threaddescription}{$threaddescription_2}{$threaddescription_3}{$threaddescription_4}{$posticons}');
   find_replace_templatesets("showthread", "#".preg_quote('{$thread[\'subject\']}</strong>')."#i", '{$thread[\'subject\']}</strong><br />{$thread[\'description\']}<br />{$thread[\'description_2\']}<br />{$thread[\'description_3\']}<br />{$thread[\'description_4\']}');
   find_replace_templatesets("forumdisplay_thread", "#".preg_quote('{$thread[\'profilelink\']}')."#i", '{$thread[\'description\']}{$thread[\'description_2\']}{$thread[\'description_3\']}{$thread[\'description_4\']}{$thread[\'profilelink\']}');
   find_replace_templatesets("search_results_threads_thread", "#".preg_quote('{$thread[\'profilelink\']}')."#i", '{$thread[\'description\']}{$thread[\'description_2\']}{$thread[\'description_3\']}{$thread[\'description_4\']}{$thread[\'profilelink\']}');

}



// This function runs when the plugin is deactivated.
function threaddescription_deactivate()
{
   global $db;
   $db->delete_query("templates", "title IN('description','forumdisplay_thread_description','description_2','forumdisplay_thread_description_2','description_3','forumdisplay_thread_description_3','description_4','forumdisplay_thread_description_4')");

   include MYBB_ROOT."/inc/adminfunctions_templates.php";
   find_replace_templatesets("forumdisplay_thread", "#".preg_quote('{$thread[\'description\']}{$thread[\'description_2\']}{$thread[\'description_3\']}{$thread[\'description_4\']}')."#i", '', 0);
   find_replace_templatesets("search_results_threads_thread", "#".preg_quote('{$thread[\'description\']}{$thread[\'description_2\']}{$thread[\'description_3\']}{$thread[\'description_4\']}')."#i", '', 0);
   find_replace_templatesets("showthread", "#".preg_quote('<br />{$thread[\'description\']}<br />{$thread[\'description_2\']}<br />{$thread[\'description_3\']}<br />{$thread[\'description_4\']}')."#i", '', 0);
   find_replace_templatesets("newthread", "#".preg_quote('{$threaddescription}{$threaddescription_2}{$threaddescription_3}{$threaddescription_4}')."#i", '', 0);
   find_replace_templatesets("editpost", "#".preg_quote('{$threaddescription}{$threaddescription_2}{$threaddescription_3}{$threaddescription_4}')."#i", '', 0);

}

// Show description on forumdisplay and search results
function threaddescription_forum_description()
{
   global $thread, $templates;
   if($thread['description'])
   {
       $description = htmlspecialchars_uni($thread['description']);

       eval("\$thread['description'] = \"".$templates->get("forumdisplay_thread_description")."\";");
   }
   
   if($thread['description_2'])
   {
       $description_2 = htmlspecialchars_uni($thread['description_2']);

       eval("\$thread['description_2'] = \"".$templates->get("forumdisplay_thread_description_2")."\";");
   }
   
   if($thread['description_3'])
   {
       $description_3 = htmlspecialchars_uni($thread['description_3']);

       eval("\$thread['description_3'] = \"".$templates->get("forumdisplay_thread_description_3")."\";");
   }
   
   if($thread['description_4'])
   {
       $description_4 = htmlspecialchars_uni($thread['description_4']);

       eval("\$thread['description_4'] = \"".$templates->get("forumdisplay_thread_description_4")."\";");
   }
}

// Show description on showthread
function threaddescription_description()
{
   global $thread;
   if($thread['description'])
   {
       $description = htmlspecialchars_uni($thread['description']);
       $thread['description'] = "<em><span class=\"smalltext\">{$description}</span></em>";
   }
   
   if($thread['description_2'])
   {
       $description_2 = htmlspecialchars_uni($thread['description_2']);
       $thread['description_2'] = "<em><span class=\"smalltext\">{$description_2}</span></em>";
   }
   
   if($thread['description_3'])
   {
       $description_3 = htmlspecialchars_uni($thread['description_3']);
       $thread['description_3'] = "<em><span class=\"smalltext\">{$description_3}</span></em>";
   }
   
   if($thread['description_4'])
   {
       $description_4 = htmlspecialchars_uni($thread['description_4']);
       $thread['description_4'] = "<em><span class=\"smalltext\">{$description_4}</span></em>";
   }
}

// Add description on new thread
function threaddescription_newthread()
{
   global $db, $lang, $mybb, $templates, $post_errors, $thread, $threaddescription, $description, $threaddescription_2, $description_2, $threaddescription_3, $description_3, $threaddescription_4, $description_4;
   $lang->load("description");

   if($mybb->input['previewpost'] || $post_errors)
   {
       $description = htmlspecialchars_uni($mybb->input['description']);
   }
   else
   {
       $description = htmlspecialchars_uni($thread['description']);
   }

   eval("\$threaddescription = \"".$templates->get("description")."\";");
   
   if($mybb->input['previewpost'] || $post_errors)
   {
       $description_2 = htmlspecialchars_uni($mybb->input['description_2']);
   }
   else
   {
       $description_2 = htmlspecialchars_uni($thread['description_2']);
   }

   eval("\$threaddescription_2 = \"".$templates->get("description_2")."\";");
   
   
   if($mybb->input['previewpost'] || $post_errors)
   {
       $description_3 = htmlspecialchars_uni($mybb->input['description_3']);
   }
   else
   {
       $description_3 = htmlspecialchars_uni($thread['description_3']);
   }

   eval("\$threaddescription_3 = \"".$templates->get("description_3")."\";");
   
   if($mybb->input['previewpost'] || $post_errors)
   {
       $description_4 = htmlspecialchars_uni($mybb->input['description_4']);
   }
   else
   {
       $description_4 = htmlspecialchars_uni($thread['description_4']);
   }

   eval("\$threaddescription_4 = \"".$templates->get("description_4")."\";");
}

// Add description
function threaddescription_do_newthread()
{
   global $db, $mybb, $tid;

   $description = array(
       "description" => $db->escape_string($mybb->input['description'])
   );
   $db->update_query("threads", $description, "tid='{$tid}'");
   
   $description_2 = array(
       "description_2" => $db->escape_string($mybb->input['description_2'])
   );
   $db->update_query("threads", $description_2, "tid='{$tid}'");
   
   $description_3 = array(
       "description_3" => $db->escape_string($mybb->input['description_3'])
   );
   $db->update_query("threads", $description_3, "tid='{$tid}'");
   
   $description_4 = array(
       "description_4" => $db->escape_string($mybb->input['description_4'])
   );
   $db->update_query("threads", $description_4, "tid='{$tid}'");
}

// Show description on edit page
function threaddescription_editpost()
{
   global $db, $lang, $mybb, $post, $thread, $templates, $post_errors, $threaddescription, $description, $threaddescription_2, $description_2, $threaddescription_3, $description_3, $threaddescription_4, $description_4;
   $lang->load("description");

   if($thread['firstpost'] == $mybb->input['pid'])
   {
       if($mybb->input['previewpost'] || $post_errors)
       {
           $description = htmlspecialchars_uni($mybb->input['description']);
       }
       else
       {
           $description = htmlspecialchars_uni($thread['description']);
       }

       eval("\$threaddescription = \"".$templates->get("description")."\";");
   }
   
   if($thread['firstpost'] == $mybb->input['pid'])
   {
       if($mybb->input['previewpost'] || $post_errors)
       {
           $description_2 = htmlspecialchars_uni($mybb->input['description_2']);
       }
       else
       {
           $description_2 = htmlspecialchars_uni($thread['description_2']);
       }

       eval("\$threaddescription_2 = \"".$templates->get("description_2")."\";");
       
       if($mybb->input['previewpost'] || $post_errors)
       {
           $description_3 = htmlspecialchars_uni($mybb->input['description_3']);
       }
       else
       {
           $description_3 = htmlspecialchars_uni($thread['description_3']);
       }

       eval("\$threaddescription_3 = \"".$templates->get("description_3")."\";");
       
       
       if($mybb->input['previewpost'] || $post_errors)
       {
           $description_4 = htmlspecialchars_uni($mybb->input['description_4']);
       }
       else
       {
           $description_4 = htmlspecialchars_uni($thread['description_4']);
       }

       eval("\$threaddescription_4 = \"".$templates->get("description_4")."\";");
   }
}

// Update description
function threaddescription_do_editpost()
{
   global $db, $mybb, $tid;

   $description = array(
       "description" => $db->escape_string($mybb->input['description'])
   );
   $db->update_query("threads", $description, "tid='{$tid}'");
   
   $description_2 = array(
       "description_2" => $db->escape_string($mybb->input['description_2'])
   );
   $db->update_query("threads", $description_2, "tid='{$tid}'");
   
   $description_3 = array(
       "description_3" => $db->escape_string($mybb->input['description_3'])
   );
   $db->update_query("threads", $description_3, "tid='{$tid}'");
   
   $description_4 = array(
       "description_4" => $db->escape_string($mybb->input['description_4'])
   );
   $db->update_query("threads", $description_4, "tid='{$tid}'");
}

?>

Code:
Template "description_2"

<tr>
<td class="trow2"><strong>{$lang->description_2}</strong></td>
<td class="trow2"><input type="text" class="textbox" name="description_2" size="40" maxlength="240" value="{$description_2}" tabindex="2" /></td>
</tr>
<br>

Code:
Template "forumdisplay_thread_description_2"

<em><span class="smalltext" style="padding-left: 18px;">{$description_2}</span></em><br>

Code:
Template "showtread_description"

<em><span class="smalltext">{$description}</span></em><br>

<em><span class="smalltext">{$description_2}</span></em>


Ich verzweifel hier langsam.
Zitieren


Nachrichten in diesem Thema
Thread Description: Zweites Beschreibungsfeld - von BatemansAxe - 17.09.2017, 19:53

Möglicherweise verwandte Themen…
Thema Verfasser Antworten Ansichten Letzter Beitrag
  Moderation der "thread description" modercol 0 1.230 03.04.2007, 09:39
Letzter Beitrag: modercol