|
From: Jamie C. <jca...@we...> - 2008-02-08 02:13:57
|
On 07/Feb/2008 06:00 Bill Moyers wrote .. > > If you are implementing this as Virtualmin plugin (with a > > virtual_feature.pl file), you can have your own input fields added to the > > mailbox user form by defining the mailbox_inputs function in > > virtual_feature.pl . This is the recommended method, as it removes the > > need to modify the core Virtualmin code, and so will continue to work even > > after an upgrade. > > > > For details on writing plugins, go to > > http://www.virtualmin.com/documentation/ and then to the plugin > > developer's documentation. > > Jamie, you're right. I didn't know about the mailbox_inputs function in > the docs. Thanks, that solves that problem. > > Also, we'd like to inject into the user creation email a variable > containing a link to the activation page. Looking through the docs and the > source, I don't see any way that plugins can change the substitution hash > for template emails. > > If such a thing doesn't exist, maybe there could be another function in > the virtual_feature.pl api such as mailbox_email_substitutions which > returns a hash of additional email substitution variables and is called by > send_template_email. I can see how potentially other plugins might want to > be able to do this as well, but you might not agree that it's important > enough to warrant changing the core. > > The only solution I can see without such a function is to have > mailbox_save actually insert the link directly into the template email, > but that's bad because there's no (I think) guarantee that the save will > be called before the email is sent, and it's just an ugly solution. There is actually a slightly hackish way you could do this - in the mailbox_save function, you could set a key of your own in the user hash parameter (the 1st) with code like : $_[0]->{myplugin_something} = "whatever"; Then in the email template, you can refer to ${MYPLUGIN_SOMETHING} which will be replaced with whatever you set. - Jamie |