0

I have inherited an outdated Drupal 6 site with hacked modules. I did update core and all the modules that I could.

This php code is from a block for logging in. This redirects an authorized user to be directed to node-20.tpl.php.

<?php  global $user; ?>
<form action="<?php print "/{$base_path}user/login/?travelagents"?>" method="post" id="user-login">
  <div class="restrictedloginwrapper">
    <div class="restrictedlogin">
      <h4>CLIA number or Agent key:</h4>
      <input type="text" maxlength="60" name="name" id="edit-name" size="22" value="" tabindex="1" class="form-text required" />
      <input type="hidden" name="pass" size="20" value="password" />
      <input type="hidden" name="form_id" value="user_login" />
      <br>
      <input type="submit" align="middle" name="op" class="form-submit" id="edit-submit" tabindex="2" value="Log in" src="/<?php print path_to_theme() ?>/images/login.gif" alt="Submit" />
</form>

My client asked me to override the login for users without authentication (ultimately allowing anonymous users to login and see what authorized users see). The other requirement is that authorized users with their unique ID must still be able to use the login box and get redirected appropriately.

I have been able to create a way to automatically login using 00407606 (a special functional generic ID) in the value=field and if I change the text field to hidden a user can click the submit button and be logged in automatically and redirected appropriately. But applying this removes the ability for registered users to input their unique ID and login normally. This login is not the username-password of Drupal, it is a unique 8 digit number in a created table in the database.

Is there a php solution to do this? Is there some code in logintobbogan I could mimic/use? Am I looking for a javascript solution?

1

Hey if you have any idea about drupal form alter then go with http://api.drupal.org/api/drupal/developer!hooks!core.php/function/hook_form_alter/6.

hope this will help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.