The scenario is :
I've implemented a menu using hook_menu and in that page it checks if user have access to creating certain content type (called request) if he/she does have access it will load content creation page using drupal_get_form else it checks if user is not logged in, in this case it loads user_login_block, again with drupal_get_form function, finally if user is logged in and still does not have access to create content type, it shows a message about that.
the problem is : I want user redirect to this same page after login, it redirects to user/uid by default.
This is the code for my page provider function :
Global $user;
$content = "";
if(user_access('create request content')){
module_load_include('inc', 'node', 'node.pages');
$node_form = new stdClass;
$node_form->type = 'request';
$node_form->language = LANGUAGE_NONE;
$form = drupal_get_form("request_node_form", $node_form);
$content .= drupal_render($form);
}
else
if($user->uid == 0) {
$login_form = drupal_get_form('user_login_block');
$login_form['redirect'] = drupal_get_destination();//What I did to get form redirected, but no chance
$content = '<p>For better controlling on your project flow consider signing in before submitting your file.</p>';
$content .= drupal_render($login_form);
}
else
$content = "Unfortunately only user of role customer can submit a request.report any problem by sending email to --------";
return $content;
I also tried Login Destination but it neither worked.