-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added typehints to methods - Added code for making plugin WP VIP GO compatible for the `From mail` - Added Toastr for sending nice message instead of using alerts
- Loading branch information
1 parent
b798984
commit 45037ca
Showing
8 changed files
with
153 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -331,3 +331,44 @@ function mg_smtp_get_region($getRegion) | |
return false; | ||
} | ||
} | ||
|
||
/** | ||
* Override WP VIP GO filter | ||
* It sets default email address to `[email protected]` | ||
*/ | ||
if ((defined('WPCOM_IS_VIP_ENV') && WPCOM_IS_VIP_ENV) || (defined('VIP_GO_ENV') && VIP_GO_ENV)) { | ||
|
||
global $mg_from_mail; | ||
|
||
/** | ||
* @param string $from_mail | ||
* @return mixed | ||
*/ | ||
function mg_wp_mail_from_standard(string $from_mail) | ||
{ | ||
global $mg_from_mail; | ||
|
||
$mg_from_mail = $from_mail; | ||
|
||
return $from_mail; | ||
} | ||
|
||
add_filter('wp_mail_from', 'mg_wp_mail_from_standard', 0); | ||
|
||
/** | ||
* @param string $from_mail | ||
* @return mixed | ||
*/ | ||
function mg_wp_mail_from_new(string $from_mail) | ||
{ | ||
global $mg_from_mail; | ||
|
||
if (!empty($mg_from_mail) && is_email($mg_from_mail)) { | ||
return $mg_from_mail; | ||
} | ||
|
||
return $from_mail; | ||
} | ||
|
||
add_filter('wp_mail_from', 'mg_wp_mail_from_new', 2); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.