Webboard

Pełna wersja: Więcej rang (css) w opisie posta
Aktualnie przeglądasz uproszczoną wersję forum. Kliknij tutaj, by zobaczyć wersję z pełnym formatowaniem.
Witam, 
potrzebuje małej pomocy przy plugin'ie Show Additional Group Images, chodzi o to że nie wyświetla mi więcej rang, tylko 1 pod postem. 
Problem wynika z tego ze zamiast rang obrazkowych mam rangi w .css i przy takich chce zostać. 
Pomoże ktoś w skonfigurowaniu pluginu?[attachment=11596]
Wrzuć tu kod PHP, trzeba przerobić, jak będę miał chwilę to zrobię, a jak nie będzie mi się chciało to napiszę jak to zrobić.
Kod PHP:
<?php
/*
# Show Additional Group Images plugin
# PLUGIN BY DVDXSEO (http://ptm.altervista.org/forum/)
# You're not allowed to redistribute it without my permissions. 
# Free for non commercial purposes!
# You can edit the code but you must keep my credits.
*/
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""images_postbit");
$plugins->add_hook("member_profile_end""images_profile");
$plugins->add_hook("admin_user_groups_edit_commit""images_editgroup");

function 
additionalimg_info(){
 global 
$lang;
 
$lang->load("additionalimg");
 return array(
 
'name' => 'Show Additional Group Images',
 
'description' => $lang->agi_descr,
 
'website' => 'http://ptm.altervista.org/forum',
 
'author' => 'Dvdxseo',
 
'authorsite' => 'http://ptm.altervista.org/forum',
 
'version' => '1.0',
 
'guid' => 'bab9eaae39210fd31d6c31c4fe4c9baf'
 
);
}
function 
additionalimg_activate(){
 
   global $db,$lang;
 
$lang->load("additionalimg");
 
$db->write_query("ALTER TABLE `".TABLE_PREFIX."usergroups` ADD `targhetta` INT( 2 ) NOT NULL DEFAULT '0'");
 
   $group = array(
 
       "gid"            => "NULL",
 
       "title"          => "Additional Group Images",
 
       "name"           => "additionalimg_group",
 
       "description"    => $lang->setting_descr,
 
       "disporder"      => "1",
 
       "isdefault"      => "0",
 
   );
 
   
    $db
->insert_query("settinggroups"$group);
 
   $gid $db->insert_id();
 
   
    
    $setting_1 
= array(
 
       "sid"            => "NULL",
 
       "name"           => "additionalimg_postbit",
 
       "title"          => $lang->postbit_title,
 
       "description"    => $lang->postbit_descr,
 
       "optionscode"    => "yesno",
 
       "value"          => 'yes',
 
       "disporder"      => '1',
 
       "gid"            => intval($gid),
 
   );

 
   $db->insert_query("settings"$setting_1);
 
   $setting_2 = array(
 
       "sid"            => "NULL",
 
       "name"           => "additionalimg_profile",
 
       "title"          => $lang->member_title,
 
       "description"    => $lang->member_descr,
 
       "optionscode"    => "yesno",
 
       "value"          => 'yes',
 
       "disporder"      => '1',
 
       "gid"            => intval($gid),
 
   );

 
   $db->insert_query("settings"$setting_2); 

 
   rebuild_settings();
}
function 
additionalimg_deactivate(){
 
   global $db;
 
 
$db->write_query("ALTER TABLE ".TABLE_PREFIX."usergroups DROP targhetta");
 
   $db->write_query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='additionalimg_group'");
 
   $db->write_query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='additionalimg_postbit'");
 
   $db->write_query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='additionalimg_profile'"); 
 
   rebuild_settings();


function 
images_postbit(&$post){ 
 global 
$mybb;

 if(
$mybb->settings['additionalimg_postbit']){
 
$additionalimg getimagesgroups($post);
 if(
$additionalimg)
 {
 if(
$mybb->settings['postlayout'] == "classic"){
 
$br "<br />";
 } else{
 
$br "";
 }
 
$post['groupimage'] = str_replace("<br />"""$post['groupimage']);
 
$pos strrpos($post['groupimage'], "<!--")-1;
 
$post['groupimage'] = substr($post['groupimage'], 0$pos).$br.substr($post['groupimage'], $pos);
 
$post['groupimage'] = $post['groupimage'].$additionalimg;
 }
 }
 
}
function 
images_profile(){ 
 global 
$mybb$memprofile$groupimage;

 if(
$mybb->settings['additionalimg_profile']){
 
$additionalimg getimagesgroups($memprofile);
 if(
$additionalimg)
 {
 
$groupimage $groupimage.$additionalimg."<br />";
 }
 }
}
function 
images_editgroup()
{
 global 
$mybb$updated_group;
 
$updated_group['targhetta'] = intval($mybb->input['targhetta']);
}
function 
getimagesgroups($post){
 global 
$cache$theme$mybb;

 
$usergroups $cache->read("usergroups");
 
$groups explode(',',$post['additionalgroups']);
 
$additionalimg="";
 foreach(
$groups as $group){
 if(
$mybb->settings['postlayout'] == "classic"){
 
$br "<br />";
 } else{
 
$br "&nbsp;";
 }
 
$groupname=$usergroups[$group]['usertitle'];
 
$groupimages=$usergroups[$group]['image'];
 
$groupdisplay=$usergroups[$group]['targhetta'];
 if(!empty(
$groupimages)){
 if(
$groupimages == $usergroups[$post['usergroup']]['image']){
 continue;
 }
 if(
strpos($groupimages"{lang}")!==false){ // Replace {lang} with the right var
 
if(!empty($mybb->user['language'])){ // Check user lang 
 
$language $mybb->user['language'];
 }else{
 
$language $mybb->settings['bblanguage'];
 }
 
$groupimages str_replace("{lang}"$language$groupimages); // Now Replace {lang}......
 
$groupimages str_replace("{theme}"$theme['imgdir'], $groupimages); // ..... and {theme}
 
}
 if(!
strstr($additionalimg$groupimages)){
 if(
$groupdisplay){
 if(
$groupimages == $usergroups[$post['displaygroup']]['image']){
 
$additionalimg .= $br."<img src=\"{$usergroups[$post['usergroup']]['image']}\">";
 }else{ 
 continue;
 }
 
/*}elseif($groupdisplay && $groupimages == $usergroups[$post['displaygroup']]['image']){
 $additionalimg .= "".$br."<img src=\"{$usergroups[$post['usergroup']]['image']}\">";
 */
}else{
 if(
$groupimages == $usergroups[$post['displaygroup']]['image']){
 
// We don't want double images!
 
$additionalimg .= "<img src=\"{$usergroups[$post['usergroup']]['image']}\">".$br;
 }else{
 
$additionalimg .= "<img src=\"".$groupimages."\" alt=\"".$groupname."\" title=\"".$groupname."\">".$br;
 }
 }
 }
 }
 }
 return 
$additionalimg;
}
?>