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

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

Obrazki rang - inny widok z poziomu gościa, a inny z zalogowanego

Założony przez  mateusztb.

wersja skryptu MyBB: 1.6.14
adres forum: www.OnlyFrags.pl
na czym polega problem (screen, opis, komunikaty, nazwa stylu/theme/szablonu): Na koncie mam tak ...
[Obrazek: bb698b2223c778b7567f37ea155754aa.png]

Na gościu mam tak ...
[Obrazek: 592878f1e256ba5f8c058dfaef91abbf.png]
Snake_ napisał 19.08.2014, 22:12:
poprawiam tytuł. [Obrazek: modnotice_howto.png]
Pokaż kod pluginu - do dodatkowych rang.
Prośby na PW dotyczące wsparcia z problemami będą ignorowane. Pomoc poza forum - odpłatna; kontakt: snakemybboard@gmail.com.
show_usergroups

<?php

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("postbit", "show_additional");
$plugins->add_hook("member_profile_end", "profile_additional");
function show_usergroups_info()
{
    return array(
        "name" => "SA-Groups",
        "description" => "Shows additional groupimages on profiles and posts.",
        "website" => "N/A",
        "author" => "Mr Josh",
        "authorsite" => "http://inkbuild.com",
        "version" => "1.1.1",
        "compatibility" => "16*",
        "guid" => "aaa37e798d91627e86452a5f310b744c");
}

function profile_additional()
{
    global $memprofile, $groupimage, $cache, $mybb;

    if ($mybb->settings["display_in_profiles"] == 1) {
        $read = $cache->read("usergroups");
        $split_additional = explode(",", $memprofile["additionalgroups"]);
        foreach ($split_additional as $group) {
            $group_info = $read[$group];

            $groupimage .= "<img src=\"$group_info[image]\" alt=\"\" title=\"$group_info[title]\" /><br />";
        }
    }

}

function show_additional(&$post)
{
    global $cache, $mybb;

    if ($mybb->settings["show_usergroups_plugin_display"] == 1) {
        $group_info = $cache->read("usergroups");
        $split_additional = explode(",", $post["additionalgroups"]);
        $normal_group = $group_info[$post["usergroup"]];
        $post["groupimage"] = "<img src=\"$normal_group[image]\" title=\"$normal_group[title]\" alt=\"\" />";
        $post["groupimage"] .= ($mybb->user["classicpostbit"] == 1) || ($mybb->user["uid"] == 0 && $mybb->settings["postlayout"] == "classic") ? "<br />" : "";

        foreach ($split_additional as $i) {
            $group_up = $group_info[$i];
            $post["groupimage"] .= "<img src=\"$group_up[image]\" title=\"$group_up[title]\" alt=\"\" />";
            $post["groupimage"] .= ($mybb->user["classicpostbit"] == 1) || ($mybb->user["uid"] == 0 && $mybb->settings["postlayout"] == "classic") ? "<br />" : "";
        }
    }
}

function show_usergroups_activate()
{
    global $db;

    $classic_user_groups = array(
        "gid" => "NULL",
        "name" => "show_usergroups_plugin",
        "title" => "SA-Groups",
        "description" => "",
        "disporder" => "1",
        "isdefault" => "no");

    $db->insert_query("settinggroups", $classic_user_groups);
    $gid = $db->insert_id();

    $classic_user_groups_setting = array(
        "name" => "show_usergroups_plugin_display",
        "title" => "Enable/Disable plugin",
        "description" => "",
        "optionscode" => "yesno",
        "value" => "1",
        "disporder" => "1",
        "gid" => intval($gid));

    $display_in_profiles = array(
        "name" => "display_in_profiles",
        "title" => "Enable/Disable plugin for profiles",
        "description" => "Adds additional groupimages to profiles",
        "optionscode" => "yesno",
        "value" => "0",
        "disporder" => "1",
        "gid" => intval($gid));


    $db->insert_query("settings", $classic_user_groups_setting);
    $db->insert_query("settings", $display_in_profiles);
    rebuild_settings();
}


function show_usergroups_deactivate()
{
    global $db;

    $db->query("DELETE FROM " . TABLE_PREFIX .
        "settings WHERE `name` IN('show_usergroups_plugin_display', 'display_in_profiles')");
    $db->query("DELETE FROM " . TABLE_PREFIX .
        "settinggroups WHERE `name` = 'show_usergroups_plugin'");

    rebuild_settings();
}

?>
Obie grupy (Gość i Zalogowany) korzystają z postbit_classic?


Może spróbuj tak:
<?php

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("postbit""show_additional");
$plugins->add_hook("member_profile_end""profile_additional");
function 
show_usergroups_info()
{
    return array(
        
"name" => "SA-Groups",
        
"description" => "Shows additional groupimages on profiles and posts.",
        
"website" => "N/A",
        
"author" => "Mr Josh",
        
"authorsite" => "http://inkbuild.com",
        
"version" => "1.1.1",
        
"compatibility" => "16*",
        
"guid" => "aaa37e798d91627e86452a5f310b744c");
}

function 
profile_additional()
{
    global 
$memprofile$groupimage$cache$mybb;

    if (
$mybb->settings["display_in_profiles"] == 1) {
        
$read $cache->read("usergroups");
        
$split_additional explode(","$memprofile["additionalgroups"]);
        foreach (
$split_additional as $group) {
            
$group_info $read[$group];

            
$groupimage .= "<img src=\"$group_info[image]\" alt=\"\" title=\"$group_info[title]\" /><br />";
        }
    }

}

function 
show_additional(&$post)
{
    global 
$cache$mybb;

    if (
$mybb->settings["show_usergroups_plugin_display"] == 1) {
        
$group_info $cache->read("usergroups");
        
$split_additional explode(","$post["additionalgroups"]);
        
$normal_group $group_info[$post["usergroup"]];
        
$post["groupimage"] = "<img src=\"$normal_group[image]\" title=\"$normal_group[title]\" alt=\"\" /><br />";
        
$post["groupimage"] .= ($mybb->user["classicpostbit"] == 1) || ($mybb->user["uid"] == && $mybb->settings["postlayout"] == "classic") ? "<br />" "";

        foreach (
$split_additional as $i) {
            
$group_up $group_info[$i];
            
$post["groupimage"] .= "<img src=\"$group_up[image]\" title=\"$group_up[title]\" alt=\"\" /><br />";
            
$post["groupimage"] .= ($mybb->user["classicpostbit"] == 1) || ($mybb->user["uid"] == && $mybb->settings["postlayout"] == "classic") ? "<br />" "";
        }
    }
}

function 
show_usergroups_activate()
{
    global 
$db;

    
$classic_user_groups = array(
        
"gid" => "NULL",
        
"name" => "show_usergroups_plugin",
        
"title" => "SA-Groups",
        
"description" => "",
        
"disporder" => "1",
        
"isdefault" => "no");

    
$db->insert_query("settinggroups"$classic_user_groups);
    
$gid $db->insert_id();

    
$classic_user_groups_setting = array(
        
"name" => "show_usergroups_plugin_display",
        
"title" => "Enable/Disable plugin",
        
"description" => "",
        
"optionscode" => "yesno",
        
"value" => "1",
        
"disporder" => "1",
        
"gid" => intval($gid));

    
$display_in_profiles = array(
        
"name" => "display_in_profiles",
        
"title" => "Enable/Disable plugin for profiles",
        
"description" => "Adds additional groupimages to profiles",
        
"optionscode" => "yesno",
        
"value" => "0",
        
"disporder" => "1",
        
"gid" => intval($gid));


    
$db->insert_query("settings"$classic_user_groups_setting);
    
$db->insert_query("settings"$display_in_profiles);
    
rebuild_settings();
}


function 
show_usergroups_deactivate()
{
    global 
$db;

    
$db->query("DELETE FROM " TABLE_PREFIX .
        
"settings WHERE `name` IN('show_usergroups_plugin_display', 'display_in_profiles')");
    
$db->query("DELETE FROM " TABLE_PREFIX .
        
"settinggroups WHERE `name` = 'show_usergroups_plugin'");

    
rebuild_settings();
}

?>
Prośby na PW dotyczące wsparcia z problemami będą ignorowane. Pomoc poza forum - odpłatna; kontakt: snakemybboard@gmail.com.



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

1 gości