• Resolved Othello

    (@othello)


    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!

    https://www.ads-software.com/extend/plugins/jetpack/

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter Othello

    (@othello)

    PS: my blog’s URL is https://www.detection-du-mensonge.com

    Plugin Contributor Richard Archambault

    (@richardmtl)

    Hi Othello,

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

    https://plugins.trac.www.ads-software.com/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!

    Plugin Contributor George Stephanis

    (@georgestephanis)

    Hiya, Othello.

    Richard’s spot-on. As the Jetpack Comments module collects the comment in an iframe and submits to https://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.

    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.

    https://www.eatsleeptinker.com

    Plugin Contributor Richard Archambault

    (@richardmtl)

    Hi Chad,

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

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

    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

    Plugin Contributor Richard Archambault

    (@richardmtl)

    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!

    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.

    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 (https://mywebsite.com/wordpress/wp-comments-post.php) rather than at https://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 https://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…

    Plugin Contributor George Stephanis

    (@georgestephanis)

    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?

    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: https://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.

    Plugin Contributor George Stephanis

    (@georgestephanis)

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

    https://jetpack.me/support/sso/

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

    Plugin Contributor George Stephanis

    (@georgestephanis)

    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.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Possibility to "ajaxise" jetpack comments?’ is closed to new replies.