Dołącz do zespołu ekspertów! Backend lub Frontend Developer?

Sprawdź najnowsze oferty pracy naszego partnera - 8lines.io!

Zmiana wielkości avatara w poscie.

Założony przez  tasakamana.

wersja skryptu MyBB:1.6.10
adres forum:http://www.dragonsprophet.xaa.pl/
na czym polega problem (screen, opis, komunikaty, nazwa stylu/theme/szablonu): Witam mam pytanie jak zmienić wielkość avatara na forum w poscie?
postbit_avatar:
<a href="{$post['profilelink_plain']}"><img src="{$post['avatar']}" alt="" {$avatar_width_height} /></a>
A tak:
<span class="smalltext"><span class="lastposter">{$forum['lastposteravatar']}</span>
<a href="{$lastpost_link}" title="{$full_lastpost_subject}"><strong>{$lastpost_subject}</strong></a>
<br />{$lastpost_date} {$lastpost_time}<br />{$lang->by} {$lastpost_profilelink}</span>
nic nie dało
Inaczej wejdź w forumbit_depth2_forum_lastpost

Znajdź
<img src="./uploads/avatars/avatar_2.jpg?dateline=1368687293" style="max-height: 35px; max-width: 35px; float: left; margin: 5px;" alt="avatar" class="favimg">

i dodaj

style="border: 1px solid #000;"
tylko że ja mam tam taki kod:
<span class="smalltext"><span class="lastposter">{$forum['lastposteravatar']}</span>
<a href="{$lastpost_link}" title="{$full_lastpost_subject}"><strong>{$lastpost_subject}</strong></a>
<br />{$lastpost_date} {$lastpost_time}<br />{$lang->by} {$lastpost_profilelink}</span>
A pokaż kod pluginu.

Ps. jak masz :
Witam, forum jest narazie w budowie ale zapraszamy do pisanie postów.
powinno być:
Witam, forum jest na razie w budowie ale zapraszamy do pisania postów.
Tak, masz rację jest tam błąd. A jak sprawdzić kod pluginu?
Ściągasz(albo już masz) na pulpit plugin (cośtam.php) i odpalasz go przez Notepad++ i kopiujesz cały kod.
proszę:
<?php

/**
* Avatary przy ostatnich postach - Filip Klar 2011-12
*/

if(!defined("IN_MYBB")) {
    die("Otwarcie tego pliku jest zabronione.");
}

$plugins->add_hook("global_start", "lastposteravatar_rand");
$plugins->add_hook("index_start", "lastposteravatar_parents");
$plugins->add_hook("forumdisplay_start", "lastposteravatar_parents");
$plugins->add_hook("build_forumbits_forum", "lastposteravatar_forums");
$plugins->add_hook("forumdisplay_thread", "lastposteravatar_threads");
$plugins->add_hook("pre_output_page", "lastposteravatar_replace");

function lastposteravatar_info() {
    return array(
        "name"            => "Avatary przy ostatnich postach",
        "description"    => "Wyświetla avatar użytkownika, który napisał ostatni post w danym dziale lub wątku",
        "website"        => "http://fklar.pl",
        "author"           => "Filip Klar",
        "authorsite"    => "http://fklar.pl",
        "version"        => "1.5",
        "guid"             => "",
        "compatibility" => "16*"
    );
}

function lastposteravatar_activate() {
    global $db, $mybb;
    
    $lastposteravatar_group = array(
        "gid"             => "NULL",
        "name"             => "lastposteravatar",
        "title"             => "Avatary przy ostatnich postach",
        "description"     => "Wyświetlanie avatarów na liście działów i wątków",
        "disporder"     => "25",
        "isdefault"     => "yes",
    );
    $db->insert_query("settinggroups", $lastposteravatar_group);
    $gid = $db->insert_id();    
    
    $lastposteravatar_size = array(
        "sid"                => "NULL",
        "name"            => "lastposteravatar_size",
        "title"            => "Maksymalny rozmiar avatara",
        "description"    => "",
        "optionscode"    => "text",
        "value"            => "35px",
        "disporder"        => "1",
        "gid"                => intval($gid),
    );
    $db->insert_query("settings", $lastposteravatar_size);
    
    $lastposteravatar_forums = array(
        "sid"                => "NULL",
        "name"            => "lastposteravatar_forums",
        "title"            => "Wyświetlanie na liście działów",
        "description"    => "",
        "optionscode"    => "yesno",
        "value"            => "1",
        "disporder"        => "2",
        "gid"                => intval($gid),
    );
    $db->insert_query("settings", $lastposteravatar_forums);
    
    $lastposteravatar_threads = array(
        "sid"                => "NULL",
        "name"            => "lastposteravatar_threads",
        "title"            => "Wyświetlanie na liście wątków",
        "description"    => "",
        "optionscode"    => "yesno",
        "value"            => "1",
        "disporder"        => "3",
        "gid"                => intval($gid),
    );
    $db->insert_query("settings", $lastposteravatar_threads);
    
    $lastposteravatar_showdefault = array(
        "sid"                => "NULL",
        "name"            => "lastposteravatar_showdefault",
        "title"            => "Przypisanie domyślnego avatara użytkownikom, którzy go nie posiadają",
        "description"    => "",
        "optionscode"    => "yesno",
        "value"            => "1",
        "disporder"        => "4",
        "gid"                => intval($gid),
    );
    $db->insert_query("settings", $lastposteravatar_showdefault);
    
    $lastposteravatar_defaultsource = array(
        "sid"                => "NULL",
        "name"            => "lastposteravatar_defaultsource",
        "title"            => "Adres domyślnego avatara",
        "description"    => "",
        "optionscode"    => "text",
        "value"            => $mybb->settings['bburl']."/admin/styles/default/images/default_avatar.gif",
        "disporder"        => "5",
        "gid"                => intval($gid),
    );
    $db->insert_query("settings", $lastposteravatar_defaultsource);
    
    rebuild_settings();
    
    require MYBB_ROOT."/inc/adminfunctions_templates.php";
    find_replace_templatesets("forumbit_depth1_forum_lastpost", "#".preg_quote('<span class="smalltext">') . "#i", '<span class="smalltext">{$forum[\'lastposteravatar\']}');
    find_replace_templatesets("forumbit_depth2_forum_lastpost", "#".preg_quote('<span class="smalltext">') . "#i", '<span class="smalltext">{$forum[\'lastposteravatar\']}');
    find_replace_templatesets("forumdisplay_thread", "#".preg_quote('<span class="lastpost smalltext">') . "#i", '<span class="lastpost smalltext">{$thread[\'lastposteravatar\']}');
    
}

function lastposteravatar_deactivate() {
    global $db;
    
    $db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='lastposteravatar'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='lastposteravatar_size'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='lastposteravatar_forums'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='lastposteravatar_threads'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='lastposteravatar_showdefault'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='lastposteravatar_defaultsource'");
    
    rebuild_settings();
    
    require MYBB_ROOT."/inc/adminfunctions_templates.php";
    find_replace_templatesets("forumbit_depth1_forum_lastpost", "#".preg_quote('{$forum[\'lastposteravatar\']}') . "#i", '');
    find_replace_templatesets("forumbit_depth2_forum_lastpost", "#".preg_quote('{$forum[\'lastposteravatar\']}') . "#i", '');
    find_replace_templatesets("forumdisplay_thread", "#".preg_quote('{$thread[\'lastposteravatar\']}') . "#i", '');
    
}

function lastposteravatar_rand() {
    global $lastposteravatar_rand;
    $lastposteravatar_rand = uniqid();    
}

function lastposteravatar_parents() {
    global $db, $avForum;
    
    $query = $db->query("SELECT `fid`, `pid`, `lastpost`, `lastposteruid` FROM `".TABLE_PREFIX."forums` WHERE `threads` > '0'");
    $n = 1;
    while($tempforum = $db->fetch_array($query)) {
        $avForum[$n]['fid'] = $tempforum['fid'];
        $avForum[$n]['parent'] = $tempforum['pid'];
        $avForum[$n]['lastpost'] = $tempforum['lastpost'];
        $avForum[$n]['lastposteruid'] = $tempforum['lastposteruid'];
        $n++;
    }
}

function lastposteravatar_forums(&$forum) {
    global $mybb, $fcache, $listOfUsers, $avForum, $lastposteravatar_rand;    
    
    if($mybb->settings['lastposteravatar_forums'] == 1) {
        $numberOfForums = count($avForum);
        $listOfUsers[0] = 0;
        $thisParent = $fcache[$forum['pid']][$forum['disporder']][$forum['fid']]['fid'];
        $fid = $thisParent;
        $lastpost = $fcache[$forum['pid']][$forum['disporder']][$forum['fid']]['lastpost'];
        $uid = $fcache[$forum['pid']][$forum['disporder']][$forum['fid']]['lastposteruid'];
        for($i = 0; $i <= $numberOfForums; $i++) {
            if($avForum[$i]['parent'] == $thisParent && $avForum[$i]['lastpost'] > $lastpost) {
                $lastpost = $avForum[$i]['lastpost'];
                $uid = $avForum[$i]['lastposteruid'];
            }
        }
        if(in_array($uid, $listOfUsers) == FALSE) {
            $listOfUsers[] = $uid;
        }
    
        $forum['lastposteravatar'] = "<!-- ".$lastposteravatar_rand."-avatar-".$uid." -->";
    
    }
    
}

function lastposteravatar_threads() {
    global $mybb, $thread, $listOfUsers, $lastposteravatar_rand;
    
    if($mybb->settings['lastposteravatar_threads'] == 1) {
    
        $listOfUsers[0] = 0;
        $uid = $thread['lastposteruid'];
        if(in_array($uid, $listOfUsers) == FALSE) {
            $listOfUsers[] = $uid;
        }
        
        $thread['lastposteravatar'] = "<!-- ".$lastposteravatar_rand."-avatar-".$uid." -->";
        
    }
    
}

function lastposteravatar_replace($contents) {
    global $db, $mybb, $listOfUsers, $lastposteravatar_rand;
    
    $numberWithAvatar = count($listOfUsers);
    $partQuery = "`uid` = '0'";
    for($i = 0; $i <= $numberWithAvatar; $i++) {
        $partQuery .= "OR `uid` = '".$listOfUsers[$i]."'";
    }
    
    $query = $db->query("SELECT `uid`, `avatar` FROM `".TABLE_PREFIX."users` WHERE ".$partQuery);
    while($rekord = $db->fetch_array($query)) {
        if(empty($rekord['avatar']) && $mybb->settings['lastposteravatar_showdefault'] == 0) {
            $contents = str_replace("<!-- ".$lastposteravatar_rand."-avatar-".$rekord['uid']." -->", "", $contents);
        }
        elseif(empty($rekord['avatar']) && $mybb->settings['lastposteravatar_showdefault'] == 1) {
            $contents = str_replace("<!-- ".$lastposteravatar_rand."-avatar-".$rekord['uid']." -->", "<a href=\"".$mybb->settings['bburl']."/".get_profile_link($rekord['uid'])."\"><img src=\"".$mybb->settings['lastposteravatar_defaultsource']."\" style=\"max-height: ".$mybb->settings['lastposteravatar_size']."; max-width: ".$mybb->settings['lastposteravatar_size']."; float: left; margin: 5px;\" alt=\"avatar\" class=\"favimg\" /></a>", $contents);    
        }
        else {
            $contents = str_replace("<!-- ".$lastposteravatar_rand."-avatar-".$rekord['uid']." -->", "<a href=\"".$mybb->settings['bburl']."/".get_profile_link($rekord['uid'])."\"><img src=\"".$rekord['avatar']."\" style=\"max-height: ".$mybb->settings['lastposteravatar_size']."; max-width: ".$mybb->settings['lastposteravatar_size']."; float: left; margin: 5px;\" alt=\"avatar\" class=\"favimg\" /></a>", $contents);    
        }
    }
    
    if($mybb->settings['lastposteravatar_showdefault'] == 0) {
        $contents = str_replace("<!-- ".$lastposteravatar_rand."-avatar-0 -->", "", $contents);
    }
    else {
        $contents = str_replace("<!-- ".$lastposteravatar_rand."-avatar-0 -->", "<img src=\"".$mybb->settings['lastposteravatar_defaultsource']."\" style=\"max-height: ".$mybb->settings['lastposteravatar_size']."; max-width: ".$mybb->settings['lastposteravatar_size']."; float: left; margin: 5px;\" alt=\"avatar\" class=\"favimg\" />", $contents);
        $contents = str_replace("<!-- ".$lastposteravatar_rand."-avatar", "<img src=\"".$mybb->settings['lastposteravatar_defaultsource']."\" style=\"max-height: ".$mybb->settings['lastposteravatar_size']."; max-width: ".$mybb->settings['lastposteravatar_size']."; float: left; margin: 5px;\" alt=\"avatar\" class=\"favimg\" /><!-- avatar", $contents);
    }
    
    return $contents;
    
}


?>



Użytkownicy przeglądający ten wątek:

1 gości