You are here

function _realname_sort in Real Name 5

Same name and namespace in other branches
  1. 6 realname.module \_realname_sort()

Provides array sorting function for uasort. @link http://us2.php.net/manual/en/function.uasort.php PHP Manual @end-link

Parameters

$a - the first array to be compared.:

$b - the second array to be compared.:

Return value

integer indicating ordering.

2 string references to '_realname_sort'
realname_admin_settings in ./realname.module
Displays the admin settings form.
realname_admin_settings_submit in ./realname.module
Form submit handler.

File

./realname.module, line 405
The RealName module allows the admin to choose fields from the user profile that will be used to add a "realname" element (method) to a user object. Hook_user is used to automatically add this to any user object that is loaded.

Code

function _realname_sort($a, $b) {

  // Sort first by weight.
  $ret = $a['weight'] - $b['weight'];
  if ($ret == 0) {

    // The two are equal, so use the title.
    $ret = strcmp($a['title'], $b['title']);
  }
  return $ret;
}