? 4354.issue_inc.hook_patch_7.txt
Index: C:\www\project_testing\drupal\sites\all\modules\project_issue\issue.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/issue.inc,v
retrieving revision 1.297
diff -u -p -r1.297 issue.inc
--- issue.inc	8 Feb 2008 22:47:05 -0000	1.297
+++ issue.inc	3 Mar 2008 19:55:39 -0000
@@ -682,20 +682,12 @@ function project_issue_form($node) {
 
   // Setup the array of choices for who the issue is assigned to.
   $assigned = array();
-  if (empty($node->assigned)) {
-    $assigned[0] = t('Unassigned');
+  foreach (module_implements('project_issue_assignees') as $module) {
+    $function = "{$module}_project_issue_assignees";
+    $function($assigned, $node);
   }
-  else {
-    // It's currently assigned, so always let people unassign it.
-    $assigned[0] = t('Unassign');
-    if ($user->uid != $node->assigned) {
-      // Assigned to someone else, add the currently assigned user.
-      $account = user_load(array('uid' => $node->assigned));
-      $assigned[$node->assigned] = $account->name;
-    }
-  }
-  // Always let the person replying assign it to themselves.
-  $assigned[$user->uid] = $user->name;
+  natcasesort($assigned);
+  $assigned = array(0 => empty($node->assigned) ? t('Unassigned') : t('Unassign')) + $assigned;
 
   // Display the site-wide and/or per-project help text.
   $site_help = trim(variable_get('project_issue_site_help', ''));
@@ -894,6 +886,35 @@ function project_issue_view($node, $teas
 }
 
 /**
+ * Implementation of hook_project_issue_assignees()
+ * 
+ * This hook is used to modify the list of users presented to a user when
+ * editing or commenting on an issue.
+ * 
+ * @param $assigned
+ *  An array of key=>value pairs in the format of uid=>name that represent
+ *  the list of users that the issue may be assigned to. This parameter
+ *  is passed by reference so the hook may make changes, such as adding or
+ *  removing elements.
+ * @param $node
+ *  The node object for the issue being edited or commented on. The hook may
+ *  use the node's information in order to determine which users to add to or
+ *  remove from the list of potential assignees.
+ * @return
+ *  None.
+ */
+function project_issue_project_issue_assignees(&$assigned, $node) {
+  global $user;
+  if ($user->uid != $node->assigned) {
+    // Assigned to someone else, add the currently assigned user.
+    $account = user_load(array('uid' => $node->assigned));
+    $assigned[$node->assigned] = $account->name;
+  }
+  // Always let the person replying assign it to themselves.
+  $assigned[$user->uid] = $user->name;
+}
+
+/**
  * Themes the metadata table and internal page links for issue nodes.
  *
  * @param $summary_table_rows
