Difference between revisions of "WikiTips"

From Baltimore Node Wiki
Jump to navigationJump to search
(Created page with 'Tips page on how to use the Wiki. To add a signature: <nowiki>~~~</nowiki> for your username. <nowiki>~~~~</nowiki> for your username and time stamp. To create a new Meeting Pa…')
 
Line 4: Line 4:
  
 
To create a new Meeting Page using the Template: <nowiki>{{subst:Meeting Notes}}</nowiki> save and edit
 
To create a new Meeting Page using the Template: <nowiki>{{subst:Meeting Notes}}</nowiki> save and edit
 +
 +
----
 +
 +
We're using the [https://www.mediawiki.org/wiki/Extension:SendGrid SendGrid extension] for email now, but it didn't respect [[MediaWiki:Emailsender]]. Here's a quick hack to fix that:
 +
 +
<nowiki>diff --git a/SendGridHooks.php b/SendGridHooks.php
 +
index c11a1ca..e47db92 100644
 +
--- a/SendGridHooks.php
 +
+++ b/SendGridHooks.php
 +
@@ -63,7 +63,9 @@ class SendGridHooks {
 +
                }
 +
 +
                // Get $to and $from email addresses from the array and MailAddress object respectively
 +
-              $from = new SendGrid\Email( null, $from->address );
 +
+              global $wgEnotifUseRealName;
 +
+              $from_name = ( $wgEnotifUseRealName && $from->realName !== '' ) ? $from->realName : $from->name;
 +
+              $from = new SendGrid\Email( $from_name, $from->address );
 +
                $to = new SendGrid\Email( null, $to[0]->address );
 +
                $body = new SendGrid\Content( "text/plain", $body );
 +
                $mail = new SendGrid\Mail( $from, $subject, $to, $body );
 +
</nowiki>

Revision as of 02:38, 24 August 2018

Tips page on how to use the Wiki.

To add a signature: ~~~ for your username. ~~~~ for your username and time stamp.

To create a new Meeting Page using the Template: {{subst:Meeting Notes}} save and edit


We're using the SendGrid extension for email now, but it didn't respect MediaWiki:Emailsender. Here's a quick hack to fix that:

diff --git a/SendGridHooks.php b/SendGridHooks.php
index c11a1ca..e47db92 100644
--- a/SendGridHooks.php
+++ b/SendGridHooks.php
@@ -63,7 +63,9 @@ class SendGridHooks {
                }
 
                // Get $to and $from email addresses from the array and MailAddress object respectively
-               $from = new SendGrid\Email( null, $from->address );
+               global $wgEnotifUseRealName;
+               $from_name = ( $wgEnotifUseRealName && $from->realName !== '' ) ? $from->realName : $from->name;
+               $from = new SendGrid\Email( $from_name, $from->address );
                $to = new SendGrid\Email( null, $to[0]->address );
                $body = new SendGrid\Content( "text/plain", $body );
                $mail = new SendGrid\Mail( $from, $subject, $to, $body );