Extension talk:MailDigest

From MediaWiki.org
Jump to navigation Jump to search

Trouble shooting[edit]

How to use this extention ? I have followed the instructions : create the directory MailDigest with this 3 files and update my LocalSettings.php but nothing change.

Where is the special page for this mail digest ?

Where are the user configuration for mail digest ?

Working in 1.16.4 , with some modifications[edit]

Just tried this extension on Mediawiki-1.16.4, and it did nothing. I've made some changes (very minimal) to get emails to go out.

The first problem I ran into was line 24 in MailDigest.body.php, here...


       if ($wgUser->getName() != '127.0.0.1') { // adding support for user groups makes sence
               $wgOut->addHTML($wgUser->getName() . ' is not authorized to send emails');
               return;
       }

The IP "127.0.0.1" needs to be changed to whatever user account your going to use to send the digests. Or you will get the error "is not authorized to send emails"

Below is a diff of the changes I made.

diff -u MailDigest-orig/MailDigest.body.php MailDigest/MailDigest.body.php
--- MailDigest-orig/MailDigest.body.php	2011-06-15 15:42:52.000000000 -0500
+++ MailDigest/MailDigest.body.php	2011-06-15 14:19:04.000000000 -0500
@@ -21,7 +21,7 @@
  
         $uid = $wgUser->getID();
  
-        if ($wgUser->getName() != '127.0.0.1') { // adding support for user groups makes sence
+        if ($wgUser->getName() != 'Treydock') { // adding support for user groups makes sence
                 $wgOut->addHTML($wgUser->getName() . ' is not authorized to send emails');
                 return;
         }
diff -u MailDigest-orig/MailDigest.i18n.php MailDigest/MailDigest.i18n.php
--- MailDigest-orig/MailDigest.i18n.php	2011-06-15 15:42:34.000000000 -0500
+++ MailDigest/MailDigest.i18n.php	2011-06-15 15:08:24.000000000 -0500
@@ -4,6 +4,7 @@
 $messages['en'] = array(
     'tog-emailwatch' => 'Mail my watchlist',
     'tog-emailplainformat' => 'Mail using plain text format',
+	'prefs-maildigest'	=> 'Mail Digest Settings',
     'watchdetails' => 'Watch list details',
     'watchmethod-recent' => 'Watch list methode',
     'watchnochange' => 'No watch list changes'
diff -u MailDigest-orig/MailDigest.php MailDigest/MailDigest.php
--- MailDigest-orig/MailDigest.php	2011-06-15 15:42:20.000000000 -0500
+++ MailDigest/MailDigest.php	2011-06-15 15:08:42.000000000 -0500
@@ -22,10 +22,18 @@
 $wgExtensionMessagesFiles['MailDigest'] = $dir . 'MailDigest.i18n.php';
 require_once( $dir . "MailDigest.body.php" );
  
-function add_user_toggles(&$extraToggles) 
+function add_user_toggles($user, &$extraToggles) 
 { 
-        $extraToggles[] = 'emailwatch'; // ] = 'Email daily Watchlist changes';
-        $extraToggles[] = 'emailplainformat';// ] = 'Email using plain text (HTML is default)';
+        $extraToggles['emailwatch'] = array( // ] = 'Email daily Watchlist changes';
+		'type' => 'check',
+		'label-message' => 'tog-emailwatch',
+		'section'	=> 'misc/maildigest',
+	);
+        $extraToggles['emailplainformat'] = array( // ] = 'Email daily Watchlist changes';
+		'type' => 'check',
+		'label-message' => 'tog-emailplainformat',
+		'section'	=> 'misc/maildigest',
+	);
  
  /*
  * Changes in this file will be lost during software upgrades.
@@ -46,5 +54,5 @@
         return true;
 }
  
-$wgHooks['UserToggles'][] = array('add_user_toggles');
+$wgHooks['GetPreferences'][] = 'add_user_toggles';
 $wgHooks['UnknownAction'][] = 'maildigest';


The changes will add two options for this extension in "Preferences" under the Misc tab. Once the email is sent MANY PHP notices will go off in your server logs. Time permitting I will update this extension to fix things up and make it work with the latest Mediawiki release.

- Trey