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.
By bol3ez on
Im using hybridauth to let users login from different social media websites ...
I send emails to some users with an link to edit a specific node (for example http://example.com/node/444/edit).
At that moment the user is automatically redirected to a page to choose a social media he want to login with.
Im using hook_init
for this :
function MYMODULE_init(){
if($node->type == 'type' && other conditions){
drupal_goto('link_to_hybridauth_login_page');
}
}
Now I want that user to be automatically redirected to that edit node page (http://example.com/node/444/edit) after logged in via hybridauth ( I tried to add destination query inside drupal_goto but not working.)
how can I do this redirection ?
Thanks in advance.
Comments
Redirection from hybridauth
Redirection from hybridauth depends on hybridauth system.
you are passing destination query but check whether hybridauth is appending that query in URL or not?
Thanks,
Vijay Thummar
No it's not appending that query
No, hybridauth it's not appending that query, because I tried to append the query inside
hook_init()
.drupal_goto('hybridauth_authentication_page', array('query' => array('destination' => '/node/'.arg(1).'/edit')))
these are the steps to clarify more this workflow :
hook_init()
check the url, get thenid
from this url, check some conditions then redirect him to hybridauth pageSo only inside that
hook_init()
that I have access to the node object, otherwise if I use hybridauth rules to set a destination for example, I can't get the node edit url anymore.