ElkArte Community

Elk Development => Theme development => Topic started by: ahrasis on January 14, 2015, 01:01:12 am

Title: Memberlist Revamp
Post by: ahrasis on January 14, 2015, 01:01:12 am
I was playing with memberlist and couldn't find avatar setting for it. So I added avatar to my memberlist controller and subs.

Memberlist.subs.php
Code: [Select]
		$context['members'][$member]['real_name'] = $context['members'][$member]['link'];
$context['members'][$member]['avatar'] = '<a href="' . $context['members'][$member]['href'] . '" target="_blank" class="new_win">' . $context['members'][$member]['avatar']['image'] . '</a>';

Memberlist.controller.php
Code: [Select]
			'avatar' => array(
'label' => '',
'class' => '',
),
'real_name' => array(
'label' => $txt['username'],
'class' => 'username',
'sort' => array(
'down' => 'mem.real_name DESC',
'up' => 'mem.real_name ASC'
),
),
'online' => array(
'label' => $txt['status'],
'class' => 'status',
'sort' => array(
'down' => allowedTo('moderate_forum') ? 'IFNULL(lo.log_time, 1) ASC, real_name ASC' : 'CASE WHEN mem.show_online THEN IFNULL(lo.log_time, 1) ELSE 1 END ASC, real_name ASC',
'up' => allowedTo('moderate_forum') ? 'IFNULL(lo.log_time, 1) DESC, real_name DESC' : 'CASE WHEN mem.show_online THEN IFNULL(lo.log_time, 1) ELSE 1 END DESC, real_name DESC'
),
),

index.css
Code: [Select]
#memberlist .status {
width: 20px;
}
#memberlist .avatar.avatarresize {
width: 2.4em;
heigth: 2.4em;
margin: -4px -1.5em -8px 0;
}

The logic of moving the status is that it is too hidden to the left. I am not sure how to add option to display avatar yet but, so far, it is already looking good with the avatar on both normal and mobile browser.
Title: Re: Memberlist Revamp
Post by: ahrasis on January 14, 2015, 04:53:12 am
I got error for not putting the label and the class, so I added them in. OP is updated.
Title: Re: Memberlist Revamp
Post by: emanuele on January 14, 2015, 05:07:13 am
Not a bad idea have the avatar there! :D
Title: Re: Memberlist Revamp
Post by: Spuds on January 14, 2015, 11:06:09 am
Great idea ...  ;D  Maybe we should add to 1.03 ?
Title: Re: Memberlist Revamp
Post by: ahrasis on January 14, 2015, 04:01:39 pm
That would be great. If you want, I can PR that later. But don't you think it is better to have admin setting to enable / disable avatar for memberlist? Some admin might want it plain and simple right?  ::)
Title: Re: Memberlist Revamp
Post by: TE on January 14, 2015, 04:41:33 pm
Should be one-liner in custom.css, do we really need a setting for that?

Code: [Select]
#memberlist .avatar {display: none}
Title: Re: Memberlist Revamp
Post by: Spuds on January 14, 2015, 07:49:52 pm
Please do make the PR  :)   and +1 to what TE said, its easy to turn off with just CSS, so lets do that and try and resist the urge to add additional ACP options. 
Title: Re: Memberlist Revamp
Post by: ahrasis on January 14, 2015, 11:52:38 pm
Either way is fine with me. I personally don't mind. ;) I will send the PR soon.
Title: Re: Memberlist Revamp
Post by: ahrasis on January 15, 2015, 02:42:12 am
PR is sent.