Webboard

Pełna wersja: Plugin Lastposteravatar - poprawienie wyglądu
Aktualnie przeglądasz uproszczoną wersję forum. Kliknij tutaj, by zobaczyć wersję z pełnym formatowaniem.
wersja skryptu MyBB:1.8.*
adres forum: http://adek563.c0.pl/
na czym polega problem (screen, opis, komunikaty, nazwa i wersja wtyczki):
Witam posiadam plugin Lasposteravatar wersje 1.5 by Filip Klar, plugin ten był pod 1.6 ale zmieniłem jego kompatybilność na 1.8, wszystko niby działa, ale na stylu Carbon for 1.8 wyświetlanie avtarów brzydko wygląda np.
[Obrazek: UGhDqwe.jpg]

Jak przesunąć avatar aby był bliżej napisów  po prawej stronie.
https://webboard.pl/thread-64592.html?pi...#pid273848

Bez adresu forum nie mamy jak pomóc
Dobra, wrzuciłem wszystkie pliki na brata konto hostingowe
link. adek563.c0.pl
Wklej zawartość szablonu forumbit_depth2_forum_lastpost z grupy szablonów Opis działu
Kod:
<span class="smalltext">{$forum['lastposteravatar']}
<a class="tipTip"  href="{$lastpost_link}" title="{$full_lastpost_subject}"><strong>{$lastpost_subject}</strong></a>
<br />{$lastpost_date}<br />{$lang->by} {$lastpost_profilelink}</span>
Poszukaj w szablonach globalnych jakiegoś szablonu o nazwie lastposteravatar czy coś w ten deseń i wklej tu zawartość
W szablonach globalnych nic takiego nie ma.
Kod pluginu: http://pastebin.com/K1QGhTb8
Zamień na to
Kod PHP:
<?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" => "18*"
        
);
}
 
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; padding-left: 40px; 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; padding-left: 40px; 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; padding-left: 40px; margin: 5px;\" alt=\"avatar\" class=\"favimg\" /><!-- avatar"$contents);
        }
       
        return 
$contents;
       
}
 
 
?>
Niby już działa, ale teraz tu się zepsuło :P
[Obrazek: kATfzzs.jpg]
Wrzuć ten kod co podałem i wstaw tu zawartość szablonu forumbit_depth2_forum z opis działu
Kod:
<tr>
<td class="{$bgcolor}" align="center" valign="top" width="6%"><span class="forum_status forum_{$lightbulb['folder']} ajax_mark_read" title="{$lightbulb['altonoff']}" id="mark_read_{$forum['fid']}"></span></td>
<td class="{$bgcolor}" valign="top" style="width: 50%;">
<strong><a href="{$forum_url}">{$forum['name']}</a></strong>{$forum_viewers_text}<div class="smalltext">{$forum['description']}{$modlist}{$subforums}</div>
</td>
<td class="{$bgcolor} countForum" valign="top" align="center" style="white-space: nowrap; width: 20%;">{$threads}{$unapproved['unapproved_threads']} Tematów<br />{$posts}{$unapproved['unapproved_posts']} Postów</td>
<td class="{$bgcolor}" valign="top" align="right" style="white-space: nowrap; width: 24%; padding-right: 20px;">{$lastpost}</td>
</tr>
Spróbuj przywrócić do oryginału i zostaw tak
To nie wchodzi w grę.

//Do zamknięcia