Hi,
I love the module; it just does what it says on the tin. There are a couple of features I have implemented for my personal deployments which I thought might be useful additions for the module in general. One of them is the option to pre-populate the requester e-mail address. I prefer to have the e-mail address pre-populated for my users' convenience, so the below patch gives administrators of the module the following options;
- Pre-populate the requester field with the [user:mail] token
- Pre-populate the requester field with a custom email address
- Leave the requester field blank (as it currently is)
In both pre-population options the requester field will be disabled which means the ticket requester isn't able to change the email field.
I thought I'd share the code I use in case anybody else might see the value in this.
| Comment | File | Size | Author |
|---|---|---|---|
| requester_email_1.patch | 5.38 KB | rm-rf |
Comments
Comment #1
perignon commentedThank you so much for sharing. I think this is a great addition to the module. I will put it into dev.
Comment #3
perignon commentedI am researching if this can also be done with the embeded form.
Comment #4
perignon commentedWanted to mention also. Since you are heavily using the module, what do you think of the development roadmap?
Comment #5
perignon commentedComment #6
rm-rf commentedI looked into how to pass the values to the iframe code but Freshdesk doesn't seem to have any documentation on how to form the variables in this way. I'd be keen to find out if it is possible somehow though.
Viewing tickets is definitely helpful and would help my customers a lot since they wouldn't need to log into Freshdesk but can remain in Drupal to manage their day-to-day tasks and tickets. Having things like little widgets which can be placed on the dashboard to link to the tickets page would also help.
I am currently working with custom fields into the module, and thought it might be an idea to share some of these efforts once they are module-ready.
Other things which might be nice little additions are integrating with a jQuery colorpicker so the module administrator can choose the colour of the tab for instance.
Comment #7
perignon commentedAwesome. Lets start a new issue in the queue here to bring in some of this new capability. I am looking into the embed form, so far no documentation but I am going to take a stab at it by guessing variable names to see what happens.
Comment #8
rm-rf commentedInitially I had a token browser integrated with the above patch so the administrator could choose an existing token to pre-populate the requester field with but then decided against it since it really only accepts email addresses and leaves the admin under the impression that they could put all sorts of other tokens in too. Since the above patch already works with one token, [user:email], I didn't feel it warranted an entire token browser to also insert things like [site:mail], so I removed it.
Comment #9
perignon commentedIt works on the embedded form too! It is the same variable names as the popup widget. They have to be put into the query string of the IFRAME src link.
I will get this added later today. I have to run for the moment.
Comment #10
rm-rf commentedThat's pretty sweet, surprised this isn't better documented at Freshdesk.
Comment #12
perignon commentedCommitted the changes to allow this functionality in the embedded form as well. I also added some help text to the admin page. I noticed in testing that if you pre-populate the email field of the form Freshdesk does not allow the user to change that field. In my case this would be extremely problematic as a lot of my users never update their email account!
I may file a feature request with Freshdesk to change this behavior so the user can change the email address if it is pre-populated.
Comment #13
rm-rf commentedHi Perignon,
All pre-populated fields should be editable retrospectively I think. The only thing that makes the field disabled is that I added in an extra parameter into the Javascript which explicitly sets it to disabled. You can do this with any field. In my case it is useful if the email address is pre-defined and you don't want end-users to change it. If you remove the '$qstring .= '&disable[requester]=true';' bit from the popup widget code, it should make it editable for the end-user.
Hope this helps
Comment #14
perignon commentedAh! That what that setting is for. I need to make that optional. People don't update their accounts on my site and the email address is often wrong.
Comment #15
perignon commentedReopening because I found a problem. If the user is anonymous you don't get the $user object with an email address so it throws a notice on the site.
Comment #17
perignon commentedThink I got this fixed.
Comment #19
perignon commentedComment #20
pq commentedLooks like #15 is related to #2774287: Pre-populating requester with user email breaks if the user is not logged in