Hallo, Gast! (Registrieren)

Wir wünschen allen Besuchern frohe Ostern!

Letzte Ankündigung: MyBB 1.8.37 veröffentlicht (04.11.23)


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste
Prefix Manager Einträge über die Suche nicht zu finden
#1
Hallo,

Ich teste gerade den Prefix Manager, und stelle gerade fest, dass die Prefixe, die vor den Betreff geschrieben werden, NICHT über die Suchfunktion gefunden werden. Beispiel: Prefix - [ANFRAGE] , dann findet man über die Suche keinen einzigen Treffer, der das Wort "Anfrage" beinhaltet.

Wie kann ich das Problem lösen?

Danke im voraus Rolleyes
Zitieren
#2
Du müsstest in der search.php Änderungen vornehmen, damit auch die Spalte mit den Präfixen in der Tabelle threads durchsucht wird.

Gruß,
Michael
[Bild: banner.png]
Support erfolgt NUR im Forum!
Bitte gelöste Themen als "erledigt" markieren.
Beiträge mit mangelhafter Rechtschreibung/Grammatik werden kommentarlos gelöscht.
Zitieren
#3
Hallo Michael,

das braucht er nicht mal. Es arbeitet für die Anzeige der Präfixe nämlich genau so, wie dein 'Thema erledigt'-Plugin. Beide zeigen vor dem Threadtitel etwas zusätzliches an.

@Axxis: Orientiere dich an die 'Thema erledigt'-Plugin. Dieses zeigt nämlich auch in den Suchergebnissen vor dem Threadtitel etwas an (in diesne Fall ist es zwar eine Grafik, aber das macht ja keinen Unterschied).
Zitieren
#4
(14.07.2009, 11:24)querschlaeger schrieb: Es arbeitet für die Anzeige der Präfixe nämlich genau so, wie dein 'Thema erledigt'-Plugin. Beide zeigen vor dem Threadtitel etwas zusätzliches an.
Ich dachte es geht nicht (nur) um die Anzeige. So wie ich das verstanden habe soll auch nach Präfixen gesucht werden können. Dunno

Gruß,
Michael
[Bild: banner.png]
Support erfolgt NUR im Forum!
Bitte gelöste Themen als "erledigt" markieren.
Beiträge mit mangelhafter Rechtschreibung/Grammatik werden kommentarlos gelöscht.
Zitieren
#5
(15.07.2009, 00:53)Michael schrieb: Ich dachte es geht nicht (nur) um die Anzeige. So wie ich das verstanden habe soll auch nach Präfixen gesucht werden können. Dunno

Korrekt. Erstmal Danke für die Antworten bis jetzt. Ich habe z.B. folgendes Plugin drin, wodurch auch etwas vor den Beitragnamen geschrieben wird:
http://mods.mybboard.net/view/my-question

In diesem Fall kann ein Threadersteller seinen eigenen Thread schliessen, und es wird automatisch [ERLEDIGT] vor den Threadtitel geschrieben. Dieses "Erledigt" kann man dann auch über die Suche finden.

So sieht die php von dem Plugin aus:

PHP-Code:
<?php
/**
 * My Question
 * Copyright 2008 Unlimited020
 */

// 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.");
}

$plugins->add_hook('showthread_start''myquestion_run');

function 
myquestion_info()
{
    return array(
        
'name'            => 'My Question',
        
'description'    => 'Allows thread authors and staff to lock a topic, and declare it as SOLVED.',
        
'website'        => 'http://mods.mybboard.net/view/my-question',
        
'author'        => 'Unlimited020',
        
'authorsite'    => 'http://community.mybboard.net/user-15817.html',
        
'version'        => '1.3',
        
'compatibility'    => '14*',
        
'guid'            => '7e02446603d3ae12a44302d97b03c8fc'
    
);
}

function 
myquestion_activate()
{
    global 
$db;
    
$db->query('ALTER TABLE '.$db->table_prefix.'threads ADD (
        `solved` BIGINT(30) UNSIGNED NOT NULL DEFAULT 0
    )'
);
    
$db->query('ALTER TABLE '.$db->table_prefix.'threads ADD (
        `oldfid` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0
    )'
);
    
$db->query('ALTER TABLE '.$db->table_prefix.'threads ADD (
        `oldsubject` VARCHAR(120) NOT NULL DEFAULT 0
    )'
);
    
    
    require 
MYBB_ROOT."/inc/adminfunctions_templates.php";
    
find_replace_templatesets('showthread''#'.preg_quote('{$thread[\'subject\']}</strong>').'#''{$thread[\'subject\']}</strong>{$myquestion}');
    
    
$new_template ' (<a href="showthread.php?tid={$tid}&amp;action=solve">Close and mark thread as solved</a>) | (<a href="showthread.php?tid={$tid}&amp;action=unsolve">Mark thread as unsolved</a>)';
    
$db->insert_query('templates', array(
        
'title' => 'showthread_myquestion',
        
'template' => $db->escape_string($new_template),
        
'sid' => -1,
        
'version' => 120
    
));
    
    
    
// add settings
    
$settings_gid $db->insert_query('settinggroups', array(
        
'name' => 'myquestion',
        
'title' => 'My Question Options',
        
'disporder' => 50,
    ));
    
$db->insert_query('settings', array(
        
'name' => 'myquestion_enable',
        
'optionscode' => 'yesno',
        
'value' => 1,
        
'title' => 'Enable?',
        
'description' => 'Globally, enable the My Question system? (You can disable it here without losing your settings).',
        
'disporder' => 1,
        
'gid' => $settings_gid
    
));
    
$db->insert_query('settings', array(
        
'name' => 'myquestion_disabled',
        
'optionscode' => 'text',
        
'value' => 'The Administrator has disabled this feature.',
        
'title' => 'Text when disabled',
        
'description' => 'When the plugin is disabled, and the user visits the (un)solve URL, what should it output?',
        
'disporder' => 2,
        
'gid' => $settings_gid
    
));
    
$db->insert_query('settings', array(
        
'name' => 'myquestion_moveforum',
        
'optionscode' => 'text',
        
'value' => '',
        
'title' => 'Move solved thread',
        
'description' => 'If you prefer that the solved thread will be moved to another forum instead of adding a prefix to it, specify that forum here. (Leave blank to ignore this setting, only enter the forum ID).',
        
'disporder' => 3,
        
'gid' => $settings_gid
    
));
    
$db->insert_query('settings', array(
        
'name' => 'myquestion_prefixsolved',
        
'optionscode' => 'text',
        
'value' => '[SOLVED] ',
        
'title' => 'Thread prefix when solved',
        
'description' => 'When the thread is marked as solved, what will the prefix be? (Will be ignored if you filled in the previous setting).',
        
'disporder' => 4,
        
'gid' => $settings_gid
    
));
    
$db->insert_query('settings', array(
        
'name' => 'myquestion_threadsolved',
        
'optionscode' => 'text',
        
'value' => 'This thread is already solved!',
        
'title' => 'Thread already solved',
        
'description' => 'When the thread is already solved, what should it output?',
        
'disporder' => 5,
        
'gid' => $settings_gid
    
));
    
$db->insert_query('settings', array(
        
'name' => 'myquestion_threadunsolved',
        
'optionscode' => 'text',
        
'value' => 'This thread is already unsolved!',
        
'title' => 'Thread already unsolved',
        
'description' => 'When the thread is already unsolved, what should it output?',
        
'disporder' => 6,
        
'gid' => $settings_gid
    
));
    
$db->insert_query('settings', array(
        
'name' => 'myquestion_redirectsolved',
        
'optionscode' => 'text',
        
'value' => 'Thread Solved',
        
'title' => 'Text when redirecting',
        
'description' => 'During the redirect, when the thread is marked as solved, what should it output?',
        
'disporder' => 7,
        
'gid' => $settings_gid
    
));
    
$db->insert_query('settings', array(
        
'name' => 'myquestion_redirectunsolved',
        
'optionscode' => 'text',
        
'value' => 'Thread Unsolved',
        
'title' => 'Text when redirecting (unsolved)',
        
'description' => 'During the redirect, when the thread is marked as unsolved, what should it output?',
        
'disporder' => 8,
        
'gid' => $settings_gid
    
));
    
$db->insert_query('settings', array(
        
'name' => 'myquestion_forums',
        
'optionscode' => 'text',
        
'value' => '',
        
'title' => 'Enable in specific forums',
        
'description' => 'Enable the plugin in specific forums? (Separated by commas without spaces, only enter the forum ID, leave blank to use in all forums).',
        
'disporder' => 9,
        
'gid' => $settings_gid
    
));
    
$db->insert_query('settings', array(
        
'name' => 'myquestion_forumdisabled',
        
'optionscode' => 'text',
        
'value' => 'The Administrator has disabled this feature for this forum.',
        
'title' => 'Text when disabled in forum',
        
'description' => 'When the plugin is enabled in specific forums, and the user visits the (un)solve URL in a wrong forum, what should it output?',
        
'disporder' => 10,
        
'gid' => $settings_gid
    
));

    
rebuild_settings();
}

function 
myquestion_deactivate()
{
    require 
MYBB_ROOT."/inc/adminfunctions_templates.php";
    
find_replace_templatesets('showthread''#\{\$myquestion\}#'''0);
    
    global 
$db;
    
$db->delete_query('templates''title = "showthread_myquestion"');
    
    
$db->query('ALTER TABLE '.$db->table_prefix.'threads DROP `solved`');
    
$db->query('ALTER TABLE '.$db->table_prefix.'threads DROP `oldfid`');
    
$db->query('ALTER TABLE '.$db->table_prefix.'threads DROP `oldsubject`');
    
    
$gid $db->fetch_field($db->simple_select('settinggroups''gid''name="myquestion"'), 'gid');
    if(
$gid)
    {
        
$db->delete_query('settings''gid='.$gid);
        
$db->delete_query('settinggroups''gid='.$gid);
    }
    
rebuild_settings();
}

function 
myquestion_run()
{
    global 
$mybb$thread$db;
    
$arr split(','$mybb->settings['myquestion_forums']);
    if(
$mybb->input['action'] == 'solve')
    {
        if(
$mybb->usergroup['cancp'] != && $mybb->usergroup['issupermod'] != && $thread['uid'] != $mybb->user['uid'])
        {
            
error_no_permission();
        }
        elseif(
$thread['solved'] == 1)
        {
            
error($mybb->settings['myquestion_threadsolved']);
        }
        elseif(
$mybb->settings['myquestion_enable'] == 0)
        {
            
error($mybb->settings['myquestion_disabled']);
        }
        elseif(!
in_array($thread['fid'], $arr) && $mybb->settings['myquestion_forums'] != "")
        {
            
error($mybb->settings['myquestion_forumdisabled']);
        }
        elseif(
$mybb->settings['myquestion_moveforum'] != "")
        {
            
$db->update_query('threads', array('solved' => 1), 'tid='.$thread['tid']);
            
$db->update_query('threads', array('closed' => 1), 'tid='.$thread['tid']);
            
$db->update_query('threads', array('oldfid' => $thread['fid']), 'tid='.$thread['tid']);
            
$db->update_query('threads', array('fid' => $mybb->settings['myquestion_moveforum']), 'tid='.$thread['tid']);
            
$db->update_query('posts', array('fid' => $mybb->settings['myquestion_moveforum']), 'tid='.$thread['tid']);
            
redirect('showthread.php?tid='.$thread['tid'], $mybb->settings['myquestion_redirectsolved']);
        } else {
            
$db->update_query('threads', array('solved' => 1), 'tid='.$thread['tid']);
            
$db->update_query('threads', array('closed' => 1), 'tid='.$thread['tid']);
            
$db->update_query('threads', array('oldsubject' => $thread['subject']), 'tid='.$thread['tid']);
            
$thread_title $thread['subject'];
            
$thread_title_new $mybb->settings['myquestion_prefixsolved'] . $thread_title;
            
$db->update_query('threads', array('subject' => $thread_title_new), 'tid='.$thread['tid']);
            
$db->update_query('posts', array('subject' => $thread_title_new), 'tid='.$thread['tid']);
            
redirect('showthread.php?tid='.$thread['tid'], $mybb->settings['myquestion_redirectsolved']);
        }
    }
    elseif(
$mybb->input['action'] == 'unsolve')
    {
        if(
$mybb->usergroup['cancp'] != && $mybb->usergroup['issupermod'] != && $thread['uid'] != $mybb->user['uid'])
        {
            
error_no_permission();
        }
        elseif(
$thread['solved'] == 0)
        {
            
error($mybb->settings['myquestion_threadunsolved']);
        }
        elseif(
$mybb->settings['myquestion_enable'] == 0)
        {
            
error($mybb->settings['myquestion_disabled']);
        }
        elseif(!
in_array($thread['fid'], $arr) && $mybb->settings['myquestion_forums'] != "")
        {
            
error($mybb->settings['myquestion_forumdisabled']);
        }
        elseif(
$mybb->settings['myquestion_moveforum'] != "")
        {
            
$db->update_query('threads', array('solved' => 0), 'tid='.$thread['tid']);
            
$db->update_query('threads', array('closed' => 0), 'tid='.$thread['tid']);
            
$db->update_query('threads', array('fid' => $thread['oldfid']), 'tid='.$thread['tid']);
            
$db->update_query('posts', array('fid' => $thread['oldfid']), 'tid='.$thread['tid']);
            
redirect('showthread.php?tid='.$thread['tid'], $mybb->settings['myquestion_redirectunsolved']);
        } else {
            
$db->update_query('threads', array('solved' => 0), 'tid='.$thread['tid']);
            
$db->update_query('threads', array('closed' => 0), 'tid='.$thread['tid']);
            
$db->update_query('threads', array('subject' => $thread['oldsubject']), 'tid='.$thread['tid']);
            
$db->update_query('posts', array('subject' => $thread['oldsubject']), 'tid='.$thread['tid']);
            
redirect('showthread.php?tid='.$thread['tid'], $mybb->settings['myquestion_redirectunsolved']);
        }
    }
    else
    {
        if(
$mybb->usergroup['cancp'] == || $mybb->usergroup['issupermod'] == || $thread['uid'] == $mybb->user['uid'])
        {
            if(
in_array($thread['fid'], $arr) || $mybb->settings['myquestion_forums'] == "")
            {
                if(
$mybb->settings['myquestion_enable'] == 1)
                {
                    global 
$myquestion$templates$tid;
                    eval(
'$myquestion = "'.$templates->get('showthread_myquestion').'";');
                }
            }
        }
    }
}

?>


Nur die Prefixe erscheinen fett gedruckt vor dem Titel, und sind eben NICHT über die Suche zu finden. Bin leider noch nicht so fit mit solchen Änderungen.

Hier mal die Prefix php:

PHP-Code:
<?php

function prefix_info()
{
    return array(
        
"name"        => "Prefix-Plugin",
        
"description" => "adds a prefix before the thread-subject",
        
"website"     => "http://mods.mybboard.net",
        
"author"      => "XxAnimusxX",
        
"authorsite"  => "http://www.k-under.de",
        
"version"     => "1.0",
        
"guid"        => "3fb2b1ec27e31aa2b05bb8d444bfda55",
        
"compatibility" => "14*"
        
);
}

$plugins->add_hook("forumdisplay_thread""addPrefix_forumdisplay");
$plugins->add_hook("newthread_end""addPrefix_newthread");
$plugins->add_hook("editpost_end""addPrefix_editpost");
$plugins->add_hook("editpost_do_editpost_start""savePrefix_editpost");
$plugins->add_hook("newthread_do_newthread_end""savePrefix_newthread");

$plugins->add_hook("admin_config_menu""prefix_toolsmenu");
$plugins->add_hook("admin_config_action_handler""prefix_actionhandler");


function 
prefix_toolsmenu($sub_menu)
{
        
$sub_menu[] = array(
                      
"id" => "prefix",
                      
"title" => "Prefix-Manager",
                      
"link" => "index.php?module=config/prefix"
                      
);
}



function 
prefix_actionhandler($action)
{
        
$action['prefix'] = array('active' => 'prefix''file' => 'prefix.php');
}



function 
prefix_is_installed()
{
        global 
$db;

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



function 
prefix_install()
{
        global 
$db;

        
$db->query("ALTER TABLE ".TABLE_PREFIX."threads ADD prefix VARCHAR(126) NOT NULL");

        
$find preg_quote("{\$gotounread}");
        
$replace "{\$gotounread}{\$thread['prefix']}";
        
prefix_replace_templatesets("forumdisplay_thread"$find$replace);

        
$find preg_quote("trow2\"><input");
        
$replace "trow2\">{\$prefix_menu}<input";
        
prefix_replace_templatesets("newthread"$find$replace);
        
prefix_replace_templatesets("editpost"$find$replace);

        
$db->query("CREATE TABLE ".TABLE_PREFIX."prefix (
                           pid INT UNSIGNED NOT NULL AUTO_INCREMENT,
                           title VARCHAR(126) NOT NULL,
                           fid TEXT NOT NULL,
                           gid TEXT NOT NULL,
                           PRIMARY KEY (pid)
        )"
);
}



function 
prefix_uninstall()
{
        global 
$db;

        
$db->query("ALTER TABLE ".TABLE_PREFIX."threads DROP prefix");

        
$find preg_quote("{\$gotounread}{\$thread['prefix']}");
        
$replace "{\$gotounread}";
        
prefix_replace_templatesets("forumdisplay_thread"$find$replace);

        
$find preg_quote("trow2\">{\$prefix_menu}<input");
        
$replace "trow2\"><input";
        
prefix_replace_templatesets("newthread"$find$replace);
        
prefix_replace_templatesets("editpost"$find$replace);

        
$db->query("DROP TABLE ".TABLE_PREFIX."prefix");
}



function 
addPrefix_forumdisplay()
{
        global 
$thread;

        if (
$thread['prefix'])
        {
                
$thread['prefix'] = "<strong>[".$thread['prefix']."]</strong> ";
        }
}



function 
addPrefix_newthread()
{
        global 
$prefix_menu$fid;

        
$prefix_menu build_prefixmenu($fid);
}



function 
addPrefix_editpost()
{
        global 
$thread$fid$pid$prefix_menu;

        if (
$thread['firstpost'] != $pid) return false;
        
$prefix_menu build_prefixmenu($fid$thread['prefix']);
}



function 
savePrefix_editpost()
{
        global 
$mybb$thread$db;

        
$pid intval($mybb->input['prefix']);
        if (!
$thread['prefix'] && !$pid) return false;

        
$prefix $db->fetch_array($db->simple_select("prefix""title""pid=".$pid));

        if ((
$prefix['title'] == $thread['prefix']) || (!$prefix['title'] && $pid)) return false;
        
$db->update_query("threads", array("prefix"=>$prefix['title']), "tid=".$thread['tid']);
}



function 
savePrefix_newthread()
{
        global 
$mybb$db$tid;

        
$pid intval($mybb->input['prefix']);
        if (!
$pid) return false;

        
$prefix $db->fetch_array($db->simple_select("prefix""title""pid=".$pid));
        if (!
$prefix['title']) return false;

        
$db->update_query("threads", array("prefix"=>$prefix['title']), "tid=".$tid);
}



function 
build_prefixmenu($fid 0$selected "")
{
        global 
$mybb$db;
        if (!
$fid) return false;

        
$query $db->simple_select("prefix");
        
$menu "";
        while (
$prefix $db->fetch_array($query))
        {
                
$checked "";
                
$gids explode(","$prefix['gid']);
                
$fids explode(","$prefix['fid']);

                
$group in_array($mybb->user['usergroup'], $gids);
                if ((
in_array($fid$fids) && $group) || (!$prefix['fid'] && $group))
                {
                        if (
$prefix['title'] == $selected$checked " selected";
                        
$menu.="<option value=\"".$prefix['pid']."\"".$checked.">".$prefix['title']."</option>";
                }
        }

        if (
$menu)
        {
                return 
"<select name='prefix'><option value=\"0\"></option>".$menu."</select> ";
        }
}



function 
prefix_replace_templatesets($template$find$replace)
{
        global 
$db;

        
$query $db->simple_select("templates""template, tid""title='".$template."'");
        while (
$template $db->fetch_array($query))
        {
                
$tid $template['tid']; $body $template['template'];
                
$body preg_replace("!".$find."!"$replace$body);

                
$db->update_query("templates", array("template" => $db->escape_string($body)), "tid=".$tid);
        }
}

?>


Weiss da leider echt nicht weiter, wo ich jetzt was ändern sollte.
Oder die search.php anpassen? Weiss leider auch nicht wie und wo! Help Rolleyes
Zitieren
#6
(15.07.2009, 00:53)Michael schrieb: Ich dachte es geht nicht (nur) um die Anzeige. So wie ich das verstanden habe soll auch nach Präfixen gesucht werden können. Dunno

Sorry, habs falsch verstanden. Danke für die Aufklärung.
Zitieren
#7
Ich pushe echt ungerne, aber das Problem brennt ein wenig.

Kann mir niemand helfen? Sad
Zitieren
#8
Da sind wohl einige Änderungen notwendig.
[Bild: banner.png]

Bitte die Foren-Regeln beachten und im Profil die verwendete MyBB-Version angeben.
Zitieren
#9
(19.07.2009, 11:49)StefanT schrieb: Da sind wohl einige Änderungen notwendig.

Naja, ich bin Anfänger und kann das nicht beurteilen. Nur so komm ich leider auch nicht weiter.

Nochmal das was ich eigentlich brauch:

Das Plugin (hat ja ne relativ kleine php) soll die prefixe nicht VOR den Betreff-Titel schreiben, sondern IN den Beitragsnamen. Dann würde man die Prefixe auch über die Suche finden.

könnt Ihr euch die php noch mal ansehen?

PHP-Code:
<?php

function prefix_info()
{
    return array(
        
"name"        => "Prefix-Plugin",
        
"description" => "adds a prefix before the thread-subject",
        
"website"     => "http://mods.mybboard.net",
        
"author"      => "XxAnimusxX",
        
"authorsite"  => "http://www.k-under.de",
        
"version"     => "1.0",
        
"guid"        => "3fb2b1ec27e31aa2b05bb8d444bfda55",
        
"compatibility" => "14*"
        
);
}

$plugins->add_hook("forumdisplay_thread""addPrefix_forumdisplay");
$plugins->add_hook("newthread_end""addPrefix_newthread");
$plugins->add_hook("editpost_end""addPrefix_editpost");
$plugins->add_hook("editpost_do_editpost_start""savePrefix_editpost");
$plugins->add_hook("newthread_do_newthread_end""savePrefix_newthread");

$plugins->add_hook("admin_config_menu""prefix_toolsmenu");
$plugins->add_hook("admin_config_action_handler""prefix_actionhandler");


function 
prefix_toolsmenu($sub_menu)
{
        
$sub_menu[] = array(
                      
"id" => "prefix",
                      
"title" => "Prefix-Manager",
                      
"link" => "index.php?module=config/prefix"
                      
);
}



function 
prefix_actionhandler($action)
{
        
$action['prefix'] = array('active' => 'prefix''file' => 'prefix.php');
}



function 
prefix_is_installed()
{
        global 
$db;

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



function 
prefix_install()
{
        global 
$db;

        
$db->query("ALTER TABLE ".TABLE_PREFIX."threads ADD prefix VARCHAR(126) NOT NULL");

        
$find preg_quote("{\$gotounread}");
        
$replace "{\$gotounread}{\$thread['prefix']}";
        
prefix_replace_templatesets("forumdisplay_thread"$find$replace);

        
$find preg_quote("trow2\"><input");
        
$replace "trow2\">{\$prefix_menu}<input";
        
prefix_replace_templatesets("newthread"$find$replace);
        
prefix_replace_templatesets("editpost"$find$replace);

        
$db->query("CREATE TABLE ".TABLE_PREFIX."prefix (
                           pid INT UNSIGNED NOT NULL AUTO_INCREMENT,
                           title VARCHAR(126) NOT NULL,
                           fid TEXT NOT NULL,
                           gid TEXT NOT NULL,
                           PRIMARY KEY (pid)
        )"
);
}



function 
prefix_uninstall()
{
        global 
$db;

        
$db->query("ALTER TABLE ".TABLE_PREFIX."threads DROP prefix");

        
$find preg_quote("{\$gotounread}{\$thread['prefix']}");
        
$replace "{\$gotounread}";
        
prefix_replace_templatesets("forumdisplay_thread"$find$replace);

        
$find preg_quote("trow2\">{\$prefix_menu}<input");
        
$replace "trow2\"><input";
        
prefix_replace_templatesets("newthread"$find$replace);
        
prefix_replace_templatesets("editpost"$find$replace);

        
$db->query("DROP TABLE ".TABLE_PREFIX."prefix");
}



function 
addPrefix_forumdisplay()
{
        global 
$thread;

        if (
$thread['prefix'])
        {
                
$thread['prefix'] = "<strong>[".$thread['prefix']."]</strong> ";
        }
}



function 
addPrefix_newthread()
{
        global 
$prefix_menu$fid;

        
$prefix_menu build_prefixmenu($fid);
}



function 
addPrefix_editpost()
{
        global 
$thread$fid$pid$prefix_menu;

        if (
$thread['firstpost'] != $pid) return false;
        
$prefix_menu build_prefixmenu($fid$thread['prefix']);
}



function 
savePrefix_editpost()
{
        global 
$mybb$thread$db;

        
$pid intval($mybb->input['prefix']);
        if (!
$thread['prefix'] && !$pid) return false;

        
$prefix $db->fetch_array($db->simple_select("prefix""title""pid=".$pid));

        if ((
$prefix['title'] == $thread['prefix']) || (!$prefix['title'] && $pid)) return false;
        
$db->update_query("threads", array("prefix"=>$prefix['title']), "tid=".$thread['tid']);
}



function 
savePrefix_newthread()
{
        global 
$mybb$db$tid;

        
$pid intval($mybb->input['prefix']);
        if (!
$pid) return false;

        
$prefix $db->fetch_array($db->simple_select("prefix""title""pid=".$pid));
        if (!
$prefix['title']) return false;

        
$db->update_query("threads", array("prefix"=>$prefix['title']), "tid=".$tid);
}



function 
build_prefixmenu($fid 0$selected "")
{
        global 
$mybb$db;
        if (!
$fid) return false;

        
$query $db->simple_select("prefix");
        
$menu "";
        while (
$prefix $db->fetch_array($query))
        {
                
$checked "";
                
$gids explode(","$prefix['gid']);
                
$fids explode(","$prefix['fid']);

                
$group in_array($mybb->user['usergroup'], $gids);
                if ((
in_array($fid$fids) && $group) || (!$prefix['fid'] && $group))
                {
                        if (
$prefix['title'] == $selected$checked " selected";
                        
$menu.="<option value=\"".$prefix['pid']."\"".$checked.">".$prefix['title']."</option>";
                }
        }

        if (
$menu)
        {
                return 
"<select name='prefix'><option value=\"0\"></option>".$menu."</select> ";
        }
}



function 
prefix_replace_templatesets($template$find$replace)
{
        global 
$db;

        
$query $db->simple_select("templates""template, tid""title='".$template."'");
        while (
$template $db->fetch_array($query))
        {
                
$tid $template['tid']; $body $template['template'];
                
$body preg_replace("!".$find."!"$replace$body);

                
$db->update_query("templates", array("template" => $db->escape_string($body)), "tid=".$tid);
        }
}

?>
Zitieren
#10
Naja, ich suche ja immernoch dringend etwas, um ein Problem mit dem Prefix-Manager zu beheben.

Zum einen ist es das Problem, was hier schon beschrieben ist.

Das andere Problem ist, dass wenn ein Benutzer einen Beitrag, welcher auf ein Thema mit Prefix gepostet wird, einfach verloren geht.

Ich habe aus dem Code meines Vorposters mal folgenden Code rausgesucht.

Vielleicht kann man damit schon etwas anfangen?

PHP-Code:
function addPrefix_editpost()
{
        global 
$thread$fid$pid$prefix_menu;

        if (
$thread['firstpost'] != $pid) return false;
        
$prefix_menu build_prefixmenu($fid$thread['prefix']);
}



function 
savePrefix_editpost()
{
        global 
$mybb$thread$db;

        
$pid intval($mybb->input['prefix']);
        if (!
$thread['prefix'] && !$pid) return false;

        
$prefix $db->fetch_array($db->simple_select("prefix""title""pid=".$pid));

        if ((
$prefix['title'] == $thread['prefix']) || (!$prefix['title'] && $pid)) return false;
        
$db->update_query("threads", array("prefix"=>$prefix['title']), "tid=".$thread['tid']);


Wäre sehr lieb.

MfG,
Waluigi
Zitieren


Möglicherweise verwandte Themen…
Thema Verfasser Antworten Ansichten Letzter Beitrag
  Suche nach Prefix tbat44 3 1.722 11.02.2016, 10:52
Letzter Beitrag: Jockl
  [Suche] Download Manager Plugin für Version 1.4 Benni_Cop 1 1.510 17.07.2010, 14:22
Letzter Beitrag: StefanT
  Prefix Manager funktioniert nicht mehr Waluigi 9 3.114 05.09.2009, 14:30
Letzter Beitrag: Waluigi
  Prefix Manager + Themen extern ausgeben Waluigi 8 2.716 28.06.2009, 14:05
Letzter Beitrag: Michael
  Prefix Plugin wird nicht angezeigt chris14465 3 2.068 08.09.2008, 12:34
Letzter Beitrag: Michael