zanematthew/zm-ajax-login-register

Filter the comments form link

zanematthew opened this issue · 0 comments

The following needs a home in the plugin

function zm_alr_pro_comment_form_filter( $defaults ){

    global $zm_alr_pro_settings;

    if ( ! empty( $zm_alr_pro_settings['login_handle'] ) ){
        $class = str_replace( '.', '', $zm_alr_pro_settings['login_handle'] );
        $defaults['must_log_in'] = '<p class="must-log-in '.$class.'">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>';

    }

    return $defaults;
}
add_filter( 'comment_form_defaults', 'zm_alr_pro_comment_form_filter' );

Per the support forum: https://wordpress.org/support/topic/how-to-stop-redirection-when-i-click-on-you-must-be-logged-in-to-post-coments?replies=2#post-7238014