Closed (fixed)
Project:
Advanced User
Version:
7.x-3.x-dev
Component:
Feature
Priority:
Normal
Category:
Feature request
Reporter:
Created:
30 Jan 2010 at 15:42 UTC
Updated:
7 Jun 2012 at 16:51 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Anonymous (not verified) commentedIntegration with Token module would probably be best. Feel free to provide a patch for 6.x-3.x-dev for the maintainers to look at.
Comment #2
Anonymous (not verified) commentedComment #3
Anonymous (not verified) commentedSee #478828: Using Profile Fields in the 'new account' notification email for a user wish.
Comment #4
rsevero commentedHere is a patch that changes the variable substitution used in the Advanced User module from the current method to Token module.
Almost all substitution variables had their names changed because the names used by Advanced User where different from the ones used in the Token module.
There were a few variables used by Advanced User that didn't exist in the Tokens module so I created them inside Advanced User through the Tokens module API.
I changed the default subject and email definitions to match the new variable names, i.e., I changed the definitions so the default subject and emails would remain the same.
I also changed the prefix and suffix used by Advanced User to match the ones recommended by the Token module. Previously Advanced User used % as prefix and nothing as suffix. Token module mentions that it's safer to use a prefix AND a suffix to eliminate the possibility of variables starting with the same letters being substituted wrongly. I adopted [ as the prefix and ] as the suffix.
Please review the patch and let me know if there are any modifications necessary.
Comment #5
Anonymous (not verified) commentedOh, joy, I don't have to do it! :D
Do we really have to code it like this?
That's just ugly. I knew using Token would require this level of alteration. Is the !prefixuser!suffix what the user will put in the settings form?
Comment #6
rsevero commentedOh, joy, I don't have to do it! :D
You are welcome.
Do we really have to code it like this?
No. Not really. I did it this way only because I was uncertain that the delimiters change would be well received by you (from "% before" to "surronded by []") and this way it would be easier to roll back the delimiters change.
Is the !prefixuser!suffix what the user will put in the settings form?
No not all. The user will use [user]
As the users won't have to deal with this ultra-ugly !prefixuser!suffix syntax I believe the way I coded is ok but if you prefer it can be made prettier. Please let me know.
Comment #7
Anonymous (not verified) commentedYes, please make it prettier. It is too difficult to tell where the !prefix ends and the variable begins. I had planned to use the [] format which seems to be standard.
Should I host a profile_tokens module? Drupal 6 will be around for a while longer so it wouldn't hurt. We can make it optionally dependent on the profile module being active and raise warnings to the administrator if it is missing when profile module is active.
Comment #8
rsevero commentedHere is a patch that beautifies the default subject and mail definitions. It should be applied after applying my previous patch.
There are already some discussions on the subject of hosting the Profile Tokens module (or including it in the Token module itself). You can track these discussions at #125640-73: Profile tokens.
I think your idea of the optional dependency is a good one. I believe we should just see what is settled with the Token module maintainers about the Profile Token module before doing anything.
Comment #9
rsevero commentedForgot to change the status.
Comment #10
Anonymous (not verified) commentedThe second patch is empty. Can you please use ``cvs diff -up'' to create the patch? Easier for me to apply.
Comment #11
rsevero commentedHow many mistakes one can make when trying to provide a patch?...
Let's see if I managed to provide a working patch this time.
This is a complete patch made with all up to the last modifications you asked for created against DRUPAL-6--3 version from a few hours back with the command you mentioned. (I'm still unsure if DRUPAL-6--3 is a branch or a tag).
Comment #12
Anonymous (not verified) commentedThe only thing I question is the use of the word _DEFAULT_ in
ADVUSER_DEFAULT_TOKEN_PREFIX, ADVUSER_DEFAULT_TOKEN_SUFFIX. We don't provide a settings option for the user to change it so we should just useADVUSER_TOKEN_PREFIX, ADVUSER_TOKEN_SUFFIXinstead.BTW, DRUPAL-6.x-3.x is both a branch and a tag. Branch is a type of tag and release is a type of tag. You work from the branch tag and the release tag is a static repository of the released code.
Comment #13
rsevero commentedThis patch has the DEFAULT_ removed from the prefix and suffix constant names.
Just to further clarify the branch X tag X release cvs definitions: you say the release tag is static. So is it correct to infer that the branch tag isn't static?
Comment #14
Anonymous (not verified) commentedShould we add a hook_requirements to alert the users who update without reading on the new dependency for the Token module? Is there some method to tell the Update status module about this dependency?
Comment #15
rsevero commentedI think it's a good idea.
Here is a patch.
Edit: I'm not sure about the name and path of the Profile Tokens 6 module as the page where fizk said he put it isn't showing it yet. He said it would show sometime today.
Comment #16
Anonymous (not verified) commentedAlways provide a full patch without specifying the file so that all changes are incorporated in one patch.
The requirement you've given in the install file is for profile_token which is not mentioned in the info file. My question in #14 was related to the Token module required in the info file.
Comment #17
rsevero commentedAFAIU there are two dependency issues at hand:
Do you envision something different?
On other matter: what do you think about creating a constants file for the module?
Comment #18
Anonymous (not verified) commentedWell, ``optional'' functionality isn't a requirement so profile_token doesn't belong in hook_requirements. I'm wanting to give the users of advuser a status message that Token module isn't available when they have advuser active and then simply drop in an updated version and they don't even have the Token module installed in the modules directory. I was just thinking that hook_requirements would be the better place but if there is something else I'm listening. I'm just trying to avoid the RTFM issues.
Comment #19
rsevero commentedOk, I will include the mandatory dependency on the Token module in the 'runtime' requirements. In case of failure it will return with an error.
About the optional dependency on the Token Profile module: I believe that it would be helpful for users to get an warning on the lack of the Token Profile module in the same spirit the Upload module does in a similar situation. Here is an example of the warning the Upload module provides:
Upload progress Disabled
Your server is capable of displaying file upload progress, but does not have the required libraries. It is recommended to install the PECL uploadprogress library (preferred) or to install APC.
What you think about it?
Any ideas on the one below?
On other matter: what do you think about creating a constants file for the module?
Comment #20
Anonymous (not verified) commentedThe thing I would dislike about that is the fact that if I don't care I really don't care and don't want to see a message on the admin form. If you use a drupal_set_message on the admin/build/modules page when the profile module is in use then I'm all for it. Use 'advuser_warning' as the type of message.
As for the constants, assuming that you're talking about the define('ADVUSER_...', ...) ones, they belong in the .module file. No need to include another file. If you find one that is only associated to the settings form, then you could move it to forms/advuser_settings.inc but then you run the risk of some future maintenance needing to move it back to the .module file.
Comment #21
rsevero commentedOk. Your module, your rules. ;)
Here is the patch without 'requirements' testing for Token Profile module.
Comment #22
Anonymous (not verified) commentedGreat and thanks. I'll give it a try this weekend.
Comment #23
jghyde commentedrsevero--
Can you re-apply your patch and post it based upon the latest DEV version? Thanks.
Joe
Comment #24
rsevero commentedHere is a patch against DRUPAL--6-3 version I checked out a few minutes ago.
Comment #25
jghyde commentedrsevero --
Applied the patch to DRUPAL--6-3 and it appears to work through a series of tests, including simpletest. We need someone else to test this patch to make sure there are no bugs before committing to the next version.
Thanks for your quick reply!
Joe
Comment #26
5t4rdu5t commentedHi there,
I've just tested the patch on #24 and although found no major errors or issues, here's a list of what I've detected so far:
1. User profile tokens don't show on the Substitution variables list
2. "Administor" typo on Mail body default text
3. Couldn't get notifications logged in watchdog or account activity emailed to admin either for new user or updated profile info even when selecting these options in settings. (guess maybe I'm missing something here, I'll try again later)
This is my testing setup:
Drupal-6.17
Advanced User Management 6.x-3.x-dev
Profile Tokens 6.x-1.x-dev
Token 6.x-1.12
Core profile module enabled
Comment #27
jghyde commentedThanks Libriana!
I have reviewed your bugs and I think fixed them. Here is the next patch that I need reviewed by two people before we can commit it to the next version. This is to add Tokens module dependency and features to the Advanced User module (advuser).
I split the patches up into five files, one for each file to be patched. I am also submitting a tarball with the entire module to make it easier for someone to download and test. The tarball is 6.x-3.x-dev with all five patches to provide Tokens support applied.
The sooner we get some testing, the faster we can commit this feature! Thanks everyone for helping out.
My testing environment:
Drupal-6.17
advuser 6.x-1.x-dev
Token 6.x-1.12
(core) Profile module enabled
(I did not test this against Profile Tokens 6.x-1.x-dev)
All tokens appeared.
Email notifications happened.
Everything was showing up in Watchdog.
Comment #28
Anonymous (not verified) commentedThe patch in #24 needs to have an hook_update_N to change the previous substitution tokens to the changed tokens in the variables for the mail if they exist in the variable table.
@joe: You need to use ``cvs diff -up'' in the top level directory. Do not include differences of each file nor the entire changed module in a tar.gz.
Comment #29
rsevero commentedUpdated version of #24 patch with requested hook_update_N.
Comment #30
rsevero commentedUpdated #29 patch with fix for #26 item 2 (which wasn't introduced by this patch BTW).
Item 1: user tokens are listed in http://example.org/admin/settings/advuser "Registration notification controls" and "Account update notification controls". Is there anywhere else to check? Or are there other tokens to be presented? Please provide more detailed information if you believe there is still a problem.
Item 3: I didn't test it. If this problem is really present, I bet it has nothing to do with this patch so I suggest a specific issue is opened for it.
Comment #31
rsevero commentedOk, this gotta be the last version of this patch.
Fixed the account-url passed as user administration page.
Comment #32
Anonymous (not verified) commentedThanks rsevero, I'll give it a look later this week.
Comment #33
bmango commentedI'm happy to help with testing. I have never tested before is it fairly straightforward?
Comment #34
Anonymous (not verified) commented@bmango: Thanks for the offer but I don't have time to train you in how to test modules with patches applied. If you can find a book or online document that you can read and figure it out that would be great.
Comment #35
bmango commentedI tried uploading the tarball in #27. Everything worked fine until I tried to submit a "send email" action. I then got a fatal error:
Fatal error: Call to undefined function _advuser_get_tokens_list() in /homepages/0/d309344694/htdocs/ben/sites/all/modules/advuser/forms/advuser_multiple_email_confirm.inc on line 66
This is my testing setup:
Drupal-6.16
Advanced User Management 6.x-3.x-dev
Token Profile 6.x-1.x-dev
Token 6.x-1.12
Core profile module enabled
Comment #36
rsevero commented@bmango: the more up to date patch is the one from #31. Could you test it and report?
Thanks.
Comment #37
bmango commented@rsevero: I have just applied the patch from #31 to Advanced User Management 6.x-3.x-dev. I got the following message:
Hunk #1 FAILED at 2.
1 out of 1 hunk FAILED
Everything else seemed to be ok. I tried the module, and had the same problem as in #35 when trying to "email selected users". I got the fatal error:
Fatal error: Call to undefined function _advuser_get_tokens_list() in /homepages/0/d309344694/htdocs/ben/sites/all/modules/advuser/forms/advuser_multiple_email_confirm.inc on line 66
Comment #38
rsevero commented@bmango: could you please test this patch?
Comment #39
bmango commented@rsevero:
Just tested the patch in #38. I am getting the error: Hunk #1 FAILED at 2. 1 out of 1 hunk FAILED, but apart from that it seemed to apply the patch fine.
I then tested the "email selected users" action and this is now working without errors. I am attaching a screen-shot.
However, I had added a profile field for users to add their first name (as a test) but this field wasn't appearing on the list for token replacements in the email. I thought that it would?
The only other thing was the alignment for the bullet point of the list of people being emailed was appearing slightly outside the box (see top of attached image).
Hope this helps.
Comment #40
rsevero commented@bmango: if you are getting a Hunk #1 FAILED at 2 error you don't have the newest DRUPAL-6--3 code as the above patch applies cleanly in it.
This patch makes Advanced User use the Token module for token substitution and creates a few specific Advanced User tokens. To get profile field tokens you need the Token Profile module from http://drupal.org/project/token_profile.
The bullet point alignment issue isn't related to this patch. I bet it has something to do with the select theme.
Comment #41
bmango commented@rsevero
Ok, thanks.
Comment #42
akalata commentedI also applied the patch in #38 to 6.x-3.x-dev from 2010-Jul-11. Same error as bmango in #39 (since I didn't get from CVS), but otherwise appears to be working fine.
Now to figure out how to get this token applied to the registration email (#257200: Custom profile fields in registration mail)...
Comment #43
raulmuroc commentedPatch #38: Tested & reviewed. It works correctly. It has some Warnings and mistakes, I think they can be solved through Drupal 7 port.
Re-attaching patch and working on it (to be ported).
Comment #44
Anonymous (not verified) commentedRaulMuroc: The patches are approved. Go ahead with the commit. Please release a 6.x-3.x alpha2 release.
Comment #45
Anonymous (not verified) commentedPatch in #38 has been pushed to the repository at http://drupalcode.org/project/advuser.git/commit/c48f7f1 for 6.x-3.x. I will do the same for 7.x-3.x soon.
Comment #46
Anonymous (not verified) commentedI manually applied the patch to 7.x-3.x-dev, the attached is the result.
Comment #47
Anonymous (not verified) commentedComment #48
Anonymous (not verified) commentedhttp://drupalcode.org/project/advuser.git/commit/4217fe5