Using multiple sort criteria on a view, can't get them to play nicely So, I have a view (D7, Views 3) that provides a list of staff with a thumbnail image based on a location "contextual filter". Some staff members are set as "sticky" and need to appear above all the others. All staff members also need to be sorted by last name, which i'm doing with a custom php sort.

So, first, stickied staff members should be shown sorted by last name. Next, unstickied staff should be shown also sorted by last name.

Last name sort works great, but I can't get the view to group them by sticky.

Here's a screenshot of the view: http://grab.by/h2Gg
Here's a screenshot of the first part of the output: http://grab.by/h2GA (Jeremy Irwin is stickied, so should display at the top)

Here's the php code i'm using for the last name sort: 

list($fname1, $lname1) = explode(' ', $row1-&gt;title , 2);
list($fname2, $lname2) = explode(' ', $row2-&gt;title , 2);
return(strcasecmp($lname1,$lname2));


Any suggestions why this isn't playing nicely with sorting by sticky?
So, first, stickied staff members should be shown sorted by last name. Next, unstickied staff should be shown also sorted by last name.


So you want 2 views (1 being an Attachment) and not 1 View. and you can do all this.


1 View is of all the people fields with only stickied people as a
filter. Sorted by last name.
The Attachment is all non-stickied people sorted by last name. You then 
"attach" this View after the 1st view. Get the page to look how you
want using CSS in your theme.


As a final thought I tend to make 2 fields in my content types: first_name and last_name and then join them as a pseudo-field in Views using substitutions or use the Node Automatic Title to hide the title field by using the fname and lname as the title field upon save.

You could change your name column into 2 fields using Views Bulk Operations after creating the "last name" field in your content type ... just saying.

EDIT

The benefits to this approach is that you get rid of the odd custom sorting you've hand made and rely on Core Views utilities on your site. This makes moving your site or upgrading drupal versions easier in the long run ...