plainblack.com
Username Password
search
Bookmark and Share

Templatized Subject Line for Notifications

Premise:

I was getting annoyed that the subject line in email notifications was uneditable. (in 6.2.9 it defaults to

WebGUI::International::get(523,"WebGUI",$u->profileField("language"));
which is....
'523' => {message => q|Notification|,...} 
in English\WebGUI.pm. So, I made it templatable, just like the message body. 

Value/Usefulness:

This modification is a start towards making the built-in WebGUI message boards a full-fledged Web-enabled mailing list.  My message notification templates include <tmpl_var post.message> and other post-related variables, so I wanted to be able to match the subject line of the email with the subject line of the forum posting.

WebGUI Core Modifications:

In UI.pm, the following replacement is made:

$lang{$u->profileField("language")}{subject} = 
WebGUI::Template::process($forum->get("notificationSubjectTemplateId"),
"Forum/NotificationSubject", $lang{$u->profileField("language")}{var});

replaces

$lang{$u->profileField("language")}{subject} = 
WebGUI::International::get(523,"WebGUI",$u->profileField("language"));

Also in UI.pm under the sub forumProperties, insert the following lines after

$f->template(
-name=>"notificationTemplateId",
-label=>WebGUI::International::get(1035),
-namespace=>"Forum/Notification",
-uiLevel=>5,
-value=>$forum->get("notificationTemplateId")
);

and

);

lines to insert:

$f->template(
-name=>"notificationSubjectTemplateId",
-label=>WebGUI::International::get(1135),
-namespace=>"Forum/NotificationSubject",
-uiLevel=>5,
-value=>$forum->get("notificationSubjectTemplateId")
);

In Forum.pm, at the end of the parameter list (head3) of the sub create, add the line

notificationSubjectTemplateId - Template ID

Also in Forum.pm, add the following line in the new sub:

$properties->{notificationSubjectTemplateId} = 
	$master->{notificationSubjectTemplateId};

The changes to the Help and Internationalization modules are too lengthy to be detailed here, but the modified files are included in the zip file.

Installation/Uninstallation

Here is the installation SQL script you should run against your site's database:

INSERT INTO template VALUES ('1','Default Notification 
	Subject','<tmpl_var post.subject>','Forum/NotificationSubject',1,1);
ALTER TABLE forum ADD notificationSubjectTemplateID varchar(22) default NULL;
UPDATE forum SET notificationSubjectTemplateID='1';

Here is the uninstallation SQL script you should run against your site's database:

DELETE FROM template WHERE namespace='Forum/NotificationSubject';
ALTER TABLE forum DROP notificationSubjectTemplateID;

Attachment:

See the attached .zip file for the modified files (baseline 6.2.9 gamma):

  • WebGUI\lib\WebGUI\Forum\UI.pm
  • WebGUI\lib\WebGUI\Forum.pm
  • WebGUI\lib\WebGUI\i18n\English\WebGUI.pm
  • WebGUI\lib\WebGUI\Help\WebGUI.pm
  • NotifySubject-0.5-install.sql
  • NotifySubject-0.5-UNinstall.sql
  • NotifySubjectEditForum.png

 

System RequirementsPlease be advised: this contribution was tested with something older than WebGUI 7.5. When this contribution was uploaded there was no field for the author to fill out regarding it's requirements.
Comments
DownloadNotifySubject-0.5.zip NotifySubject-0.5.zip
LinksNo Support Offered
ScreenshotsNotifySubjectForumEdit.PNG
Statistics Downloads: 254
Views: 4652
Rating: 0
Updated: 8/12/2005
Keywords Assets
NavigationBack to the Bazaar
© 2018 Plain Black Corporation | All Rights Reserved