Support from Acquia helps fund testing for Drupal Acquia logo

Comments

deekayen’s picture

Yes. It will be upgraded.

ervindm’s picture

Hi Deekayen,

I was able to modify the current 6.x-2.1 Session Limit code to be able to run it on Drupal 7.

How can I contribute or send you my code?

What have been done?

I modified several queries (to d7_dbtng), db_fetch (to foreach), and _trigger_get_hook_aids (changed to trigger_get_assigned_actions), and i modified the hook_menu to use admin/config/people/session_limit pathing.

Thanks and regards,
Ervin

ervindm’s picture

I already have working session_limit drupal 7 module base on current session_limit for d6

ervindm’s picture

I changed the checkbox on Session Limit Configuration screen to Radio Buttons. I rename the field as Behavior.

On Radio buttons there are three options, these are:
-Prompt user on which session to drop.
-Automatically drop the oldest sessions without prompting.
-Block newer users without prompting.

The 3rd option is a new feature to automatically block newer sessions for user that reached the max sessions. The session will continuously block user until the session expires and the session count falls below the max session count.

ervindm’s picture

I also added a setting to modify the messages thrown when disconnected or blocked

giorgio79’s picture

Sounds good ervindm, care to post the patch here so we can review it?

Leeteq’s picture

Title: D7? » Session Limit version for D7
Category: feature » task

@ervindm; have you noticed the possibility to upload zip files etc. right below the comment area here?

bmeso’s picture

hi
drop new session automatic have any help?

movinr8along’s picture

Would love to try out what you've got there ervindm.

RikiB’s picture

I am very much looking forward to a drupal 7 version. Thanks for the hard work!

leguy’s picture

subscribed

marcusx’s picture

subscribing

FeBus982’s picture

subscribed

ervindm’s picture

FileSize
13.62 KB

here is my D7 version of this module.

Sorry for my late reply. I was busy with my current projects.

Thanks!

ervindm’s picture

On current version, Administrators are not constrained with limiting of sessions.

and on user/$user_id there will be disconnect button to have functionality to disconnect currently logged in user.

bmeso’s picture

Hi ervindm
i am try with my d7 can,t work hear

ervindm’s picture

why is it not working? can you give me the error log or screenshot? Thanks!

bmeso’s picture

HI ervindm
check your mail

ervindm’s picture

Hi bmeso,

I saw your screenshots but i dont see any error when you installed it.

What do you want to do with it? Maybe your expectation is different on what this module can do.

You can read the original readme file regarding session limit and read my comments here of what has just been added.

Thanks!

deekayen’s picture

Status: Active » Needs work

It helps me to know to review something if you change the status. As it is, without having tested it, #14 doesn't comply with the Drupal coding standards.

Any chance you could run Coder against it and send an update?

ervindm’s picture

I will let you know if I am done with it. Thanks!

Josh Waihi’s picture

FileSize
53.81 KB

Here is a patch based on the git master branch. I unziped the zip from #14 over it first, then went about cleaning up the coding standards and improving a number of things. I've done a few hours testing focusing on the main admin functionality. I haven't really looked at or tested the user settings tab stuff.

I've separated out the page functions to session_limit.pages.inc to lighten up the .module file. I've also taken out logic regarding caching of the front page and redirecting there as I didn't see the point to it.

bmeso’s picture

Hi Josh
can you send hear full working copy

Josh Waihi’s picture

FileSize
130 KB

Sure thing. Git repo attached also.

bmeso’s picture

hi error with this
Error message
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'xxxxx_1.session_limit_user_limits' doesn't exist: SELECT threshold FROM {session_limit_user_limits} WHERE uid = :uid; Array ( [:uid] => 2 ) in session_limit_get_user_limit() (line 348 of /home/xxxxx/public_html/drupal-7.0/modules/session_limit/session_limit/session_limit.module).

Josh Waihi’s picture

did you install the module or just try use it on an already installed version? That table should be installed when the module installs.

ervindm’s picture

Hi bmeso,

follow these steps:
If you have current Session Limit Installed follow the following steps:

UPGRADING: (Minor revision change for Drupal 7.x only)
1.) uninstall the current Session Limit version you have on your drupal
2.) over-write session_limit directory with the new version
3.) refresh Cache on you drupal
4.) install session_limit

Else,

INSTALLATION:
1.) extract session limit on your sites/all directory (then you will create sites/all/session_limit directory)
2.) go to Modules, and Install the Session Limit module

Zen’s picture

I've attempted to review the provided patch. Here are my notes thus far from a cursory look:

  • Do not introduce new module features with an upgrade patch. Adding new roles, session limits, database tables, etc. falls under this category.
  • Do not make code improvements such as including DEFINE statements. All such improvements can be proposed after the basic upgrade.
  • I'd recommend that for the time being, you even avoid fixing formatting issues with the patch so that API changes alone can be reviewed. Formatting errors include fixing issues with whitespace, spelling and so on.
  • There's no need for a LICENSE.txt.
  • README.txt is not the place to slip in upgrade credits. If you'd like credit, please speak to the module's maintainer.
  • Please compare the structure of this module's D7 .info file with that of a core module to get an idea of what should and should not go into it. Perform the comparison with a git checkout rather than a download.

... and so on and so forth. Please provide a minimal patch that upgrades the module and does nothing else. New features and other changes can be tackled later on.

-K

adam_b’s picture

subscribe

bennos’s picture

subscribe

Josh Waihi’s picture

Its all there in the Git repo. You're welcome to dissect it all you need. Git++

snufkin’s picture

Fixed queries.
Fixed PHP errors.
Fixed trigger API function change.

Removed a drupal_goto as it was sending the site around and seemed unnecessary.

Tested with a session limit of 1 for a single user.

I am sure there is still quite some work to do on features I haven't tested, but now it installs at least without errors.

snufkin’s picture

Rerolled the patch with the drupal_goto and removed the drupal_set_message.

snufkin’s picture

Fixing the byrole form as well while im at it :)

snufkin’s picture

Status: Needs work » Needs review
FileSize
15.89 KB

More fixes, working tokens, fixed the user form and the per-user session limit (this is broken still in drupal 6 because user_save expects the 'data' key in the array). Actions are also fired now correctly. Masquerade is correctly supported.

tanc’s picture

Hi snufkin, which version of the module do I apply your patches against? I tried Josh's module in #24 and applied your patches against it. Only patch in #32 applied cleanly. Patch in #35 had 5 out of 17 hunk fails.

deekayen, can you make a D7 branch so people can offer patches against that?

snufkin’s picture

Its against the master branch.

ntigh52’s picture

Hi to all,
Is there an updated version to drupal 7?
I installed #14 and nothing happens,
Please help me to understand wich # is correct..
Thanks in advance.

jweowu’s picture

This is a bug-fix replacement for Josh's version of the module from #22, to resolve an error with session_limit_user_role_delete(). (This is NOT relevant to snufkin's work.)

jweowu’s picture

ntigh52: it looks like you have two options, the most recent versions of which are at #35 and #39. Both are patches to apply against the master branch. I think snufkin's version is intended as a straight port of the D6 version. The other version has some additional changes (as you'll see in the patch) which may or may not end up in an official D7 release.

Zen’s picture

Status: Needs review » Needs work

@snufkin: Your last patch alludes to a .tokens.inc. But there is no such file created by your patch.

Please advise.
-K

snufkin’s picture

Status: Needs work » Needs review
FileSize
18.26 KB

Updated patch now with more .tokens.inc files!

deekayen’s picture

Status: Needs review » Fixed

This has gone long enough. I committed #42 and will make the first beta from that.

ntigh52’s picture

Hi,
I installed the modul and the module work in drupal 7.
with Attention about the bugs:
1. see http://drupal.org/node/1384652 .
2. when I add a new role and create new user with that role the default session limit is 1.
why?
explain:
i have role admin, role 1, role 2, role 3.
admin session limit = default. ( work perfect )
role1 session limit = 1. ( work perfect )
role2 session limit = default. ( not working well because I can access just 1 time ), but if I choose session limit = 50 ( for example ), its work.
It is important to note: when I create new role and add user to this role I get the same error:

•Notice: Undefined variable: replacements in session_limit_tokens() (line - 71 C:\wamp\www\mysite\sites\all\modules\session_limit\session_limit.tokens.inc).

Thanks/

snufkin’s picture

Please don't use this issue queue for further issues with the 7.x branch but open new ones instead. I posted a patch to your notice bugreport here: #1384652: Undefined replacements variable throws notice.

Status: Fixed » Closed (fixed)

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