-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add metadata to New Follower E-Mail #1172
base: trunk
Are you sure you want to change the base?
Changes from 8 commits
0a31dec
49bec73
b937b8e
ea9a7d8
00232ce
65fd34c
2138b8b
4fa508f
05ab581
85115c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,15 +135,26 @@ public static function new_follower( $notification ) { | |
} | ||
|
||
/* translators: 1: Blog name, 2: Follower name */ | ||
$subject = \sprintf( \esc_html__( '[%1$s] Follower: %2$s', 'activitypub' ), \esc_html( get_option( 'blogname' ) ), \esc_html( $actor['name'] ) ); | ||
/* translators: 1: Blog name, 2: Follower name */ | ||
$message = \sprintf( \esc_html__( 'New Follower: %2$s.', 'activitypub' ), \esc_html( get_option( 'blogname' ) ), \esc_html( $actor['name'] ) ) . "\r\n\r\n"; | ||
/* translators: Follower URL */ | ||
$message .= \sprintf( \esc_html__( 'URL: %s', 'activitypub' ), \esc_url( $actor['url'] ) ) . "\r\n\r\n"; | ||
$message .= \esc_html__( 'You can see all followers here:', 'activitypub' ) . "\r\n"; | ||
$message .= \esc_url( \admin_url( $admin_url ) ) . "\r\n\r\n"; | ||
|
||
\wp_mail( $email, $subject, $message ); | ||
$subject = \sprintf( \__( '[%1$s] Follower: %2$s', 'activitypub' ), get_option( 'blogname' ), $actor['name'] ); | ||
|
||
\ob_start(); | ||
require ACTIVITYPUB_PLUGIN_DIR . '/templates/new-follower-email.php'; | ||
$html_message = \ob_get_clean(); | ||
|
||
$alt_function = function ( $mailer ) use ( $actor, $admin_url ) { | ||
/* translators: 1: Blog name, 2: Follower name */ | ||
$message = \sprintf( \__( 'New Follower: %2$s.', 'activitypub' ), \get_option( 'blogname' ), $actor['name'] ) . "\r\n\r\n"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we don't expect to use the blog name, let's just limit it to one placeholder? |
||
/* translators: Follower URL */ | ||
$message .= \sprintf( \__( 'URL: %s', 'activitypub' ), \esc_url( $actor['url'] ) ) . "\r\n\r\n"; | ||
$message .= \__( 'You can see all followers here:', 'activitypub' ) . "\r\n"; | ||
$message .= \esc_url( \admin_url( $admin_url ) ) . "\r\n\r\n"; | ||
$mailer->{'AltBody'} = $message; | ||
}; | ||
\add_action( 'phpmailer_init', $alt_function ); | ||
|
||
\wp_mail( $email, $subject, $html_message, array( 'Content-type: text/html' ) ); | ||
|
||
\remove_action( 'phpmailer_init', $alt_function ); | ||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,49 @@ | ||||||||||||||
<?php | ||||||||||||||
/** | ||||||||||||||
* ActivityPub New Follower E-Mail template. | ||||||||||||||
* | ||||||||||||||
* @package Activitypub | ||||||||||||||
*/ | ||||||||||||||
|
||||||||||||||
if ( ! isset( $actor ) ) { | ||||||||||||||
$actor = array(); | ||||||||||||||
return; | ||||||||||||||
Comment on lines
+9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you help me understand why |
||||||||||||||
} | ||||||||||||||
|
||||||||||||||
?> | ||||||||||||||
<p> | ||||||||||||||
<?php | ||||||||||||||
esc_html_e( 'You have a new follower:', 'activitypub' ); | ||||||||||||||
?> | ||||||||||||||
</p> | ||||||||||||||
|
||||||||||||||
<table> | ||||||||||||||
<tr> | ||||||||||||||
<td style="vertical-align: top"> | ||||||||||||||
<a href="<?php echo esc_url( $actor['url'] ); ?>" style="float: left; margin-right: 1em;"> | ||||||||||||||
<?php if ( ! empty( $actor['icon']['url'] ) ) : ?> | ||||||||||||||
<img src="<?php echo esc_url( $actor['icon']['url'] ); ?>" alt="<?php echo esc_attr( $actor['name'] ); ?>" width="64" height="64"> | ||||||||||||||
<?php endif; ?> | ||||||||||||||
</a> | ||||||||||||||
</td> | ||||||||||||||
<td> | ||||||||||||||
|
||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
<a href="<?php echo esc_url( $actor['url'] ); ?>"> | ||||||||||||||
<strong><?php echo esc_html( $actor['name'] ); ?></strong> (<?php echo esc_html( $actor['url'] ); ?>) | ||||||||||||||
</a> | ||||||||||||||
<br> | ||||||||||||||
<?php | ||||||||||||||
if ( ! empty( $actor['summary'] ) ) { | ||||||||||||||
echo wp_kses_post( nl2br( $actor['summary'] ) ); | ||||||||||||||
} | ||||||||||||||
Comment on lines
+36
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
?> | ||||||||||||||
</td> | ||||||||||||||
</tr> | ||||||||||||||
</table> | ||||||||||||||
|
||||||||||||||
<?php | ||||||||||||||
|
||||||||||||||
/** | ||||||||||||||
* Fires at the bottom of the new follower email. | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
*/ | ||||||||||||||
do_action( 'activitypub_new_follower_email', $actor ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we call this "New Follower:"?