Skip to content
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

Open
wants to merge 10 commits into
base: trunk
Choose a base branch
from
Open

Conversation

akirk
Copy link
Member

@akirk akirk commented Jan 16, 2025

This adds some metadata like the user icon and the user summary to the new follower e-mail and adds an action for other plugins to include their data (for example, a Follow Back link). See akirk/friends#428

Screenshot 2025-01-16 at 14 46 08

@akirk akirk force-pushed the enrich-follower-email branch from ca9c4c3 to 49bec73 Compare January 24, 2025 14:07
@akirk akirk marked this pull request as ready for review January 24, 2025 14:24
@akirk akirk requested review from pfefferle and obenland and removed request for pfefferle January 24, 2025 14:24
@akirk akirk requested a review from pfefferle January 28, 2025 08:45
$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'] );
Copy link
Member

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:"?


$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";
Copy link
Member

Choose a reason for hiding this comment

The 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?

Comment on lines +9 to +10
$actor = array();
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you help me understand why $actor gets set to an empty array before returning? Does it has to do with how it's being used in new_follower() later on?

</a>
</td>
<td>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Comment on lines +36 to +38
if ( ! empty( $actor['summary'] ) ) {
echo wp_kses_post( nl2br( $actor['summary'] ) );
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( ! empty( $actor['summary'] ) ) {
echo wp_kses_post( nl2br( $actor['summary'] ) );
}
if ( ! empty( $actor['summary'] ) ) :
echo wp_kses_post( nl2br( $actor['summary'] ) );
endif;

<?php

/**
* Fires at the bottom of the new follower email.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Fires at the bottom of the new follower email.
* Fires at the bottom of the new follower email.
*
* @param array $actor The actor that followed the blog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants