Witam. O tuż zainspirowany tym Tematem, postanowiłem swprawdzić swoich sił i spróbować chociaż coś napisać. Udało mi się (poniekąd..), ale nie da się wejść w wątek ponieważ wyskakuje mi error:
Przykład!
Kod wtyczki:
Użyłem kodu Lukasa:
O co c`mon?
Fatal error: Call to undefined function Thread_in_posts_postbit() in /home/renar/domains/ferrycraft.pl/public_html/inc/class_plugins.php on line 101
Kod wtyczki:
<?php
if(!defined("IN_MYBB"))
{
die("You Cannot Access This File Directly. Please Make Sure IN_MYBB Is Defined.");
}
$plugins->add_hook('postbit', 'Thread_in_posts_postbit');
function Thread_in_posts_info()
{
return array(
"name" => "Thread in Posts",
"description" => "Skromny plugin pokazujący ilość tematów danego użytkownika w postach!",
"website" => "https://webboard.pl",
"author" => "GiboneKPL",
"authorsite" => "https://webboard.pl",
"version" => "1.0",
"guid" => "",
"compatibility" => "*",
);
}
function Thread_in_posts_active()
{
global $db;
$myfirstplugin_group = array(
'gid' => 'NULL',
'name' => 'Thread_in_posts',
'title' => 'Thread_in_posts_Ustawienia',
'description' => 'thread_in_posts_ustawienia',
'disporder' => "1",
'isdefault' => "0",
);
}
function Thread_in_posts_is_actived()
{
global $mybb;
if($mybb->settings['Thread_in_posts_onoff'] == '1' || $mybb->settings['Thread_in_posts_onoff'] == '0')
{
return true;
}
return false;
}
function Thread_in_posts_deactived()
{
global $db;
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN ('Thread_in_posts_onoff')");
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='Thread_in_posts'");
rebuild_settings();
}
function postbit_numthreads($post)
{
global $db;
static $cache;
if (empty($cache[$post['uid']]))
{
$sql = "SELECT COUNT(tid) as num_threads FROM ".TABLE_PREFIX."threads WHERE uid = '{$post['uid']}'";
$result = $db->query($sql);
$cache[$post['uid']] = (int) $db->fetch_filed($result, 'num_threads');
}
$post['num_threads'] = $cache[$uid];
}
?>
Użyłem kodu Lukasa:
function postbit_numthreads(&$post)
{
global $db;
static $cache;
if (empty($cache[$post['uid']]))
{
$sql = "SELECT COUNT(tid) as num_threads
FROM ".TABLE_PREFIX."threads
WHERE uid = '{$post['uid']}'");
$result = $db->query($sql);
$cache[$post['uid']] = (int) $db->fetch_filed($result, 'num_threads');
}
$post['num_threads'] = $cach
O co c`mon?