avatar_orhan

Default Avatar (Kullanıcı isminin ilk harfi)

Started by orhan, Aug 07, 2020, 12:52 PM

Previous topic - Next topic
Topic keywords [SEO] avatarDefaultKullanıcıismininilk
Aug 07, 2020, 12:52 PM Last Edit: Aug 07, 2020, 12:57 PM by orhan
./Sources/Load.php

Bul:
// Are we also loading the members custom fields into context?
Öncesine Ekle:
// Default Avatar by Username (no images).
 if($memberContext[$user]['avatar']['image'] == '')
 {
 preg_match('/^[a-z]/i', $memberContext[$user]['name'], $damatch);
 $damatch = empty($damatch) ? '?' : $damatch[0][0];
 $uhash = md5($memberContext[$user]['name']);
 $memberContext[$user]['avatar'] = array(
 'name' => '',
 'image' => '<span class="avatar" style="background-color:#' . substr($uhash, 0, 2) . substr($uhash, 2, 2) . substr($uhash, 4, 2) . '" >' . $damatch . '</span>',
 'href' => '',
 'url' => '',
 );
 }

./Sources/Subs.php

Bul:
// Figure out how long they've been logged in.
Öncesine Ekle:

// Default Avatar by Username (no images).
 if(empty($context['user']['avatar']['image']))
 {
 preg_match('/^[a-z]/i', $context['user']['name'], $damatch);
 $damatch = empty($damatch) ? '?' : $damatch[0][0];
 $uhash = md5($context['user']['name']);
 $context['user']['avatar'] = array(
 'name' => '',
 'image' => '<span class="avatar" style="background-color:#' . substr($uhash, 0, 2) . substr($uhash, 2, 2) . substr($uhash, 4, 2) . '" >' . $damatch . '</span>',
 'href' => '',
 'url' => '',
 );
 }

Temanizin css dosyasına ekleyin

span.avatar {
 font-weight: 300;
 width: 100px;
 height: 100px;
 border-radius: 60px;
 font-size: 70px;
 line-height: 90px;
 box-sizing: content-box;
 color: #FFF;
 text-align: center;
 vertical-align: top;
 display: inline-block;
 text-transform: uppercase;
}