Share Box not Hiding, and Page is Reloading and Reloading

Hi,
I tested the plugin and implemented it into a post.
If I Like / Tweet something, the page refreshes again and again, but the like box is not hiding. Is the plugin working at all?

Here is a Link to it.

Thanks :slight_smile:
Kevin

  • strategyforge
    • Flash Drive

    I dont have any cache plugins, i had some some time ago.

    With Ajax, the page is not reloading at least. But the Box is not hiding, and the hidden text is not shown. Also the other [shortcodes] of that post are not displayed.
    Do i made something wrong? Just activated the plugin and put this in:

    [pwal id="68514056" description="Like to Download"]test[/pwal]

  • Paul
    • The Green Incsub

    @strategyforge,

    I just tried the Facebook like and the PWAL box is hidden after and I see an image. I also see below the image a shortcode '[tab name="Overview"]'

    The PWAL will only effect content within its own shortcode. So not sure what to advise on the unprocessed shortcode. Maybe just try out a simple page first to see how it will work on your site. Then add in more complicated content.

    Try clearing your browser cache and cookie and try testing your page again.

  • Carlos Ramos
    • Design Lord, Child of Thor

    Hey, @Paul,

    I am having the same issue. After a 'Like' or 'Tweet' (others are untested), my page refreshed time after time. I changed the mode to AJAX but it seems to do nothing at all.
    I have no cache plugins enabled at the time.

    This is the URL

    Furthermore, when I manually reload the page (since AJAX is doing nothing), the Like is there. I mean, it shows I have already liked the content, it still shows the box instead of the content.

    Regards,
    Carlos.

  • Carlos Ramos
    • Design Lord, Child of Thor

    Hey, @Paul,

    I am using it with a shortcode, as done in this other thread, with this code on the template for my custom type:

    $idPost      = get_the_ID();
    $idGenerado  = get_the_date('YmdHi');
    $descripcion = 'Test description';
    $codigoPWAL = do_shortcode("[pwal id='$idGenerado' post_id='$idPost' description='$descripcion' content_reload='ajax'] Test content [/pwal]");

    In the custom post meta box these are the settings:
    Enabled? Default:Enabled
    Excerpt method: Default: Tool
    Reload content: Default AJAX

    Regards.

  • Paul
    • The Green Incsub

    @Carlos Ramos,

    Then you might be confusing the plugin. Per your previous comment you are using the WordPress do_shortcode() function within the template. But you are also setting the values within the post metabox?? Why not just use the shortcode directly within the post editor?

  • Paul
    • The Green Incsub

    @Carlos Ramos,

    When I check your page and go through the Facebook like I do see the PWAL AJAX post to the server. But for some reason the replacement content is returning blank. This is why the PWAL buttons are remaining. There is no content to show.

  • Carlos Ramos
    • Design Lord, Child of Thor

    @Hey, Paul,

    But you are also setting the values within the post metabox?

    The values in the meta box should not count since the ones in the shortcode are the ones used. However, better safe than sorry putting the same values on the post.

    Why not just use the shortcode directly within the post editor?

    Because my custom type has a custom field for the URL, so I want that URL to be protected by PWAL (therefore automated from the template).

    But for some reason the replacement content is returning blank. This is why the PWAL buttons are remaining. There is no content to show.

    That means the content within the shortcode is inexistant? Let me check into that possibility :slight_smile:.

    Regards.

  • Paul
    • The Green Incsub

    @Carlos Ramos,

    I need to do some testing on my end. When using the shortcode outside of the post editor the plugin needs to be able to find the hidden content. I don't think this can be done with the AJAX reload method. Basically the page needs to reload in order to have the do_shortcode() function you are using resubmitted. And within the shortcode processing PWAL can see if the content_id has been liked. I don't think there is a way to get to the hidden content via AJAX since PWAL does not store the hidden content during the initial processing. Follow?

  • Paul
    • The Green Incsub

    @Carlos Ramos,

    Would it not be the same? It reloads because it is not getting any information, therefore refreshes again and again?

    No, there are two different scenarios here. When you use the shortcode within a post then PWAL can load that post via the AJAX call and parse out the PWAL shortcode based on the content_id and get the hidden content. But when you use the do_shortcode directly there is no post to load from the wp_posts table. So the hidden content is not found. It is a hole in the logic and I'm not sure it can be handled correctly without somehow storing the content_id and hidden content in the settings. I'll need to think more on that.

    The reloading over and over is generally indicative of a cache plugin or something on the server. What I mean by this is PWAL handles the initial like processing then forced the page to reload to get the hidden content. When the page finished reloading the PWAL JavaScript code scans the page to look for any PWAL button sets. It checked the box against the user's cookie. If it find the user has previously like the button set then it forces a reload again. f the server is still delivering old content with the PWAL buttons sets this reload can get into a loop. At the moment there is no way to control this. As PWAL assumed when it reloads the page the fresh content will be shown.

    Normally this is because a cache plugin or something on the server prevents the page from being fully regenerated. So the old page version with the PWAL button set is delivered over and over.

  • Carlos Ramos
    • Design Lord, Child of Thor

    @Paul,

    Seems my problem lies with the plugin because I just made a regular post with the shortcode on it and the problem is the same.

    This URL has the test post. It is regular HTML, and I used the button on the editor to make it.

    However, it still is not working (so we can rule out the do_shortcode for the moment).

    And yes, I have already tried the plugin disabling all others.

  • Paul
    • The Green Incsub

    @Carlos Ramos,

    In your last post you provided a preview link. This will not work. Needs to be a published page. Please provide a correct link and I'll investigate.

    I'm working on a solution to store the shortcode hidden content into a WordPress transient. This will be one transient for each unique shortcode content_id. So then when the AJAX handler processes the post button click I'll be able to retrieve the stored hidden content via the transient.

  • Paul
    • The Green Incsub

    @Carlos Ramos,

    Hmm. That is a strange one. Looking at the JavaScript console. When the AJAX reply comes back the content which should contain the hidden content appears to contain another PWAL buttons box. See image.

    So standard questions how are you setting this PWAL? Is this shortcode within the post content? In the PWAL metabox on this post do you have the 'excerpt method' set to 'tool'?

    Maybe try the beta I provided before we go to far. Then I can help debug this further.

  • Carlos Ramos
    • Design Lord, Child of Thor

    @Paul,

    See image.

    What image?

    So standard questions how are you setting this PWAL?

    It seems I have it working. I disabled the "Sitewide Like" option. If you go back to the test page it must show the content in the right way. I think there is a bug there. If you see the content, you might want to check that sitewide like option for errors.

    Awaiting feedback.

  • Carlos Ramos
    • Design Lord, Child of Thor

    @Paul,

    Maybe try the beta I provided before we go to far. Then I can help debug this further.

    Will try the beta later this evening too, will get back to you later :slight_smile:.

    I'll need to do some testing on my end for the site-wide issue. Will get back to you later this evening.

    Thanks! For now I have PWAL working with page reload and without the site-wide like options activated.

    As soon as I test the beta, I will let you know how it works with AJAX and template code.

    Kind regards,
    Carlos.

  • Paul
    • The Green Incsub

    @Carlos Ramos,

    Ok. Back to this for a little while before I head off to bed. I do see something strange on the site-wide like. On my end it when enabled I can like one page and I see the hidden content. But when I visit a second page I'm seeing the PWAL buttons. So the site-wide logic does not seem to be working.

    But unable to reproduce the issue I saw earlier on your page when I processed the like the hidden content returned was the PWAL buttons again. Still trying some things.

  • Carlos Ramos
    • Design Lord, Child of Thor

    @Paul,

    So the site-wide logic does not seem to be working.

    Yeah, site-wide like is behaving a little strange. However, I might not be using it in favour of the email suscribers bypass that is being discussed in this thread.

    ( You as a developer have to see to that being fixed, of course, but is no longer of concern for my purposes :] )

    But unable to reproduce the issue I saw earlier on your page when I processed the like the hidden content returned was the PWAL buttons again. Still trying some things.

    I think that solving the site-wide logic should be enough, since that part of my configuration was causing the whole issue.

    Back to this for a little while before I head off to bed.

    I just downloaded your beta test, am about to test it. For now the plugin works with reload (and am awaiting the implementation on the other thread), so no rush anymore. Tomorrow will be another day to solve the issue.

    Regards,
    Carlos.

  • Carlos Ramos
    • Design Lord, Child of Thor

    @Paul,

    Yup, that AJAX is regular ol' HTML already on the page. But on the test server I have, where I use the do_shortcode in the template, it does not work.

    So, AJAX for regular works, the problem lies on the AJAX for content generatesd by code on template.

    Regards.

  • Paul
    • The Green Incsub

    @Carlos Ramos,

    But on the test server I have, where I use the do_shortcode in the template, it does not work.So, AJAX for regular works, the problem lies on the AJAX for content generatesd by code on template.

    Ok. Throwing me a curve there. So on your test server are you running the newest beta? Is it at all accessible where I can see a page?

  • Carlos Ramos
    • Design Lord, Child of Thor

    Hey, @Paul,

    Is it at all accessible where I can see a page?

    Yes, I am using the beta you sent me. And nope, it is not accesible. It is a localhost on my laptop. Let me see if I can create a public space or something, or proceed with more testing to see if AJAX for do_shortcode works.

    Will report as soon as I do so,
    Regards.

  • Paul
    • The Green Incsub

    @Carlos Ramos,

    Not so much concerned about you testing on a local host vs. public. Just need some specific information about what you are seeing vs expecting. Sometimes the issue is Facebook especially with a previous like. Then again I now there are bugs in the plugin code.

    Speaking of. Here is a new and hopefully the last beta. If you can install that on your local then we can move forward. Thanks.

    https://dl.dropboxusercontent.com/u/2616987/WPMUDev/pay-with-a-like/beta/pay-with-a-like-2.0.1-Beta4.zip

  • Carlos Ramos
    • Design Lord, Child of Thor

    Hey, @Paul,

    I just updated to the latest version of PWAL, and now I do not see the PWAL interface.

    The page just renders the content as if it was already liked. If I deactivate the plugin, I can see the shortcode code around the download button, but when I activate it I just see the content.

    I am not sure, but I think the update did something strange. I attach the images of what I see as anonymus user, when plugin is enabled and when it is disabled.

    The plugin version is 2.0.1, and I have no caching plugins enabled. However, I made some changes to the .htaccess file, so I want to know if it is a bug of new release or just my new rules interfering.

    Thanks in advance :smiley:.

  • Paul
    • The Green Incsub

    @Carlos Ramos,

    Let's step back to review how you have PWAL configured. And how you have previously tested.

    1. You are using a shortcode within a template file. Not the shortcode within the post content, correct?

    2. In your recent testing have you cleared your browser cache and removed all relative cookies?

  • Paul
    • The Green Incsub

    @Carlos Ramos,

    And just for review and hopefully not to confuse things. After posting that last comment I went back to my local development site. There in the TwentyFourteen theme in the page.php template file I added your previous shortcode ( https://gist.github.com/codehooligans/ab924d02feca22f56a28 )

    This does seem to work. The key and I know it gets frustrating it when testing PWAL to ensure you have properly cleared your browser. I keep my Firefox setup to clear all history and cookies every time I close the application. This way I'm always testing with a clean system.

    The other thing/question is are you using the Facebook API? You will see this on the PWAL > Social Buttons then the Facebook tab.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.