Hi there

Really stoked to find this great little module. But I'm still a newbie to Drupal and was just wanting a bit more explaination on where to add the $path in the code. It would be nice to be able to set this in the user settings with the email template?

I also would really, really like the feature to send a one time link to all users. I'm not so gifted to add the code, button etc. Not sure of all your the reasons not to add it. Couldn't a warning message be used? Adding it to the "User list" page in the "Update options" dropdown would be fantastic.....

Any help would be appreciated
Tan

Comments

danielb’s picture

But I'm still a newbie to Drupal and was just wanting a bit more explaination on where to add the $path in the code. It would be nice to be able to set this in the user settings with the email template?

I don't understand that question. Are you familiar with PHP?

I also would really, really like the feature to send a one time link to all users.

You can easily make a script like so to do that:

<?php
$path = 'whatever/path/to/start';
$result = db_query("SELECT uid FROM {users}");
while ($row = db_fetch_array($result)) {
  $account = user_load(array('uid' => $row['uid']));
  login_one_time_send_mail($account, $path);
}
?>
I'm not so gifted to add the code, button etc. Not sure of all your the reasons not to add it. Couldn't a warning message be used? Adding it to the "User list" page in the "Update options" dropdown would be fantastic.....

I don't understand the suggestion.

tanma’s picture

Sorry, I'm not so familiar with PHP - but with some simple directions I can often manage.

My key question was - where do I set the path?

When I click the "Send one time login link to xxx" it sends the email and generates a one time link that has a path set to the user details page. I want just want the sites home page.

You mentioned in the module usage that:

If you would like them to start on a particular page, you can add an extra parameter $path like so:
print login_one_time_button($account, $path);

I guess it is obvious but could you please give some basic directions on where to put this code?

danielb’s picture

Put the code wherever you need it mate, in a node template or something.
The path they will go to is the value of $path.
You really need to learn some basic PHP :/ I can't teach that to you here.
php.net/manual

tanma’s picture

If I'm not mistaken this code will give an a new button?

I just want to modify the path for the exisitng button that appears on the user account page.

The only place I see to set the path is in the login_one_time.module, I'll try adding the path here:
'#value' => login_one_time_button($account, "http://mysite/?q=node/99"),

/**
 * Implementation of hook_user().
 */
function login_one_time_user($op, &$edit, &$account, $category = NULL) {
  switch ($op) {
    case 'view':
      if (user_access('send link to login one time')) {
        $account->content['login_one_time'] = array(
          '#title' => t('One-time login'),
          '#type' => 'item',
          '#value' => login_one_time_button($account),
          '#weight' => 10,
        );
      }
      break;
  }
}
tanma’s picture

Status: Active » Closed (fixed)

No worries now.
I managed to get what I want.
Not ideal but will do for immediate needs.