WordPress.org

Forums

Social Login
Redirect comment login to form anchor (5 posts)

  1. airaid
    Member
    Posted 2 years ago #

    I've set up the plugin for use on the comment form. When users login they are redirected to the top of the post. To avoid the user having to scroll down the page to write their comment, is it possible to add an anchor to the redirect url so the user is taken directly to the form? i.e:

    http://www.example.com/post/#commentform

    Thanks.

    http://wordpress.org/extend/plugins/oa-social-login/

  2. RoselleCelina
    Member
    Posted 1 year ago #

    airaid,

    did you happen to get a solution on this? I'm having the same problem.

    thanks,
    roselle

  3. airaid
    Member
    Posted 1 year ago #

    It's been a while but I don't think I ever found a solution, sorry.

  4. RoselleCelina
    Member
    Posted 1 year ago #

    BWA-HA-HA-HA!!! I've found a solution. AFter many hours of googling and guessing, I figured it out.

    [Disclaimer: I have no idea what I am doing in regards to javascript or php...I'm just making logical guesses. Use this at your own risk.]

    Edit the "connect.js" file, located in your plugins folder under assets, then js.

    locate this

    jQuery('#loginform').append("<input type='hidden' id='redirect_to' name='redirect_to' value='" + window.location.href + "'>");
    		}

    and change to this

    jQuery('#loginform').append("<input type='hidden' id='redirect_to' name='redirect_to' value='" + window.location.href + "#startyourcomment" + "'>");
    		}

    THEN, locate this
    var current_url = window.location.href;
    and change to this
    var current_url = window.location.href = window.location.href + "#startyourcomment";

    Like I said, all I did was google and google for hours. I find that a lot of javascript and php is algebraic, so I just came up with this.

    Hope it helps and hope I was right! :)

  5. RoselleCelina
    Member
    Posted 1 year ago #

    replace #startyourcomment with whatever your anchor link is

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic