Fixed Subversion Access -> Delete

azbok - December 9, 2007 - 21:11
Project:Subversion
Version:5.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

The confirmation page wasn't loading correctly, it's a very simple change to fix it. It turns out that there was 2 issues:
#1 confirm_form had a mixed up first parameter
#2 drupal_get_form wasn't triggering the form function, so the page was just displaying the literal text 'Array'

I'm no expert on the way forms work and it seems silly to have a single line in a function like this, but it works. There's probably a better way though.

/**
* Callback for removing a uid as a subversion maintainer from a given project.
*/
function subversion_project_delete_access($nid, $uid) {
  return drupal_get_form('subversion_project_delete_access_confirm', $nid, $uid);
}

function subversion_project_delete_access_confirm($nid, $uid) {
  $user = db_fetch_object(db_query("SELECT name, uid FROM {users} WHERE uid = %d", $uid));
  $form['nid'] = array('#type' => 'value', '#value' => $nid);
  $form['uid'] = array('#type' => 'value', '#value' => $uid);
  $form['user'] = array('#type' => 'value', '#value' => $user);

  return confirm_form($form,
            t('Are you sure you want to delete Subversion access for %user?',
              array('%user' => theme('username', $user))),
            "node/$nid/subversion-access",
            t('This action cannot be undone.'),
            t('Delete'),
            t('Cancel'));
}

 
 

Drupal is a registered trademark of Dries Buytaert.