Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions includes/emails/class-wpum-emails.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,24 @@ public function get_tags() {
'tag' => 'login_page_url',
'function' => 'wpum_email_tag_login_page_url',
),
array(
'name' => esc_html__( 'Login page link', 'wp-user-manager' ),
'description' => esc_html__( 'Display the login page url.', 'wp-user-manager' ),

Copilot AI Feb 26, 2026

Copy link

Choose a reason for hiding this comment

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

The description says "Display the login page url" but this should say "Display the login page link" to differentiate it from the {login_page_url} tag. The {login_page_link} tag returns an HTML anchor tag, while {login_page_url} returns just the plain URL.

Suggested change
'description' => esc_html__( 'Display the login page url.', 'wp-user-manager' ),
'description' => esc_html__( 'Display the login page link.', 'wp-user-manager' ),

Copilot uses AI. Check for mistakes.
'tag' => 'login_page_link',
'function' => 'wpum_email_tag_login_page_link',
),
array(
'name' => esc_html__( 'Password recovery url', 'wp-user-manager' ),
'description' => esc_html__( 'Display the password recovery url.', 'wp-user-manager' ),
'tag' => 'recovery_url',
'function' => 'wpum_email_tag_password_recovery_url',
),
array(
'name' => esc_html__( 'Password recovery link', 'wp-user-manager' ),
'description' => esc_html__( 'Display the password recovery link.', 'wp-user-manager' ),

Copilot AI Feb 26, 2026

Copy link

Choose a reason for hiding this comment

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

The description says "Display the password recovery link" but should clarify that this returns an HTML anchor tag. Consider changing to "Display the password recovery url as a link" to match the pattern and differentiate from {recovery_url} which returns just the plain URL.

Suggested change
'description' => esc_html__( 'Display the password recovery link.', 'wp-user-manager' ),
'description' => esc_html__( 'Display the password recovery url as a link.', 'wp-user-manager' ),

Copilot uses AI. Check for mistakes.
'tag' => 'recovery_link',
'function' => 'wpum_email_tag_password_recovery_link',
),
Comment on lines +405 to +422

Copilot AI Feb 26, 2026

Copy link

Choose a reason for hiding this comment

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

According to issue #309, the client requested adding both URL and link tags for verification as well: {verification_url} and {verification_link}. This PR only implements the login_page and recovery tags but is missing the verification tags. The issue states: "I would like to make links look like buttons... {verification_url} - Display the verification url. {verification_link} - Display a link to the verification page." Consider implementing these missing tags to fully address the issue.

Copilot uses AI. Check for mistakes.
);

return apply_filters( 'wpum_email_tags', $email_tags, $this );
Expand Down
43 changes: 41 additions & 2 deletions includes/emails/wpum-email-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
}

/**
* Parse the {login_page_url} tag into the email to display the site login page url.
* Parse the {login_page_link} tag into the email to display the site login page url.

Copilot AI Feb 26, 2026

Copy link

Choose a reason for hiding this comment

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

The documentation comment incorrectly states this function parses the {login_page_link} tag, but this function is actually for {login_page_url} tag (which returns a plain URL). The {login_page_link} tag is handled by wpum_email_tag_login_page_link function below. Update the docstring to say "Parse the {login_page_url} tag".

Suggested change
* Parse the {login_page_link} tag into the email to display the site login page url.
* Parse the {login_page_url} tag into the email to display the site login page url.

Copilot uses AI. Check for mistakes.
*
* @param string $user_id
*
Expand All @@ -136,6 +136,21 @@
$login_page_url = wpum_get_core_page_id( 'login' );
$login_page_url = get_permalink( $login_page_url );

return $login_page_url;
}

/**
* Parse the {login_page_url} tag into the email to display the site login page url.

Copilot AI Feb 26, 2026

Copy link

Choose a reason for hiding this comment

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

The documentation comment incorrectly states this function parses the {login_page_url} tag, but this function is actually for {login_page_link} tag (which returns an HTML anchor tag). The {login_page_url} tag is handled by wpum_email_tag_login_page_url function above. Update the docstring to say "Parse the {login_page_link} tag".

Suggested change
* Parse the {login_page_url} tag into the email to display the site login page url.
* Parse the {login_page_link} tag into the email to display the site login page url.

Copilot uses AI. Check for mistakes.
*
* @param string $user_id
*
* @return string
*/
function wpum_email_tag_login_page_link( $user_id = false ) {

Check warning on line 149 in includes/emails/wpum-email-functions.php

View workflow job for this annotation

GitHub Actions / PHPCS

The method parameter $user_id is never used

Copilot AI Feb 26, 2026

Copy link

Choose a reason for hiding this comment

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

Missing test coverage for the new wpum_email_tag_login_page_link function. The existing test file tests the wpum_email_tag_login_page_url function at line 59-76, but there's no corresponding test for the new login_page_link tag function. Consider adding a test to verify that this function returns an HTML anchor tag when email_template is not 'none', and a plain URL otherwise.

Copilot uses AI. Check for mistakes.

Copilot AI Feb 26, 2026

Copy link

Choose a reason for hiding this comment

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

Missing phpcs:ignore comment for unused $user_id parameter. Other similar functions in this file (wpum_email_tag_login_page_url, wpum_email_tag_sitename, wpum_email_tag_website) include the comment "// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found -- Required by email tag callback signature." to suppress the warning for unused parameters that are required by the callback signature.

Suggested change
function wpum_email_tag_login_page_link( $user_id = false ) {
function wpum_email_tag_login_page_link( $user_id = false ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found -- Required by email tag callback signature.

Copilot uses AI. Check for mistakes.

$login_page_url = wpum_get_core_page_id( 'login' );
$login_page_url = get_permalink( $login_page_url );

$url = $login_page_url;

if ( wpum_get_option( 'email_template' ) !== 'none' ) {
Expand All @@ -157,7 +172,7 @@
}

/**
* Parse the {recovery_url} tag into the email to display personalized password recovery url.
* Parse the {recovery_link} tag into the email to display personalized password recovery url.

Copilot AI Feb 26, 2026

Copy link

Choose a reason for hiding this comment

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

The documentation comment incorrectly states this function parses the {recovery_link} tag, but this function is actually for {recovery_url} tag (which returns a plain URL). The {recovery_link} tag is handled by wpum_email_tag_password_recovery_link function below. Update the docstring to say "Parse the {recovery_url} tag".

Suggested change
* Parse the {recovery_link} tag into the email to display personalized password recovery url.
* Parse the {recovery_url} tag into the email to display personalized password recovery url.

Copilot uses AI. Check for mistakes.
*
* @param int $user_id
* @param string $password_reset_key
Expand All @@ -177,6 +192,30 @@
'action' => 'wpum-reset',
), $reset_page );

return $reset_page;
}

/**
* Parse the {recovery_url} tag into the email to display personalized password recovery url.

Copilot AI Feb 26, 2026

Copy link

Choose a reason for hiding this comment

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

The documentation comment incorrectly states this function parses the {recovery_url} tag, but this function is actually for {recovery_link} tag (which returns an HTML anchor tag). The {recovery_url} tag is handled by wpum_email_tag_password_recovery_url function above. Update the docstring to say "Parse the {recovery_link} tag".

Suggested change
* Parse the {recovery_url} tag into the email to display personalized password recovery url.
* Parse the {recovery_link} tag into the email to display personalized password recovery url.

Copilot uses AI. Check for mistakes.
*
* @param int $user_id
* @param string $password_reset_key
* @param string $plain_text_password
* @param string $tag
* @param string $email
*
* @return string
*/
function wpum_email_tag_password_recovery_link( $user_id, $password_reset_key, $plain_text_password, $tag, $email ) {

Copilot AI Feb 26, 2026

Copy link

Choose a reason for hiding this comment

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

Missing test coverage for the new wpum_email_tag_password_recovery_link function. While there is test coverage for other email tag functions in EmailTagsTest.php, there's no test for this new recovery_link tag function. Consider adding a test to verify that this function returns an HTML anchor tag when email_template is not 'none', and a plain URL otherwise, with the correct query parameters.

Copilot uses AI. Check for mistakes.

$reset_page = wpum_get_core_page_id( 'password' );
$reset_page = get_permalink( $reset_page );
$reset_page = add_query_arg( array(
'login' => rawurlencode( $email->user_login ),
'key' => $password_reset_key,
'action' => 'wpum-reset',
), $reset_page );

$link_color = apply_filters( 'wpum_email_tag_password_recovery_url_color', '#000' );

$output = $reset_page;
Expand Down
14 changes: 13 additions & 1 deletion tests/wpunit/Emails/EmailTagsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,21 @@ public function test_email_tag_replaced() {
* Test that {login_page_url} tag returns a URL.
*/
public function test_login_page_url_tag_replaced() {
$page_id = $this->factory()->post->create( array(
'post_type' => 'page',
'post_title' => 'Login Page',
'post_status' => 'publish',
) );

$filter = function () use ( $page_id ) {
return array( $page_id );
};
add_filter( 'wpum_get_option_login_page', $filter );

$result = wpum_email_tag_login_page_url( $this->test_user_id );

// The result should contain some URL string or link.
remove_filter( 'wpum_get_option_login_page', $filter );

$this->assertNotEmpty( $result, 'login_page_url tag should return a non-empty value.' );
}

Expand Down