WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
[resolved] Possibility to "ajaxise" jetpack comments? (15 posts)

  1. Othello
    Member
    Posted 11 months ago #

    Hi there,
    Before using jetpack's comments, I was using plugins that could "ajaxise" comments, meaning that the page wouldn't entirely reload when someone was posting a comment.

    Those plugins don't seem to work with jetpack, hence my question: is there any way to ajaxise jetpack comments?

    Thanks!

    http://wordpress.org/extend/plugins/jetpack/

  2. Othello
    Member
    Posted 11 months ago #

  3. Richard Archambault
    Happiness Engineer
    Plugin Author

    Posted 11 months ago #

    Hi Othello,

    Thanks for the suggestion. I have created a Trac ticket for it, here:

    http://plugins.trac.wordpress.org/ticket/1729

    However, I suspect that this would require a major overhaul of how the comment module functions, so I can't guarantee that it will be done any time soon. But again, thank you for the suggestion!

  4. George Stephanis
    Automattic Lead Code Monkey
    Plugin Author

    Posted 10 months ago #

    Hiya, Othello.

    Richard's spot-on. As the Jetpack Comments module collects the comment in an iframe and submits to http://jetpack.wordpress.com/jetpack-comment/ before syncing it back to the blog via its connection to WordPress.com.

    There really isn't an ajaxy way to pass the data out of the iframe and into the page. Cross-domain rules in the browsers and such prevent it, more for your own security than anything else.

  5. Chadwickhugh
    Member
    Posted 5 months ago #

    Bump... Would be nice to have an Ajax style comment system that is compatible with the Jetpack social comments login.

    Also, any method for allowing users to select which account they are commenting under. When I go to my blog, it automatically uses my WordPress.com log-in, no option for posting using Facebook login is provided.

    http://www.eatsleeptinker.com

  6. Richard Archambault
    Happiness Engineer
    Plugin Author

    Posted 5 months ago #

    Hi Chad,

    When you say, "no option for posting using Facebook login is provided", do you see the "Change" option on your site? Screenshot: http://d.pr/i/Ty2y

    I see that option if I am logged in to my WordPress.com account.

  7. Chadwickhugh
    Member
    Posted 5 months ago #

    Yeah it appears that because I was logged into my blog as the admin it doesn't allow you to change. I logged out and was presented the option. Sorry about that.

    Any word on Ajax integration so the page doesn't have to reload? Also, any method to allow commenting directly from the homepage, rather than the individual post page?

    Thanks,
    Chad

  8. Richard Archambault
    Happiness Engineer
    Plugin Author

    Posted 5 months ago #

    Hi Chad,

    As George said above,

    There really isn't an ajaxy way to pass the data out of the iframe and into the page. Cross-domain rules in the browsers and such prevent it, more for your own security than anything else.

    As for adding comment sdirectly to the home page, you would need to add the comment form call to your theme's index.php or the template that it is using to show the front page:

    <?php comment_form(); ?>

    That should work, let me know if you need help with that!

  9. Lwangaman
    Member
    Posted 1 month ago #

    Perhaps you could use an approach that doesn't make use of iframes. You can still submit comments via ajax to other domains by using a php script that makes use of curl. So the ajax request is within the same domain, but the php that handles it makes a cross-domain request using curl.
    Then you just handle the response from the curl request to update the comments on the page.

  10. Lwangaman
    Member
    Posted 1 month ago #

    I can successfully display the comments form without an iframe by substituting line 253 in jetpack\modules\comments\comments.php (public function comment_form_after):

    <iframe src="<?php echo esc_url( $url ); ?>" allowtransparency="<?php echo $transparent; ?>" style="width:100%; height: <?php echo $height; ?>px;border:0px;" frameBorder="0" scrolling="no" name="jetpack_remote_comment" id="jetpack_remote_comment"></iframe>

    with this:

    <?php
    	echo wp_remote_retrieve_body( wp_remote_get($url) );
    ?>

    It works too, I can submit comments just fine, though I do notice that the resulting form action is pointing at my local wordpress comment script (http://mywebsite.com/wordpress/wp-comments-post.php) rather than at http://jetpack.wordpress.com/jetpack-comment/ . Also it's loading the whole page with meta tags and all (head and body tags are stripped out, maybe by Chrome? or by wp_remote_retrieve_body?). In order for it to become a clean solution (and a step towards allowing posting comments via ajax), perhaps http://jetpack.wordpress.com/jetpack-comment/ would have to generate an adequate response for such an external request, without all the head links and scripts and meta tags...

  11. George Stephanis
    Automattic Lead Code Monkey
    Plugin Author

    Posted 1 month ago #

    As I noted on the Trac ticket that you reopened, this destroys a lot of the benefits that the comment form was written to achieve, such as letting folks logged into their WP.com account not need to enter their personal details into .org sites using this comment form, and I believe that cross-domain browser restrictions would then prevent the oath with Facebook, Twitter, and Google Plus from working.

    At that point, you're losing nearly all the benefits of the Jetpack comment form ... so why are you even using it in the first place?

  12. Lwangaman
    Member
    Posted 1 month ago #

    It isn't possible to login to a WP.com account from a .org site? I thought that this was a new feature available now: http://en.blog.wordpress.com/2013/08/13/introducing-wordpress-com-connect/

    I'm seeing on a .org blog of mine that if I activate jetpack single-sign-on and I enable user registration, then I'm able to login to the website with my WP.com account, and it creates a .org account using the .com account.

    Supposedly one should be able to use the single-sign-on without having to enable user registrations... but I guess that isn't working just yet, or I just don't know how to configure it.

    But I'm guessing that if you can use single-sign-on for the login, then you can use it for comments too.

  13. George Stephanis
    Automattic Lead Code Monkey
    Plugin Author

    Posted 4 weeks ago #

    Here's the documentation for our Single Sign On module.

    http://jetpack.me/support/sso/

  14. Lwangaman
    Member
    Posted 4 weeks ago #

    Can't it be implemented for comments, without using an iframe?

  15. George Stephanis
    Automattic Lead Code Monkey
    Plugin Author

    Posted 4 weeks ago #

    If you'd like to give it a shot, have at it. Pull requests are accepted on GitHub. It's not something that we feel can be accomplished in a smooth way without losing ground on UX or regressions.

Reply

You must log in to post.

About this Plugin

About this Topic