Avatar użytkownika o konkretnym ID

Założony przez  Poftorek.

Cześć, chciałbym pozbyć się użycia pluginu na avatary dla użytkownika o konkretnym ID. Niestety, nie udaje mi się. Kod poniższy zwraca zamiast avatara Array.

Linijka 136. i 47.

<?php

if (!defined("IN_MYBB")) {
    die(
"Plik ten nie może być dostępny bezpośrednio.");
}

$plugins->add_hook('index_start''kontaktwpanelu');

function 
kontaktwpanelu_info()
{
    global 
$lang;
    
$lang->load("config_kontaktwpanelu");
    
    return array(
        
"name" => $lang->kontaktwpanelu_nameplugin,
        
"description" => $lang->kontaktwpanelu_nameplugindesc,
        
"website" => "https://webboard.pl/user-36883.html",
        
"author" => "Fyeem",
        
"authorsite" => "https://webboard.pl/user-36883.html",
        
"version" => "3.3",
        
"compatibility" => "18*"
    
);
}

function 
kontaktwpanelu_activate()
{
    global 
$db$lang$mybb;
    
$lang->load("config_kontaktwpanelu"); 

 
 
$insert_array22 = array(
        
'title' => 'kontaktwpanelu',
        
'template' => $db->escape_string('<table border="0" cellspacing="0" cellpadding="5" class="tborder">
    <tbody>
        <tr><td class="thead">{$mybb->settings[\'nazwa_kontaktu\']}</td></tr>
        {$kontaktwpanelurow}
    </tbody>
</table>'
),
        
'sid' => '-1',
        
'version' => '',
        
'dateline' => time()
    );
    
$db->insert_query('templates'$insert_array22);
    
    
$insert_array33 = array(
        
'title' => 'kontaktwpanelurow',
        
'template' => $db->escape_string('<tr><td class="trow1"><center> {$useravatar} 
    <span style="font-size:18px;">{$user[\'profilelink\']}</span>
    <br /> {$steam} {$skype} {$jabber} {$aim}
</center></td> </tr>'
),
        
'sid' => '-1',
        
'version' => '',
        
'dateline' => time()
    );
    
$db->insert_query('templates'$insert_array33);
    
    
$kontaktwpanelu_group_settings = array(
        
"gid" => NULL,
        
"name" => "kontaktwpanelu_option_category",
        
"title" => $lang->kontaktwpanelu_title,
        
"description" => $lang->kontaktwpanelu_desc,
        
"disporder" => "50",
        
"isdefault" => "yes"
    
);
    
$db->insert_query("settinggroups"$kontaktwpanelu_group_settings);
    
    
$gid      $db->insert_id();
    
$option_1 = array(
        
"sid" => NULL,
        
"name" => "kontaktwpanelu_enabled",
        
"title" => $lang->kontaktwpanelu_onoff,
        
"description" => $lang->kontaktwpanelu_onoffdesc,
        
"optionscode" => "yesno",
        
"value" => "yes",
        
"isdefault" => "yes",
        
"disporder" => "1",
        
"gid" => intval($gid)
    );
    
$db->insert_query("settings"$option_1);
    
    
    
$option_2 = array(
        
"sid" => NULL,
        
"name" => "nazwa_kontaktu",
        
"title" => $lang->kontaktwpanelu_panelname,
        
"description" => $lang->kontaktwpanelu_panelnamedesc,
        
"optionscode" => "text",
        
"value" => $lang->kontaktwpanelu_panelnamevalue,
        
"isdefault" => "yes",
        
"disporder" => "2",
        
"gid" => intval($gid)
    );
    
$db->insert_query("settings"$option_2);
    
    
$option_3 = array(
        
"sid" => NULL,
        
"name" => "kontaktwpanelu_daneadminow",
        
"title" => $lang->kontaktwpanelu_contactfields,
        
"description" => $lang->kontaktwpanelu_contactfieldsdesc,
        
"optionscode" => "textarea",
        
"value" => $lang->kontaktwpanelu_contactfieldsvalue,
        
"isdefault" => "yes",
        
"disporder" => "3",
        
"gid" => intval($gid)
    );
    
$db->insert_query("settings"$option_3);
    
rebuild_settings();
}


function 
kontaktwpanelu_deactivate()
{
    global 
$db$mybb;
    
$db->delete_query("templates""title = 'kontaktwpanelu'");
    
$db->delete_query("templates""title = 'kontaktwpanelurow'");
    
    
$db->delete_query('settinggroups''name = "kontaktwpanelu_option_category"');
    
$db->delete_query('settings''name IN("kontaktwpanelu_enabled, nazwa_kontaktu, kontaktwpanelu_daneadminow")');
    
rebuild_settings();
    
    require 
MYBB_ROOT "/inc/adminfunctions_templates.php";
    
find_replace_templatesets('index''#(\n?){\$kontaktwpanelu}#'''0);
}

function 
kontaktwpanelu()
{
    global 
$mybb$kontaktwpanelu$templates;
    
    if (
$mybb->settings['kontaktwpanelu_enabled'] == 1) {
        
$DaneAdminow explode(","$mybb->settings['kontaktwpanelu_daneadminow']);
        foreach (
$DaneAdminow as $DaneAdmina) {
            
$Admin               explode(" "$DaneAdmina);
            
$user                get_user($Admin[0]);
            
$user['username']    = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
            
$user['profilelink'] = build_profile_link($user['username'], $user['uid']);
            
$useravatar format_avatar($Admin[0]);
            
            
$steam  NULL;
            
$skype  NULL;
            
$jabber NULL;
            
$aim    NULL;
            
            if (!empty(
$Admin[1]))
                
$steam "<br /><span style=\"font-size:11px;\"><img src=\"/images/firstf/steam.png\" /> Steam: {$Admin[1]}</span>";
            if (!empty(
$Admin[2]))
                
$skype "<br /><span style=\"font-size:11px;\"><img src=\"/images/firstf/skype.png\" /> Skype: {$Admin[2]}</span>";
            if (!empty(
$Admin[3]))
                
$jabber "<br /><span style=\"font-size:11px;\"><img src=\"/images/firstf/jabber.png\" /> Jabber: {$Admin[3]}</span>";
            if (!empty(
$Admin[4]))
                
$aim "<br /><span style=\"font-size:11px;\"><img src=\"/images/firstf/aim.png\" /> AIM: {$Admin[4]}</span>";
            
            eval(
"\$kontaktwpanelurow .= \"" $templates->get("kontaktwpanelurow") . "\";");
        }
        
        eval(
"\$kontaktwpanelu = \"" $templates->get("kontaktwpanelu") . "\";");
    }
}
?>
Cytat:w pół dnia stałeś się lepszym pytonistą niż kawenanowo kiedykolwiek programisto :3 ~ Riess 13.11.2018 16:28
Cytat:ale z tą nazwą to fyeem ma racje  ~ Divir 29.07.2019 16:08
Bo ta funkcja zwraca tablicę. Zrób
var_dump($useravatar); 
i zobaczysz jak należy tego użyć.
Jakoś to wpisałem i wyszło mi takie cuś:

array(2) { ["image"]=> string(33"http://pluginsmybbthemes.ct8.pl/1" ["width_height"]=> string(0"" } array(2) { ["image"]=> string(33"http://pluginsmybbthemes.ct8.pl/2" ["width_height"]=> string(0"" } array(2) { ["image"]=> string(33"http://pluginsmybbthemes.ct8.pl/3" ["width_height"]=> string(0"" 

Co mi to mówi? Nic.
Cytat:w pół dnia stałeś się lepszym pytonistą niż kawenanowo kiedykolwiek programisto :3 ~ Riess 13.11.2018 16:28
Cytat:ale z tą nazwą to fyeem ma racje  ~ Divir 29.07.2019 16:08
Dla mnie mówi to wiele. Np. pod $useravatar['image'] jest link do avatara.
Druga sprawa, funkcja format_avatar przyjmuje jako parametr link do awatara z tabeli użytkowników a nie ID użytkownika https://github.com/mybb/mybb/blob/6aa831....php#L3043
Polecam podejrzec starsze wersje tego pluginu. Na poczatku pisalem dosc rozlazly kod z ktorego mozesz cos wywnioskowac ;)
Moze nawet znajdziesz wersje gdzie uzywalem funkcji mybb do wczytywania danych
Jak czytasz mój post to sprawdź czy go nie zedytowałem bo niezdecydowany jestem.



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

1 gości