Hello,

I found this solution to close automodal window on button submit:

Login

Is this the correct way. I am rusty with php and or JS, but basically I want my 'class=automodal' on links to close and reload parent page sitewide.... Is this link structure above the correct way to handle this function?

Comments

back from 7’s picture

Sorry... Login code should be <a class="automodal" href="user/login?automodalReload=true">Login</a>

gmclelland’s picture

That worked, but I have two question for you @joedevdrupal:

1. How do you construct this link with the drupal l function l();

2. Is there a way to also redirect the user to a different page after logging in? Maybe using the Rules module would work?

back from 7’s picture

Here is the link im using to edit user profile page... I had to have someone else help me with this.

Hope this helps direct you in the right way. I think Rules would work for redirecting after login.


<?php
global $user;
echo "<a href=\"/design/user/".$user->uid . "/edit/uprofile?automodalReload=true\" class=\"automodal\">Edit Your Profile</a>";
?>

gmclelland’s picture

Thanks,
Here is the solution for anybody else needing it.

  // if visitor is logged out
  print l('Login',
  'user/login',
  array(
  'attributes' => array(
    'class' => 'automodal',), 
    'query' => 'automodalReload=true')
    ) . ' or ' . l('Sign Up','user/register', array(
  'attributes' => array(
    'class' => 'automodal',
    )
  )
  ) . t(' for more features');

Also for the redirects you might be able to use this module:
http://drupal.org/project/automodal_url

Hope that helps someone,
-Glenn

remydenton’s picture

Thanks for posting your solution Glenn-- it certainly helped me! Your formatting confused me a little bit though (looks like the query is inside the attributes array, which it's not), so I'm posting a slightly adjusted version to help others avoid the same pitfall:

  // if visitor is logged out
  print l(
    'Login', 
    'user/login',
    array(
      'attributes' => array('class' => 'automodal'), 
      'query' => 'automodalReload=true',
    )
  ); 
dsnopek’s picture

Issue summary: View changes
Status: Active » Fixed

Solutions here look good! Closing.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.