hellocoop / wordpress

A login and registration WordPress plugin for the Hellō service.
4 stars 2 forks source link

customize the sign-in link in the Leave a Reply block #92

Closed mscurtescu closed 1 year ago

mscurtescu commented 1 year ago

Is your feature request related to a problem? Please describe. The "Leave a Reply" block below posts / pages has the following sentence with a link:

You must be logged in to post a comment.

The "logged in" link takes you to the login page (/wp-login.php) where you can then click on "Continue with Hellō" and start the sign-in process.

The sign-in process could be started from the "Leave a Reply" block and bypass the login page at /wp-login.hp.

image

image

Describe the solution you'd like The "Continue with Hellō" button should be rendered directly in the "Leave a Reply" block.

mscurtescu commented 1 year ago
'must_log_in'          => sprintf(
    '<p class="must-log-in">%s</p>',
    sprintf(
        /* translators: %s: Login URL. */
        __( 'You must be <a href="%s">logged in</a> to post a comment.' ),
        /** This filter is documented in wp-includes/link-template.php */
        wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )
    )
),

https://github.com/WordPress/WordPress/blob/master/wp-includes/comment-template.php#L2492

Hook a bit further below:

$args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) );
mscurtescu commented 1 year ago

Comment level "Log in to Reply" link:

$defaults = array(
    'add_below'     => 'comment',
    'respond_id'    => 'respond',
    'reply_text'    => __( 'Reply' ),
    /* translators: Comment reply button text. %s: Comment author name. */
    'reply_to_text' => __( 'Reply to %s' ),
    'login_text'    => __( 'Log in to Reply' ),
    'max_depth'     => 0,
    'depth'         => 0,
    'before'        => '',
    'after'         => '',
);

The hook further down:

$args = apply_filters( 'comment_reply_link_args', $args, $comment, $post );
mscurtescu commented 1 year ago

Comment level "Log in to Reply" replaced with "Log in with Hellō to Reply" and direct auth link: https://github.com/hellocoop/wordpress/commit/e28b6a1d1223de7a9705b776bd21fe36e9248ef4

image

mscurtescu commented 1 year ago

"Leave a Reply" section sentence and link replaced with "Log in with Hellō to post a comment" button.

https://github.com/hellocoop/wordpress/commit/0a9bf58c647bba712a07675dcd2053ef8a4f4e71

image