Skip to main content
Topic: Memberlist Revamp (Read 3067 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Memberlist Revamp

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.

Re: Memberlist Revamp

Reply #1

I got error for not putting the label and the class, so I added them in. OP is updated.
Last Edit: January 14, 2015, 06:34:09 am by ahrasis

Re: Memberlist Revamp

Reply #2

Not a bad idea have the avatar there! :D
Bugs creator.
Features destroyer.
Template killer.

Re: Memberlist Revamp

Reply #3

Great idea ...  ;D  Maybe we should add to 1.03 ?

Re: Memberlist Revamp

Reply #4

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?  ::)

Re: Memberlist Revamp

Reply #5

Should be one-liner in custom.css, do we really need a setting for that?

Code: [Select]
#memberlist .avatar {display: none}
Thorsten "TE" Eurich
------------------------

Re: Memberlist Revamp

Reply #6

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. 

Re: Memberlist Revamp

Reply #7

Either way is fine with me. I personally don't mind. ;) I will send the PR soon.

Re: Memberlist Revamp

Reply #8

PR is sent.