MyBB Hacks

Full Version: Memberlist mod
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
vbulletin has it set so there's a button to sort the memberlist back to before you originally sorted it.

if you look at this memberlist:
http://forum.pafoa.org/memberlist.html?o...http://forum.pafoa.org/memberlist.html?order=DESC&sort=p

I sorted it by the users with the most posts, but there's a V or some sort of arrow next to the word 'posts' to reverse the order.
Just request this as a feature to MyBB.
None of the column headers sort, and it wasn't designed with that in mind.
Please pardon this necrophilia / threadjacking but I think the OP is done with this thread, and it's exactly what I'm interested in.

(04-19-2010 07:20 AM)RateU Wrote: [ -> ]
(04-17-2010 09:56 AM)Shemo Wrote: [ -> ]=(  ok..I just like to be able to click the titles and sort it.

I think you can use sorting url like this in your memberlist template:

(Example sorting url for most posts)

HTML Code
<a href="memberlist.php?sort=postnum&amp;order=desc&amp;perpage={$mybb->input['perpage']}">{$lang->posts}</a>


I tried that--it worked perfectly.

But I also tried it on the "Style" column (which I've added to the memberlist because I'm trying to find a way to find all users of the different styles I have installed) and it simply does not sort.

This is what I've tried:

HTML Code
<a href="memberlist.php?sort=style&amp;order=asc&amp;perpage={$mybb->input['perpage']}">Style</a>


Any idea why?

You'll need to make a code edit because the underlying code doesn't sort by style.

Find the following code in memberlist.php:

PHP Code:
	switch($mybb->input['sort'])
	{
		case "regdate":
			$sort_field = "u.regdate";
			break;
		case "lastvisit":
			$sort_field = "u.lastactive";
			break;
		case "reputation":
			$sort_field = "u.reputation";
			break;
		case "postnum":
			$sort_field = "u.postnum";
			break;
		default:
			$sort_field = "u.username";
			$mybb->input['sort'] = 'username';
			break;
	}

Use your intuition to stick in your style sorting.  It's probably something like this:

PHP Code:
	switch($mybb->input['sort'])
	{
		case "regdate":
			$sort_field = "u.regdate";
			break;
		case "lastvisit":
			$sort_field = "u.lastactive";
			break;
		case "reputation":
			$sort_field = "u.reputation";
			break;
		case "postnum":
			$sort_field = "u.postnum";
			break;
		case "style":
			$sort_field = "u.style";
			break;
		default:
			$sort_field = "u.username";
			$mybb->input['sort'] = 'username';
			break;
	}


Haven't tried, but hopefully it works.

Ahhhhh.

Actually, I'd originally wanted to add a search field but when that didn't work I'd decided to try sorting (and manually finding the specific rows I wanted).

But looking memberlist.php I can see now why the searching didn't work, so I'll go back and take a crack at that.

Cheers bud, you're a star.
Pages: 1 2
Reference URL's