Hallo, Gast! (Registrieren)

Wir wünschen allen Besuchern frohe Ostern!

Letzte Ankündigung: MyBB 1.8.37 veröffentlicht (04.11.23)


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste
Multiple Usergroup Images on Postbit
#1
Eine neue Erweiterung wurde veröffentlicht: Multiple Usergroup Images on Postbit/Profile

Zitat:Note: In order for additional usergroups to show on profiles, you will need to download build 4. Build 2 (version 1.1) does not support additional usergroups on user profiles.

By default, MyBB displays only the primary/display usergroup image on the postbit and profile. This plugin enables MyBB to display all additional usergroup images  as well. This was officially developed for MyBB 1.8, but is also backwards compatible with MyBB 1.6 forums.

You may move the {$post['additional_groups']} variable in your 'postbit' and 'postbit_classic' templates to wherever you'd like, or the {$memprofile['additional_groups']} variable in the 'member_profile' template for user profiles. Although this plugin has been tested with multiple themes, highly customized postbit designs may require additional template edits. If the plugin does not work with your theme, you will need to manually add these variable to your postbit and profile templates.

Licensed under the GNU GPL, version 3.
Zitieren
#2
Eine neue Version wurde veröffentlicht: Multiple Usergroup Images on Postbit/Profile 1.2
Zitieren
#3
Da ich zukünftig verschiedene Themes haben werde, möchte ich auch, dass die Gruppenbilder sich jeweils anpassen.
Deshalb gebe ich den Pfad zu den Bildern so an: {theme}/gruppenbilder/bild.png

Das Plugin wandelt das {theme} leider nicht um, weshalb das sekundäre Gruppenbild als kaputtes Bild angezeigt wird.

Ich habe schon versucht, das Ganze um folgende Zeile zu erweitern:
PHP-Code:
    $post['additional_images'] = str_replace("{theme}"$theme['imgdir'], $post['groupimage']); 
Allerdings wird mir damit dann das Gruppenbild doppelt angezeigt und das Bild der sekundären Gruppe gar nicht.

Weiss hier vielleicht jemand Rat?
Zitieren
#4
Probiere es mal hiermit - vielleicht gehts ja so:
PHP-Code:
if (strpos($usergroup['image'], '{theme}') !== false
{
    
$usergroup['image'] = str_replace('{theme}' $theme['imgdir'] , $usergroup['image']);


Natürlich mußt du $theme noch global einbinden.
Zitieren
#5
Leider funktioniert das nicht. Das Ergebnis bleibt dasselbe - ein kaputtes Bild, wo die sekundäre Gruppe angezeigt werden sollte.

Der Post-Abschnitt sieht nun so aus:
PHP-Code:
function apgi ($post) {

    global 
$mybb$templates$cache$apgi$templates$theme;
    
$u_groups explode(","$post['additionalgroups']);
    
$usergroups_cache $cache->read("usergroups");
            
    foreach (
$u_groups as $groupID) {
        
$usergroup $usergroups_cache[$groupID];

        if (!empty(
$usergroup['image'])) {
            
$post['additional_images'] .= "<div style='margin-top: 3px; padding: 0px;'></div>"// Adding a <br /> tag between group images results in alignment issues on chrome. This seems to work better.  
            
eval("\$post['additional_images'] .= \"".$templates->get("postbit_groupimage")."\";");
        }
        
        if (
strpos($usergroup['image'], '{theme}') !== false) 
        
{
            $usergroup['image'] = str_replace('{theme}' $theme['imgdir'] , $usergroup['image']);
        } 
    
}
    
    
$post['groupimage'] = str_replace('<br />'''$post['groupimage']); // chrome fix
    
$post['additional_images'] .= "<div style='margin-top: 3px; padding: 0px;'></div>"// padding fix
    
return $post;

Zitieren
#6
Die Abfrage müßte davor rein:

PHP-Code:
function apgi (&$post)
{
    global 
$mybb$templates$cache$apgi$templates$theme;
    
$u_groups explode(","$post['additionalgroups']);
    
$usergroups_cache $cache->read("usergroups");
            
    foreach (
$u_groups as $groupID) {
        
$usergroup $usergroups_cache[$groupID];
        
        if (
strpos($usergroup['image'], '{theme}') !== false
        {
            
$usergroup['image'] = str_replace('{theme}' $theme['imgdir'] , $usergroup['image']);
        }

        if (!empty(
$usergroup['image']))
        {
            
$post['additional_images'] .= "<div style='margin-top: 3px; padding: 0px;'></div>"// Adding a <br /> tag between group images results in alignment issues on chrome. This seems to work better.  
            
eval("\$post['additional_images'] .= \"".$templates->get("postbit_groupimage")."\";");
        }
    }
    
    
$post['groupimage'] = str_replace('<br />'''$post['groupimage']); // chrome fix
    
$post['additional_images'] .= "<div style='margin-top: 3px; padding: 0px;'></div>"// padding fix
    
return $post;

Zitieren
#7
Vielen Dank, so klappt's  Big Grin

Im Profil-Abschnitt funktioniert's mit dieser Ergänzung (für alle, die es sonst noch interessiert):

PHP-Code:
       if (strpos($displaygroup['image'], '{theme}') !== false
 
       {
 
           $displaygroup['image'] = str_replace('{theme}' $theme['imgdir'] , $displaygroup['image']);
 
       
Zitieren
#8
Ich wei leider nicht wie man die zusätzlichen groupimages angeben soll kann mir da einer helfen
Zitieren
#9
Im Template mit {$post['additional_images']}
Mit freundlichen Grüßen

MrBrechreiz
Zitieren
#10
ja das habe ich geatn aber ich muss ja der gruppe mehrere images angeben oder nicht
Zitieren


Möglicherweise verwandte Themen…
Thema Verfasser Antworten Ansichten Letzter Beitrag
  Ajax Multiple Upload Attachment MyBB.de Bot 15 4.020 29.08.2020, 15:54
Letzter Beitrag: KarinB
  OUGC Additional Usergroup Images MyBB.de Bot 2 1.559 30.04.2020, 04:55
Letzter Beitrag: MyBB.de Bot
  OUGC Additional Usergroup Images MyBB.de Bot 0 1.170 23.03.2014, 14:10
Letzter Beitrag: MyBB.de Bot
  Additional Usergroup Images MyBB.de Bot 4 2.478 06.07.2013, 15:04
Letzter Beitrag: melancholia
  Multiple Registrations Detector MyBB.de Bot 0 1.679 11.08.2010, 07:37
Letzter Beitrag: MyBB.de Bot