In the home page of main site, I am listing all the products. Buyer has logged into the main site and clicks on any product title or image, then I take the buyer to the corresponding sub domain individual product page. In the redirected page or site I want the buyer to logged in since I am using the same database.
This is what I have done for that to happen:
- I am using the Rules module to redirect from one site to another site.
- The Rules Event I am using is Content is viewed, but actually it doesn't get called at all.
- In Rules I am using page redirect action with value
http://[node:author].[site:url-brief]/ajax_callback.php?context=buyer-redirect&username=[account:name]&nid=[node:nid]
In my ajax_callback.php
file I have used this code:
case 'buyer-redirect':
global $user;
$username = $_REQUEST['username'];
$user = user_load_by_name($username);
$login_array = array ('name' => $username);
user_login_finalize($login_array);
$nid = $_REQUEST['nid'];
drupal_goto('node/' . $nid);
But in the sub domain still I am not logged in as buyer.
Above mentioned is a PHP file where I am manipulating the requests, but Rules Event "Content is viewed" is not all getting invoked.
How can I make buyer login info to be send and make the buyer to be automatically logged in which clicking on a link in main site?
Any suggestions?