Step-by-step process:
1. Verify correct installation of Role Expire.
Role Expire: version 7.x-1.0-beta2 (permissions checked)
Drupal Core: version 7.8
2. Go to /admin/people/permissions/roles, edit a role, set a default duration for the role and save role.
3. Go back to the role edit page. Problem 1: the default role duration field is still blank (in a previous version of role expire, this field shows the default duration that you saved). This indicates that something is wrong. We verify this in '4'
4. Assign the role to a user (user/#/edit) en verify that the role expire time message is showing on the profile page... Problem 2: The message is not showing at all.
5. Go back to user/#/edit, assign a role and add an expiry time manually (so that it's different from the default duration). This time, the role expire time message is showing on the profile page of the user. So this still works.
Additional info:
- I upgraded from Role expire version 7.x-1.0-beta1 to beta2. The default role expire duration set in beta1 were taken by beta2. Everything works fine untill you try to change the default role expire duration. (or add a default duration to a new role)
- I installed Role expire version 7.x-1.0-beta1 again. Everything is working fine in this version.
- After this, I uninstalled Role expire version 7.x-1.0-beta1 completly (so database tables removed) and installed Role expire version 7.x-1.0-beta2 again. Same issues as in my step-by-step process.
I hope you can duplicate the problem, if you need more info, just ask.
Thanks
| Comment | File | Size | Author |
|---|---|---|---|
| #24 | role_expire-1293846-24.patch | 5.54 KB | jonhattan |
Comments
Comment #1
sharplesa commentedGood bug report. I've confirmed this behavior. Rats!
What's interesting is that roles that had default expirations before the update continue to have expirations now. But once I edit them, the default expiration goes away.
Comment #2
sharplesa commentedI've found the problem. There was some code that I didn't update correctly from 6.x to 7.x when I built the new release. The attached patch should fix that problem (as well as the Views integration problem noted at #1291466: Views integration not working).
Now when you go through the steps Scipr outlined above, the default duration does get set.
Scipr, do you know how to apply patches? If you apply, test and confirm this patch, I'll update the module.
Again, thanks for the excellent bug report, Scipr. Made it easy to isolate and test.
Comment #3
Scipr commentedThank you for looking into this issue.
So I applied the patch on version 7.x-1.0-beta2 of Role Expire using Netbeans. Verified that the code has changed and installed the module.
Testing functionality after applying the patch of #2:
- Manually set an expire duration on the user/#/edit page: works perfectly
- Views integration of role_expire: works perfectly
- Set a default duration on the admin/people/permissions/roles/edit role page. After saving the role I get this error message:
PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'duration' at row 1: INSERT INTO {role_expire_length} (rid, duration) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => 6 [:db_insert_placeholder_1] => 24 months ) in role_expire_set_default_duration() (line 143 of /.../sites/all/modules/role_expire/role_expire.module).If I had more knowledge about coding I could help more, but for now I'll contribute by testing :).
Comment #4
sharplesa commentedTesting is great!!
Did you remember to run update.php before you began this test sequence? The database schema does change between beta1 and beta2.
Thanks
Comment #5
Scipr commentedYes, I remember. But because beta1 was completely removed from my Drupal installation (and I verified that the tables were removed from my database) you don't have to run update.php (I think). Although I checked update.php every time after installing the Role Expire module it said "No pending updates".
Also after applying the patch and installing the module I checked update.php: "No pending updates".
I just checked update.php again and it still says: "No pending updates".
So you can't duplicate this problem?
Comment #6
sharplesa commentedNo. Can't duplicate the problem. Can you get to the database? Are you using mysql or something else? For my installation (mysql) the role_expire_length table looks like this:
Is this what yours is?
(To create this CREATE TABLE command, I used phpmyadmin and did an 'export' of the role_expire_length table, Structure-only.)
Comment #7
Scipr commentedHi sharplesa,
I got everything working now. I use phpmyadmin (mysql) for my database. I dropped the table 'role_expire_length' and ran a query to create the table again (I copy/pasted the query from #6). A quick check indicates that everything works.
I would just like to point out a small issue with Role expire version 7.x-1.0-beta2. This issue explains why you couldn't duplicate the problem. But this is also very important for new users of the Role expire module.
Issue:
On a clean install (!) of Role expire version 7.x-1.0-beta2 the database field 'duration' from the table `role_expire_length`is still an 'integer'. This is not correct, this should be a 'tinytext' type. Even if you run the database update script, nothing changes to the field of the database.
However, someone who upgrades from beta1 to beta2 and runs the database update script: the database field 'duration' will be changed to 'tinytext'. This is why you couldn't duplicate the problem. You had the correct database structure. I had a database issue because I started from a clean install.
But, I could be mistaken, I'm quite new to this stuff.
I will confirm your patch later on when I have tested it a bit more.
Sharplesa, thank you for your patience and help. I really appreciate this. This is my first contact with the drupal community and it is very encouraging.
Comment #8
sharplesa commentedYep. You've hit the nail on the head. I completely forgot about that use case(!) A revised patch is on its way.
BTW, testing for this uncovered another bug. If you edit a role a second time and don't change the non-empty default duration, you'll get a PDO error.
The bug:
1. Go to admin/people/permissions/roles and click "Edit role" for role A.
2. Add a duration to role A and click "Save role".
3. Still on admin/people/permissions/roles, click "Edit role" for role A (again).
4. Don't change anything and click "Save role".
5. Observe the error message.
The patch'll fix this second error too. Problem is, I'm tied up until at least Sunday.
Scipr, glad you're now part of the Drupal community. Your testing and reporting are invaluable.
Comment #9
sharplesa commentedComment #10
sharplesa commentedThe following patch addresses the problem Scipr in #3ff, and the one I found in #8.
To test #3:
To test #8:
(This was a total rewrite of role_expire_set_default_duration.)
Additional changes:
Comment #11
jhoodI tested the patch and it now saves the default duration. :)
My question is if I give the role to a user and the field to enter the default duration pops up, should the default duration show up?
Comment #12
bensti commentedPatch #10 work for me !
Comment #13
sharplesa commentedAs it currently stands, if you use the default, you only see the default duration after the user has been saved. There's a 6.x patch that prefills the expiry field with the default duration on load. Once that patch is accepted, I plan to create a patch for the 7.x version that does the same thing.
Comment #14
liliplanet commentedi'm attaching the patched module with #10 thank you sharplesa!
and also patch from
"add expire time to role" in Rules adds from current day, but not the user's role expiration day at http://drupal.org/node/1370262, thank you davidwatson!
all working good :)
Comment #15
RKS commentedI love you Liliplanet! I have a client using GoDaddy without SSH and I didn't feel like doing anything with their stupid FTP panel. This patched version fixed the issue for me.
Comment #16
stewsnoozeRE #14 Liliplanet: If you have fixed this could you attach a patch to this issue.
See here for instructions if you need them. http://drupal.org/node/707484
That would be great and I could review and possibly commit that to the main module. If you can't do that let me know and perhaps we can see what changes you made to support this. I suspect you edited the beta rather than the dev version. Is that right?
Comment #17
liliplanet commentedHi stewsnooze, thank you! yes the patches were done to the 7.x-1.x-dev version.
The patches include are:
http://drupal.org/files/role_expire-1293846-10.patch
http://drupal.org/files/1370262--role-expire-rules-2--7.patch
Comment #18
liliplanet commentedHere is also a block for users to view their expiry date. I did this because the date did not show up on the profile. The role in this instance is called 'Contributor'.
Comment #19
ressaThanks to everyone for patching the module and getting it fixed. The latest dev release (7.x-1.0-beta1+6-dev from 2012-Sep-24) works just fine, and the user's expiry date is also shown on their account page.
A tip to others and a reminder to myself: If you add the role to a user with Rules during checkout with Commerce for example, remember to set the expiration time for the user's role, otherwise the role expiration time will be empty.
The two rules to add
Comment #20
liliplanet commentedReally, would we be able to solve the issues Commerce roles expiry as commerce_sp seems to be abandoned as that would be absolutely amazing.
Perhaps we could have a rule that sends an expiration (ie 3 days before) warning for the user?
Looking most forward to your development, thank you!
Comment #21
ressaI think it can be done with Rules Scheduler, see this post by trevorkjorlien: http://drupal.org/node/827594#comment-5254316
It seems like a lot of work, perhaps there is a simpler method? :-)
Comment #22
krisrobinson commentedI was having this problem so I updated to the .dev version, after setting the default expire time on the role - I went back in to change the default expire time and I get this message:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '5' for key 'PRIMARY': INSERT INTO {role_expire_length} (rid, duration) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => 5 [:db_insert_placeholder_1] => 183 ) in role_expire_set_default_duration() (line 144 of /sites/all/modules/role_expire/role_expire.module).Comment #23
mrded commentedWhich patch is actual for 7.x-1.x-dev version? #10 ?
Comment #24
jonhattan#10 doesn't apply. Re-rolled on top of latest dev. Also added hook_update_N() to address column type change.
Comment #25
ptmkenny commentedI tested the patch in #24; I was getting an error before when re-saving a role with an expiration, but that no longer occurs and it saves properly. Good work!
Comment #26
anybodyThe patch works great but I think it is really important to have a new beta release because the current beta release is just broken, so things can not get worse... :(
Comment #27
devaraj johnson commentedComment #28
rcodinaI have tried to reproduce the problem using latest dev with no success. Could you check it out again? Anyway, the patch does not cleanly apply. I think the module works fine now. If you still find the same problem, please reopen and reroll patch.
Comment #29
sgdev commentedLooking at patch #24, isn't this directly connected to the missing default durations functionality?
https://www.drupal.org/project/role_expire/issues/2891810#comment-12661524
Comment #30
sgdev commentedSo I've reviewed this in further detail, and compared to the original patch from #1280450.
I think there is value in what patch #24 has, and should be combined with what previously existed in from #1280450. I have created a single patch that brings the two together against the 7.x-1.x branch.
It can be found here: https://www.drupal.org/project/role_expire/issues/2891810#comment-12661918
Please review and provide your feedback, thanks.
Comment #31
rcodinaNow #2891810: 7.x-1.0-rc1 rolls back some features from 7.x-1.0-beta2 (Default durations functionality) is fixed. So I close this issue. Thanks to everyone and specially to ron_s!
Comment #32
rcodina