When trying to delete an consumer I get the following error:

Trying to get property of non-object in oauth_common_form_consumer_delete()

followed by a WSOD.

Looking at the function I assume the $consumer varible paste to it is in the wrong format. However this hack fixes it as well:
function oauth_common_form_consumer_delete($form_state, $consumer) {
drupal_set_message ("

".print_r($consumer, TRUE)."

$form = array(
'consumer_object' => array(
'#type' => 'value',
'#value' => $consumer['build_info']['args'][0],
'confirm' => array(
'#type' => 'item',
'#markup' => t('Are you sure you want to delete application @a?', array('@a' => $consumer['build_info']['args'][0]->name)),

gr w

Members fund testing for the Drupal project. Drupal Association Learn more


alejandrard’s picture

This hack will also works.

function oauth_common_form_consumer_delete_submit($form, &$form_state) {

  $consumer = $form_state['values']['consumer_object']['build_info']['args'][0];

  drupal_set_message(t('Deleted the consumer @name', array('@name' => $consumer->name)));

  drupal_goto(sprintf('user/%d/oauth/consumers', $consumer->uid));

alejandrard’s picture

After testing for a while found that it needed a little more than the hacks describe above.

Adding this two lines to the top of function oauth_common_form_consumer_delete and and change #value on consumer_object from $consumer to $consumer_object.

 $consumer_object = new stdClass();
 $consumer_object = $consumer['build_info']['args'][0];

Adding this two lines to the top of function oauth_common_form_consumer_delete_submit

 $consumer = new stdClass();
 $consumer = (object) $form_state['build_info']['args'][0];
alejandrard’s picture

Here is the patch for the comment #2

rjbrown99’s picture

Status: Active » Needs review

Patch here, changing status.