How to change login link in "You must be logged in to post a comment"

  • Marketing Master

    #5217

    I use WP User Control Widget and everything wok fine. But when I won’t login in “You must be logged in to post a comment” then I’m redirected to standard background WordPress admin login screen. How or where I can change this and connect this link with WP User Control Widget login or at list with frontend sign in (on page or post)?

    Anonymous

    #31170

    Add this to your child theme’s functions.php file. (put the code between <?php and ?> if the functions.php file is empty)

    function graphene_custom_comment_form_args( $args ){

    $args['must_log_in'] = 'You must be <a href="http://WP-User-Control-login.url">logged in</a> to post a comment.';

    return $args;
    }
    add_filter( 'graphene_comment_form_args', 'graphene_custom_comment_form_args' );

    Change http://WP-User-Control-login.url to actual URL of WP User Control front end sign in page.

    Marketing Master

    #31171

    Can I also put this in Graphene functions or custom css style, because I don’t use Child theme (I try, but when I activate the Child theme, page is totally messed around)?

    Anonymous

    #31172

    No, it’s a php function. You can’t put it in graphene custom CSS. Also, don’t put this in parent theme’s functions.php. It may ruin your site. Consider using a child theme instead. If you ran into any issues after activating the child theme, create a thread in this forum. We’ll try our best to sort it out.

    Marketing Master

    #31173

    OK, I create functions.php and works fine. I just don’t know how I can find WP login link, WP is only widget and there is no post or page?

    Anonymous

    #31174

    Try this. It actually scrolls to WP User Control widget in the same page.

    function graphene_custom_comment_form_args( $args ){

    $args['must_log_in'] = 'You must be <a href="#wp-user-control-widget-2">logged in</a> to post a comment.';

    return $args;
    }
    add_filter( 'graphene_comment_form_args', 'graphene_custom_comment_form_args' );

    If it doesn’t work. change #wp-user-control-widget-2 with the actual ID of WP User Control in your site.

    I think you can create a custom login link within the widget settings.

    screenshot-5.png

    Marketing Master

    #31175

    Finally manage to find appropriate link: “#login_div”. Where? At the bottom of Chrome browser, when I point to the WP UC Widget. 

    Now it works.

    I still learn, but this are great experience.

    Thanks, you have awesome support!

    lateatlantean

    #31176
    Quote:
    “You must be logged in to post a comment” then I’m redirected to standard background WordPress admin login screen.

    I am using Login with Ajax and also do not want the link in the sentence to do the above.

    Can I just remove the link and/or change the link destination or just the wording of the prompt (without the link) to direct users to the Ajax Register/Login at the top of the page? I do want users to login to post so I have chosen that option in settings, just want them directed to the Ajax Login, not the WordPress Login.

    What would you fine brainiacs recommend? 🙂

    Thanks again!

    Donna

    lateatlantean

    #31177

    Tried this but it didn’t work to direct to Ajax Login…sigh. I know you guys are busy…so I can be patient on this. 🙂 Thank you!

    <?php
    function graphene_custom_comment_form_args( $args ){

    $args['must_log_in'] = 'You must be <a href="#LoginWithAjax">logged in</a> to post a comment.';

    return $args;
    }
    add_filter( 'graphene_comment_form_args', 'graphene_custom_comment_form_args' );
    ?>

    Anonymous

    #31178

    @lateatlantean link to your site?

Viewing 10 posts - 1 through 10 (of 25 total)
  • You must be logged in to reply to this topic.
Do NOT follow this link or you will be banned from the site!