Support » Plugin: I Recommend This » Disable Ajax functionality

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Harish Chouhan


    @teti86, that would be possible but you would need to edit lot of the plugin and some extra functionality (similar to comments) where on clicking some data with ID would be passed to another page which could process and return user back to the previous page where they clicked.
    I am afraid I would not be able to assist you with this, but if you do develop it, would appreciate if you could share.

    Thanks Harish, I supposed it.
    Maybe there is possible to only refresh page when an user vote without modified lot of the plugin?

    Thanks again.

    Plugin Author Harish Chouhan


    @teti86, I think it would involve few steps. Right due to many in-built WP functions its easier to call a function inside a plugin using basic JavaScript & AJAX provided by WP. So to bypass it and use direct page refresh, first the ajax refresh would have to be disabled and some form with post method would have to be introduced.

    I try this solution, it seems to work.

    1- commented file dot_irecommendthis.js
    2- replaced the <a> button (inside the dot-irecommendthis.php file) with a form with an hidden input field with the post_id value and a submit button. This form is set to method post.
    3- create a custom page template that process the vote request (check if the cookies or ip already exist, update post meta, insert the ip on database, set the cookies) and then redirect to the contest page.

    Plugin Author Harish Chouhan


    @teti86 Thanks for the update. If you could share the code, I can try testing it within the plugin to allow users this option.

    Sorry for waiting. Sure, I can share the code but probably you can do it better.

    1- I create another text option (and its relative function) to “dot-irecommendthis.php”

    add_settings_field( 'contest_page', __( 'Insert page url to return after vote', 'dot' ), array(&$this, 'setting_contest_page'), 'dot-irecommendthis', 'dot-irecommendthis' );

    This option add a news text field on the setting panel of the plugin.

    2- comment the js file to remove the ajax call

    3- create a wordpress page template called “verify-template.php” and create a page with this template. This template contain the code that retrieve the post id with $_POST[‘recommend_id’], get and update the post meta, set cookie, and insert in the DB the ip. After that redirect to the page set in the option $options[‘contest_page’].

    4- remove the a link in the “dot-irecommendthis.php” file (row 654) and add a form:

    $dot_irt_html .= '<form action="" method="post">';
    $dot_irt_html .= '<input type="hidden" name="recommend_id" value="'. $post_ID .'">';
    $dot_irt_html .= '<button type="submit">Vota</button>';
    $dot_irt_html .= apply_filters( 'dot_irt_before_count', $output );
    $dot_irt_html .= '</form>';

    Plugin Author Harish Chouhan


    Thansks mate. This is helpful. I will try adding it on my site. let me know if there is any site links of yours to give credit ti.

    Thanks to you for the plugin =)
    I forgot one thing. The form is outputted (I don’t know if “outputted” is the correct word =D) only if cookies aren’t set or ip isn’t in database.
    So if a person has already voted can not see the form and the submit button.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Disable Ajax functionality’ is closed to new replies.