diff -Naur -p drupal_old/profiles/drupalorg_testing/drupalorg_testing.profile drupal_new/profiles/drupalorg_testing/drupalorg_testing.profile
--- drupal_old/profiles/drupalorg_testing/drupalorg_testing.profile	2007-11-08 13:15:51.000000000 -0400
+++ drupal_new/profiles/drupalorg_testing/drupalorg_testing.profile	2007-12-07 21:47:15.952625000 -0400
@@ -74,8 +74,8 @@ function drupalorg_testing_profile_modul
     'legacy', 'path', 'profile', 'menu', 'search', 'statistics',
     'taxonomy', 'throttle', 'tracker', 'upload',
     // contrib modules
-    'codefilter', 'cvs', 'devel', 'project', 'project_issue', 'project_release',
-    'comment_upload',
+    'codefilter', 'cvs', 'devel', 'project', 'project_issue', 'project_issue_generate',
+    'project_release', 'comment_upload',
   );
 }
 
@@ -103,6 +103,7 @@ function drupalorg_testing_profile_final
   _drupalorg_testing_create_project_terms();
   _drupalorg_testing_create_content();
   _drupalorg_testing_configure_project_settings();
+  _drupalorg_testing_create_issues();
   _drupalorg_testing_create_menus();
   _drupalorg_testing_configure_blocks();
   _block_rehash();
@@ -648,6 +649,14 @@ function _drupalorg_testing_configure_pr
 }
 
 /**
+ * Generates sample issues.
+ */
+function _drupalorg_testing_create_issues() {
+  require_once(drupal_get_path('module', 'project_issue_generate') .'/project_issue_generate.inc');
+  project_issue_generate_issues(50);
+}
+
+/**
  * Generates sample project content.
  */
 function _drupalorg_testing_create_content_project() {
diff -Naur -p drupal_old/sites/all/modules/project_issue/generate/project_issue_generate.inc drupal_new/sites/all/modules/project_issue/generate/project_issue_generate.inc
--- drupal_old/sites/all/modules/project_issue/generate/project_issue_generate.inc	1969-12-31 20:00:00.000000000 -0400
+++ drupal_new/sites/all/modules/project_issue/generate/project_issue_generate.inc	2007-12-07 21:44:21.265125000 -0400
@@ -0,0 +1,178 @@
+<?php
+
+// If not in 'safe mode', increase the maximum execution time :
+if (!ini_get('safe_mode')) {
+  set_time_limit(240);
+}
+
+/**
+ * Generate some random project issues.
+ *
+ * @param $num
+ *  Number of issues to generate.
+ */
+function project_issue_generate_issues($num) {
+  require_once(drupal_get_path('module', 'devel') .'/devel_generate.inc');
+
+  $projects = _project_issue_generate_get_field('projects');
+  $categories = _project_issue_generate_get_field('categories');
+  $priorities = _project_issue_generate_get_field('priorities');
+  $users = _project_issue_generate_get_field('users');
+  $loaded_users = array();
+
+  for ($i = 0; $i < $num; $i++) {
+    srand((double) microtime() * 1000000);
+
+    $project = $projects[array_rand($projects)];
+    $components = unserialize($project->components);
+    $issue = array();
+    $issue['pid'] = $project->nid;
+    $issue['category'] = $categories[array_rand($categories)];
+    $issue['component'] = $components[array_rand($components)];
+    $issue['priority'] = array_rand($priorities);
+    $issue['title'] = devel_create_greeking(rand(2, 15), true);
+    $issue['body'] = devel_create_content();
+
+    // The user must be chosen before status (sid) so that we can make sure
+    // that the status is set such that the user would have permission to
+    // set the status as such.
+    $account = user_load(array('uid' => $users[array_rand($users)]->uid));
+    $issue['name'] = $account->name;
+    $issue['sid'] = array_rand(_project_issue_generate_get_permitted_sids($account));
+    if (!isset($issue['sid'])) {
+      unset($issue);
+      continue;
+    }
+
+    // Currently, project_issue nodes can either be unassigned or assigned
+    // to the user creating the project_issue node (or in the case of comments
+    // the user creating the comment).
+    $possible_assignments = array(0, $account->uid);
+    $issue['assigned'] = $possible_assignments[array_rand($possible_assignments)];
+
+    _project_issue_generate_drupal_execute('project_issue_node_form', $issue, array('type' => 'project_issue'));
+  }
+}
+
+function _project_issue_generate_get_field($field, $pool_size = 100) {
+  require_once(drupal_get_path('module', 'project_issue') . '/issue.inc');
+
+  switch($field) {
+    case 'projects':
+      $projects = array();
+
+      $result = db_query('SELECT nid, components FROM {project_issue_projects}');
+      while ($project = db_fetch_object($result)) {
+        $projects[] = $project;
+      }
+
+      return $projects;
+
+    case 'categories':
+      $categories = array_keys(project_issue_category());
+      return $categories;
+
+    case 'priorities':
+      $priorities = project_issue_priority();
+      return $priorities;
+
+    case 'users':
+      // Determine what role ids have permission to create project_issue nodes.
+      $users = array();
+      $allowed_roles = user_roles(FALSE, 'create project issues');
+
+      // If any authenticated user can create project_issue nodes,
+      // then there is no need for an INNER JOIN in our query.
+      // Otherwise, the query needs to INNER JOIN on the users
+      // table so that only users with roles that are allowed to
+      // create project_issue nodes are selected.
+      if (isset($allowed_roles[DRUPAL_AUTHENTICATED_RID])) {
+        $join = '';
+        $where = '';
+      }
+      else {
+        $join = 'INNER JOIN {users_roles} ur ON u.uid = ur.uid';
+        $where = "WHERE ur.rid IN (". implode(', ', array_keys($allowed_roles)) .")";
+      }
+      $sql = "SELECT u.uid FROM {users} u $join $where ORDER BY RAND() LIMIT %d";
+      $result = db_query($sql, $pool_size);
+      while ($user = db_fetch_object($result)) {
+        $users[] = $user;
+      }
+      return $users;
+  }
+}
+
+function _project_issue_generate_get_permitted_sids($user) {
+  static $permitted_states;
+
+  if (!isset($permitted_states)) {
+    $permitted_states = array();
+  }
+
+  if (isset($user->uid)) {
+    if (isset($permitted_states[$user->uid])) {
+      return $permitted_states[$user->uid];
+    }
+    else {
+      $states = project_issue_state($sid = 0, TRUE, TRUE, 0, FALSE, $user);
+      $permitted_states[$user->uid] = $states;
+      return $states;
+    }
+  }
+  return array();
+}
+
+/**
+ * Hack: Somehow $form_values gets populated inside drupal_process_form() when
+ *       this is submitted by a user but is not when using drupal_execute()
+ *       to programmaticaly send the project_issue form . . This fork of the
+ *       core code works by setting the $form_values parameter in drupal_execute()
+ *       to the global version and by removing $form_values = array() inside
+ *       process_form() as to not reset its contents.
+ */
+function _project_issue_generate_drupal_execute($form_id, $form_values) {
+  global $form_values;
+  $args = func_get_args();
+ 
+  $form_id = array_shift($args);
+  $form_values = array_shift($args);
+  array_unshift($args, $form_id);
+ 
+  if (isset($form_values)) {
+    $form = call_user_func_array('drupal_retrieve_form', $args);
+    $form['#post'] = $form_values;
+    return _project_issue_generate_drupal_process_form($form_id, $form);
+  }
+}
+
+function _project_issue_generate_drupal_process_form($form_id, &$form) {
+  global $form_values, $form_submitted, $user, $form_button_counter;
+  static $saved_globals = array();
+  // In some scenarios, this function can be called recursively. Pushing any pre-existing
+  // $form_values and form submission data lets us start fresh without clobbering work done
+  // in earlier recursive calls.
+  array_push($saved_globals, array($form_values, $form_submitted, $form_button_counter));
+ 
+  $form_submitted = FALSE;
+  $form_button_counter = array(0, 0);
+ 
+  drupal_prepare_form($form_id, $form);
+  if (($form['#programmed']) || (!empty($_POST) && (($_POST['form_id'] == $form_id)))) {
+    drupal_validate_form($form_id, $form);
+    // IE does not send a button value when there is only one submit button (and no non-submit buttons)
+    // and you submit by pressing enter.
+    // In that case we accept a submission without button values.
+    if ((($form['#programmed']) || $form_submitted || (!$form_button_counter[0] && $form_button_counter[1])) && !form_get_errors()) {
+      $redirect = drupal_submit_form($form_id, $form);
+      if (!$form['#programmed']) {
+        drupal_redirect_form($form, $redirect);
+      }
+    }
+  }
+ 
+  // We've finished calling functions that alter the global values, so we can
+  // restore the ones that were there before this function was called.
+  list($form_values, $form_submitted, $form_button_counter) = array_pop($saved_globals);
+  return $redirect;
+}
\ No newline at end of file
diff -Naur -p drupal_old/sites/all/modules/project_issue/generate/project_issue_generate.info drupal_new/sites/all/modules/project_issue/generate/project_issue_generate.info
--- drupal_old/sites/all/modules/project_issue/generate/project_issue_generate.info	1969-12-31 20:00:00.000000000 -0400
+++ drupal_new/sites/all/modules/project_issue/generate/project_issue_generate.info	2007-12-07 21:46:17.249500000 -0400
@@ -0,0 +1,4 @@
+name = Project issue generator
+description = Generate dummy issues.
+dependencies = project_issue devel
+package = Development
\ No newline at end of file
diff -Naur -p drupal_old/sites/all/modules/project_issue/generate/project_issue_generate.module drupal_new/sites/all/modules/project_issue/generate/project_issue_generate.module
--- drupal_old/sites/all/modules/project_issue/generate/project_issue_generate.module	1969-12-31 20:00:00.000000000 -0400
+++ drupal_new/sites/all/modules/project_issue/generate/project_issue_generate.module	2007-12-07 21:45:47.265125000 -0400
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * Implementation of hook_menu().
+ *
+ */
+function project_issue_generate_menu($may_cache) {
+  $items = array();
+
+  if ($may_cache) {
+    $items[] = array(
+      'path' => 'admin/project/generate_issue',
+      'title' => t('Generate issues'),
+      'description' => t('Generate a given number of issues.'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('project_issue_generate_issues_form'),
+      'access' => user_access('administer nodes'),
+    );
+  }
+
+  return $items;
+}
+
+function project_issue_generate_issues_form() {
+  $form['num'] = array(
+    '#type' => 'textfield',
+    '#title' => t('How many issues would you like to generate?'),
+    '#default_value' => 100,
+    '#size' => 10,
+  );
+  $form['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Do it!'),
+  );
+  return $form;
+}
+
+function project_issue_generate_issues_form_submit($form_id, $form_values) {
+  require_once('project_issue_generate.inc');
+  project_issue_generate_issues($form_values['num']);
+}
\ No newline at end of file
diff -Naur -p drupal_old/sites/all/modules/project_issue/issue.inc drupal_new/sites/all/modules/project_issue/issue.inc
--- drupal_old/sites/all/modules/project_issue/issue.inc	2007-12-07 11:17:14.000000000 -0400
+++ drupal_new/sites/all/modules/project_issue/issue.inc	2007-12-07 21:12:03.718250000 -0400
@@ -1,5 +1,5 @@
 <?php
-// $Id: issue.inc,v 1.279 2007/12/07 15:17:14 dww Exp $
+// $Id: issue.inc,v 1.278 2007/11/14 23:09:03 thehunmonkgroup Exp $
 // $Name:  $
 
 function project_issue_page() {
@@ -992,26 +992,31 @@ function project_issue_access($op, $node
 // Support stuff
 
 /**
- * Return information about project issue state values.
- *
- * @param $sid
- *   Integer state id to return information about, or 0 for all states.
- * @param $restrict
- *   Boolean to determine if states should be restricted based on the
- *   permissions of the current user.
- * @param $is_author
- *   Boolean that indicates if the current user is the author of the
- *   issue, which can potentially grant a wider selection of states.
- * @param $current_sid
- *   The current integer state id for the issue. 
- * @param $defaults
- *   Boolean to request the states used for default issue queries.
- *
- * @return
- *   An array of states (sid as key, name as value) that match the
- *   given filters, or the name of the requested state.
- */
-function project_issue_state($sid = 0, $restrict = false, $is_author = false, $current_sid = 0, $defaults = false) {
+* Return information about project issue state values.
+*
+* @param $sid
+*   Integer state id to return information about, or 0 for all states.
+* @param $restrict
+*   Boolean to determine if states should be restricted based on the
+*   permissions of the current user or $account if that parameter
+*   is provided.
+* @param $is_author
+*   Boolean that indicates if the current user is the author of the
+*   issue, which can potentially grant a wider selection of states.
+* @param $current_sid
+*   The current integer state id for the issue.
+* @param $defaults
+*   Boolean to request the states used for default issue queries.
+* @param $account
+*   Account of a user to pass to user_access() for access checking.
+*   This parameter will have no effect unless $restrict is also
+*   set to TRUE.
+*
+* @return
+*   An array of states (sid as key, name as value) that match the
+*   given filters, or the name of the requested state.
+*/
+function project_issue_state($sid = 0, $restrict = false, $is_author = false, $current_sid = 0, $defaults = false, $account = NULL) {
   static $options;
 
   if (!$options) {
@@ -1028,8 +1033,8 @@ function project_issue_state($sid = 0, $
       // or if user is original issue author and author has access,
       // or if the issue is already in a state, even if the user doesn't have
       //   access to that state themselves.
-      if (user_access('set issue status '. str_replace("'", "", $state->name))
-          || user_access('administer projects')
+      if (user_access('set issue status '. str_replace("'", "", $state->name), $account)
+          || user_access('administer projects', $account)
           || ($state->sid == variable_get('project_issue_default_state', 1))
           || ($state->author_has && $is_author)
           || ($state->sid == $current_sid) ) {
@@ -1045,7 +1050,6 @@ function project_issue_state($sid = 0, $
       $states[$state->sid] = $state->name;
     }
   }
-
   return $sid ? $states[$sid] : $states;
 }
 
