I have zero experience with PHP. I am trying to extend developer portal by calling API which automatically approves App instead of putting it in Pending state when a developer changes the OAuth callback URL.
I am unable to invoke /var/www/html/profiles/apigee/modules/custom/devconnect/devconnect_developer_apps/devconnect_developer_apps.api.php - hook_devconnect_developer_app_presave(). I have added below code
function hook_devconnect_developer_app_presave(array &$form_state) { dd('Presave app!'); $form_state['values']['attribute_drupal_uid'] = $form_state['values']['uid']; $new_callback_url = $form_state['values']['new_callback_url']; watchdog('devconnect_developer_apps', 'new_callback_url, %new_callback_url',array('%node_title' => $node->title), WATCHDOG_INFO, NULL); return TRUE; }
I don't see any messages written to admin/reports/dblog. Any idea why hook_devconnect_developer_app_presave() is not getting called when I edit my app from devportal user/<user-id>/apps/<app-id>/edit-app
Solved! Go to Solution.
Dear @Vineet Bhatia ,
You need to replace hook word with your custom MODULENAME . Clear the caches & check.
function YOURMODULENAME_devconnect_developer_app_presave(&$form_state) { dd('Presave app!'); $form_state['values']['attribute_drupal_uid'] = $form_state['values']['uid']; $new_callback_url = $form_state['values']['new_callback_url']; watchdog('devconnect_developer_apps', 'new_callback_url, %new_callback_url',array('%node_title' => $node->title), WATCHDOG_INFO, NULL); return TRUE; }
Find more about hooks here
HI @Vineet Bhatia You should be able to do it OOB without doing any custom coding. If you just edit the callback URL it should just edit the callback URL without changing the status of the app. I just tried it and it worked for me.
Am I missing something ?
@sarthak For us whenever we change callback URL from DevPortal (logged in as Developer) the application goes into Pending status. We do want manual approval when developer signs up and creates a new application.
@sarthak You are correct. Today when I tried changing callback url the app does not go back to pending status. Very strange, earlier the app would go into pending status.
Dear @Vineet Bhatia ,
You need to replace hook word with your custom MODULENAME . Clear the caches & check.
function YOURMODULENAME_devconnect_developer_app_presave(&$form_state) { dd('Presave app!'); $form_state['values']['attribute_drupal_uid'] = $form_state['values']['uid']; $new_callback_url = $form_state['values']['new_callback_url']; watchdog('devconnect_developer_apps', 'new_callback_url, %new_callback_url',array('%node_title' => $node->title), WATCHDOG_INFO, NULL); return TRUE; }
Find more about hooks here
Thanks @Anil Sagar We are able to get the hook to fire after creating small custom module.
<?php function il_app_approval_devconnect_developer_app_presave(&$form_state) { drupal_set_message('Presave app!'); drupal_set_message(var_export($form_state, TRUE)); return TRUE; } function il_app_approval_devconnect_developer_app_save(array $results, array &$form_state) { drupal_set_message('Save app!'); drupal_set_message(json_encode($results)); drupal_set_message(json_encode($form_state)); return TRUE; } ?>
@Vineet Bhatia , Glad issue is resolved 🙂
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |