Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
hi, i want make this but for user when register, my idea is when a person register, redirect to edit your profile, this work but redirect to user/0/edit how can detect the user id later of register .
thanks
function my_module_services_postprocess(options, result){
try {
var user_id = Drupal.user.uid;
if (options.service == 'user') {
if (options.resource == 'register') {
//drupalgap.settings.front = any where;
drupalgap_goto("user/"+user_id+"/edit");
}
else if (options.resource == 'logout') {
drupalgap.settings.front = 'user/login';
}
}
}
catch (error) {
console('mymodule_services_postprocess - ' + error);
}
Comments
Comment #2
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedIt sounds like the user is not being automatically logged in upon registration. I know there is an Account settings in Drupal that will allow the user to auto login upon registration, but the question is whether or not the Services module takes this into account. That'd have to be verified outside of DrupalGap, using something like FireFox Poster to manually register a user, then open the Drupal site in a new FireFox tab and see if it auto logs them in. (see the user registration example: http://tylerfrankenstein.com/user/4/code/drupal-services-examples)
If it does, then DrupalGap should work properly. Take a look at how DrupalGap handles the user registration form submission in the app, you can see it tries to handle various scenarios:
https://github.com/signalpoint/DrupalGap/blob/7.x-1.x/src/modules/user/u...
I also think the user_register_form_submit() function should use form.action as its path to drupalgap_goto(), so I think you can use that services post processor on the user register, and then load the form from local storage using drupalgap_form_local_storage_load(), set its action, then set it back into local storage with drupalgap_form_local_storage_save(), a little hacky, but it should get the job done.
Comment #3
jomarocas CreditAttribution: jomarocas as a volunteer commentedsorry i try many times without exit, this function "drupalgap_form_local_storage_load()" and ""drupalgap_form_local_storage_load("user_register")"" no load nothing, and the hook install only works the first time in front page, any other idea or example, thanks