Skip to content

Commit

Permalink
feat: adds notification_email()
Browse files Browse the repository at this point in the history
  • Loading branch information
devuri committed May 11, 2021
1 parent 5db94b2 commit b8d8a71
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/InstagramData.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public static function refresh_token() {

// email message.
$message = __(
'Hi,
'Hey there!
This notification confirms that your Instagram User Access Token Has Been Updated on ###SITENAME###.
Expand All @@ -235,7 +235,8 @@ public static function refresh_token() {
$message = str_replace( '###CREATED###', $token_created, $message );
$message = str_replace( '###EXPIRES###', $token_will_expire, $message );
$message = str_replace( '###PREVIOUS###', $previously, $message );
$message = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $message );
//$message = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $message );
$message = str_replace( '###ADMIN_EMAIL###', self::notification_email(), $message );

// new token array
$igtoken = array();
Expand All @@ -251,6 +252,18 @@ public static function refresh_token() {
return $user_token;
}

/**
* Notification about auto updates.
*
* @return string .
*/
public static function notification_email() {
if ( get_option( 'simsf_notification_email', false ) ) {
return get_option( 'simsf_notification_email' );
}
get_option( 'admin_email' );
}

/**
* Check if the token has been Refreshed
*
Expand Down

0 comments on commit b8d8a71

Please sign in to comment.