Neler yeni

Foruma hoş geldin 👋, Ziyaretçi

Forum içeriğine ve tüm hizmetlerimize erişim sağlamak için foruma kayıt olmalı ya da giriş yapmalısınız. Foruma üye olmak tamamen ücretsizdir.

  • Forumdan daha fazla yararlanmak için, profilinizi telefon numaranız 📱 ile doğrulayın ve daha ayrıcalıklı olun 😉
    Daha fazla bilgi!

Nasıl yapılır ? @ Bahsetme Renk Değişimini Kullanıcı Gruplarına Göre Nasıl Yaparım?

PlayStation Haber

Sabit kullanıcı
SMS onaylı
Kullanıcı
Katılım
3 Haz 2020
Mesajlar
92
Merhaba arkadaşlar, konular da üyeleri etiketlerken yazı renginin üye gruplarına göre yapmak istiyorum. Bu kodları kullanıyorum. Yardımlarınız için şimdiden teşekkürler. 👍

eTiKeT™ eTiKeT™ @netr0n <== Etiketleme

Kod:
//--- [XGT] Konu ici kullanici adi vurgusu.
 .bbWrapper [data-xf-init="member-tooltip"]
{
        color: #0078d4;                // Renk
        font-weight: bold;          // Kalın font
        font-size: 18px;            // Font boyutu
        text-decoration: none; // Alti cizik
   
    //-- FA ikon ekle.
    &:before
    {
        font-family: 'Font Awesome 5 Pro';
        padding: 0px 2px;
        content: "\f507";           // FA İkon unicode  
    }
}
 
\src\XF\BbCode\Renderer> Html.php dosyasına giriniz aşağıdaki kodu aratınız.

public function renderTagUser(array $children, $option, array $tag, array $options)

bulduğunuz kod içeriğini başlangıç ve bitiş kısmı yani aşağıdaki gibi olması gerekiyor.

Kod:
public function renderTagUser(array $children, $option, array $tag, array $options)
    {
        $content = $this->renderSubTree($children, $options);
        if ($content === '')
        {
            return '';
        }

        $userId = intval($option);
        if ($userId <= 0)
        {
            return $content;
        }

        return $this->getRenderedUser($content, $userId);
    }

    protected function getRenderedUser($content, int $userId)
    {
        $link = \XF::app()->router('public')->buildLink('full:members', ['user_id' => $userId]);

        return $this->wrapHtml(
            '<a href="' . htmlspecialchars($link) . '" class="username" data-xf-init="member-tooltip" data-user-id="' . $userId .  '" data-username="' . $content . '">',
            $content,
            '</a>'
        );
    }

kod silip aşağıdaki kodu ekleyebilirsiniz. vermiş olduğunuz kullanıcı grup renkleri otomatik olarak bahsetmelerde çıkıcaktır.

Kod:
protected static $usersTagged = [];
    public function renderTagUser(array $children, $option, array $tag, array $options)
    {
        $content = $this->renderSubTree($children, $options);
        if ($content === '')
        {
            return '';
        }
        $userId = intval($option);
        if ($userId <= 0)
        {
            return $content;
        }
        if (empty(self::$usersTagged[$userId]))
        {
            $user = \XF::app()
                ->em
                ->find('XF:User', $userId);
            self::$usersTagged[$userId] = $user;
        }
        else
        {
            $user = self::$usersTagged[$userId];
        }
        $link = \XF::app()->router('public')
            ->buildLink('full:members', ['user_id' => $userId]);
        return $this->wrapHtml('<a href="' . htmlspecialchars($link) . '" class="username" data-xf-init="member-tooltip" data-user-id="' . $userId . '" data-username="' . $content . '">', '<span class="username--style' . $user['display_style_group_id'] . '">' . $content . '</span>', '</a>');
    }



Screenshot_1.png
 
Tüm arkadaşlara verdikleri bilgiler ve yardımlar için teşekkürlerimi sunuyorum. Gerekli düzenlemeleri yapıp hemen uygulamaya geçiyorum. ☺️
 
\src\XF\BbCode\Renderer> Html.php dosyasına giriniz aşağıdaki kodu aratınız.

public function renderTagUser(array $children, $option, array $tag, array $options)

bulduğunuz kod içeriğini başlangıç ve bitiş kısmı yani aşağıdaki gibi olması gerekiyor.

Kod:
public function renderTagUser(array $children, $option, array $tag, array $options)
    {
        $content = $this->renderSubTree($children, $options);
        if ($content === '')
        {
            return '';
        }

        $userId = intval($option);
        if ($userId <= 0)
        {
            return $content;
        }

        return $this->getRenderedUser($content, $userId);
    }

    protected function getRenderedUser($content, int $userId)
    {
        $link = \XF::app()->router('public')->buildLink('full:members', ['user_id' => $userId]);

        return $this->wrapHtml(
            '<a href="' . htmlspecialchars($link) . '" class="username" data-xf-init="member-tooltip" data-user-id="' . $userId .  '" data-username="' . $content . '">',
            $content,
            '</a>'
        );
    }

kod silip aşağıdaki kodu ekleyebilirsiniz. vermiş olduğunuz kullanıcı grup renkleri otomatik olarak bahsetmelerde çıkıcaktır.

Kod:
protected static $usersTagged = [];
    public function renderTagUser(array $children, $option, array $tag, array $options)
    {
        $content = $this->renderSubTree($children, $options);
        if ($content === '')
        {
            return '';
        }
        $userId = intval($option);
        if ($userId <= 0)
        {
            return $content;
        }
        if (empty(self::$usersTagged[$userId]))
        {
            $user = \XF::app()
                ->em
                ->find('XF:User', $userId);
            self::$usersTagged[$userId] = $user;
        }
        else
        {
            $user = self::$usersTagged[$userId];
        }
        $link = \XF::app()->router('public')
            ->buildLink('full:members', ['user_id' => $userId]);
        return $this->wrapHtml('<a href="' . htmlspecialchars($link) . '" class="username" data-xf-init="member-tooltip" data-user-id="' . $userId . '" data-username="' . $content . '">', '<span class="username--style' . $user['display_style_group_id'] . '">' . $content . '</span>', '</a>');
    }



Ekli dosyayı görüntüle 21532
Konu eski ama bu kullanıcıları bold olarak alabilir miyiz? MusaPekel MusaPekel hocam
 

Foruma hoş geldin 👋, Ziyaretçi

Forum içeriğine ve tüm hizmetlerimize erişim sağlamak için foruma kayıt olmalı ya da giriş yapmalısınız. Foruma üye olmak tamamen ücretsizdir.