Here is a port of Login History for Drupal 6.

Attached is a .tar.gz for the module, and a patch to show the differences between the D7 version (with #1691474: Convert files to unix line endings applied first).

I'd also like to volunteer to help maintain the D6 and D7 versions of this module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greggles’s picture

hi cottser - thanks for the code and many patches! I hope to review these in the near future.

I've asked another potential co-maintainer to review the patches so I guess we'll go from there :)

a_thakur’s picture

Status: Needs review » Needs work
FileSize
112.75 KB

Hi,

Is there a bug in the d6 port but when I went through the code and functionality of d7 version, it has the same bug.

In case the admin navigates to http://example.com/user/2/login_history (I am taking an example for a user with uid 2). In this case the login history of the user with uid should be displayed but the results show the login history of all the users(attached screen shot would give a better overview). The user is test in this case, but the results show the login history of admin too. The same bug is present in d7 version too.

Apart from that, "_" should be avoided in menu items, instead it should be replaced with "-". So the menu item would be

/**
 * Implements hook_menu().
 * Define menu items and page callbacks.
 *
 * @return
 *   An array of menu items.
 */
function login_history_menu() {
  $items = array();
  $items['admin/reports/login-history'] = array(
    'title' => 'Login history',
    'description' => 'Shows previous login information for site users. Useful for troubleshooting and monitoring.',
    'page callback' => 'login_history_report_callback',
    'access arguments' => array('administer users'),
    'file' => 'includes/login_history.pages.inc',
  );
  $items['user/%user/login-history'] = array(
    'title' => 'Login history',
    'description' => '',
    'page callback' => 'login_history_report_callback',
    'page arguments' => array(1),
    'access callback' => 'login_history_access_user_history_page',
    'access arguments' => array(1),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/login_history.pages.inc',
  );
  return $items;
}

There is a coding standard error on line# 87 in login_history.pages.inc, else statement should begin on a new line.

Thanks,
Ashish

a_thakur’s picture

Sorry, wrong screenshot attached. The above one is for d7, please find the attached screenshot for d6.

star-szr’s picture

I'd be happy to fix the coding standard issue and re-post if you like.

I didn't touch hook_menu() at all in the port, and reported the bug you saw in #1691412: Per-user login history report shows data from all users. If we update both of these I think they should be fixed in the D7 version as well, so perhaps we can open a follow-up issue to convert the menu items from underscores to dashes.

star-szr’s picture

Status: Needs work » Needs review
FileSize
2.92 KB

@a_thakur, thanks for the review. Attached is an updated version of the D6 port that fixes the coding standard issue.

Opened #1707200: Change user login history menu item to use a dash instead of an underscore as a follow-up issue for updating the menu items.

greggles’s picture

So, @Cottser proposed becoming a co-maintainer in this issue and @a_thakur proposed it to me via email.

I'm inclined to add both of you as maintainers. Let me know if you have any more ideas or concerns on that.

a_thakur’s picture

Thanks @greggles for considering us to co-maintain the module.
I think views integration would be good initiative which was also raised in #1402266:Statistics and maybe views integration .

@Cottser: Could you please review my sandbox module: User Track which has views integration and it also takes into consideration failed login. I think some of the features can be merged here.

@greggles: I would be great in case you permit us to go ahead with views integration and other features which are implemented in my sandbox module.

Thanks,
Ashish

greggles’s picture

@Cottser - what do you think? I'm still inclined to add you both as maintainers?

star-szr’s picture

@greggles - While I greatly appreciate the code review here by @a_thakur, at this time I can't confidently recommend him as a co-maintainer of this module. My opinion is based only on his patch submitted in #1691412-1: Per-user login history report shows data from all users and looking briefly at his User Track module, so I could be wrong :)

@a_thakur - Please let me know if I've misjudged the situation in any way. I currently have Login History deployed on over a dozen production D6 and D7 sites so #1691412-1: Per-user login history report shows data from all users made me a bit nervous!

a_thakur’s picture

@Cottser: It would be great in case look the User Track module in depth: code + functionality. As I believe I have been really careful while developing that module and has all the drupal coding standards expect at two places where the line exceeds 80 characters. All other issues like per user login history and other permissions are taken care of.

One thing I could think of is that we could maintain a new branch(the users would not be suggested to use this branch). where both of us could push the code and do a peer review of the code as well as the functionality and once we are sure enough the code is bug free we could merge the code to rc or the stable branch.

a_thakur’s picture

@Cottser: I hope you have had time to look at User Track in depth.

@greggles: I would be really great in case you could too, have a look the code and give your feedback. I think the method suggested in comment #10 is a good idea to go forward.

star-szr’s picture

@a_thakur - Thanks for following up. I took some time to review your User Track module more in depth. A few things I noticed:

  • The implementation of hook_views_api() should not use views_api_version() to set the API version, this defeats the purpose.
  • All fields and even the group defined in hook_views_data() end in a period, this is unnecessary.
  • With the default view, the "User Track" tab is positioned before "View" and "Edit" tabs.
  • The "Login status" exposed filter can never be removed unless you remove all exposed filters, and shows up in several unwanted places in the Views UI due to the way it was added via hook_form_alter() - see attached screenshot.
star-szr’s picture

@greggles - My offer to help maintain still stands. I'm about to deploy the module on two new Drupal 7 sites :)

greggles’s picture

@Cottser, you're now a co-maintainer. Thanks!

star-szr’s picture

Thanks @greggles! I'll try to get a dev version of the 6.x port up, once that's done I'll mark this as fixed.

star-szr’s picture

Status: Needs review » Fixed

Committed! The dev snapshot should be live within 12 hours according to the docs.

Status: Fixed » Closed (fixed)

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