Ajay's Creations Support Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ajax Edit Comments is now subscription based. All support questions need to be directed to http://www.ajaxeditcomments.com/forums/

Pages: [1]   Go Down

Author Topic: Ajax Error  (Read 455 times)

lewkut

  • Newbie
  • *
  • Offline Offline
  • Posts: 3
    • View Profile
    • Luxury Beach Resorts
Ajax Error
« on: February 27, 2010, 08:02:38 AM »

Hi There

I have  Wordpress 2.9.2
          Where do they go from here plug-in 1.4.2
          Post Teaser plug-in 4.0.1

As soon as I installed the Where Do They Go From Here Plug-in, it has a problem with the Post Teaser Plug-in. When you go and click on the
Read the full post (532 words, 17 images, estimated 2:08 mins reading time)

Then an Ajax Error pops up. When I deactivate the (Where Do They Go From Here) plug-in, than it's fine.

Any suggestions, I've also deactivated then reactivated all my plug-ins and it still don't work.

www.luxurybeachresorts360.com  Here's the site where you can check it out.

Thanks much
Egon
« Last Edit: February 27, 2010, 08:04:56 AM by lewkut »
Logged

Ajay

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 596
    • View Profile
    • Ajay - On the Road called Life
Re: Ajax Error
« Reply #1 on: February 27, 2010, 09:56:05 AM »

What happens when you disable the Post Teaser plugin?
Logged

lewkut

  • Newbie
  • *
  • Offline Offline
  • Posts: 3
    • View Profile
    • Luxury Beach Resorts
Re: Ajax Error
« Reply #2 on: February 28, 2010, 08:48:53 PM »


When I disable the Post Teaser plug-in, still get the Ajax Error when I click on Read The Full Article.
When I disable the Where Do You Go From Here plug-in, I get no error.

Egon
Logged

Ajay

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 596
    • View Profile
    • Ajay - On the Road called Life
Re: Ajax Error
« Reply #3 on: February 28, 2010, 10:31:00 PM »

Does this happen only when you jump from the index to the single pages or when you click on "Read The Full Article" or from post to post?
Logged

lewkut

  • Newbie
  • *
  • Offline Offline
  • Posts: 3
    • View Profile
    • Luxury Beach Resorts
Re: Ajax Error
« Reply #4 on: March 01, 2010, 05:55:55 AM »

Hi

If you go to my site & click on read the full post, you'll get the ajax error.
If you go to the next post & click on read the full article, you'll get the ajax error.
Only time I don't get the error, is if I deactivate the Where do I go from here plug-in

Try it  www.luxurybeachresorts360.com 

Egon
Logged

manchumahara

  • Newbie
  • *
  • Offline Offline
  • Posts: 3
    • View Profile
    • Let's start again
Re: Ajax Error
« Reply #5 on: March 01, 2010, 10:14:36 PM »

@Ajay
thank you for this great plugin. After I updated this to latest vesion I am happy that it has lots of option. But like some ppl I am getting the ajax errors in some pages. I just chcked the code and got some solution.
Code: [Select]
// Function that adds wherego code to the post content
add_filter('the_content', 'ald_wherego_content');
function ald_wherego_content($content) {
global $post, $wpdb, $single, $wherego_url, $whergo_id;
$wherego_settings = wherego_read_options();

if (($wherego_settings['add_to_feed'])||($wherego_settings['add_to_content'])) $output_list = ald_wherego(); // Get the list

if(is_single() || is_page()) {
$whergo_id = intval($post->ID); // Make the $wherego_id global for detection in the footer.
}
add_filter('the_content', 'ald_wherego_content');
That hook is not done in all pages, like sometimes we use some custom pages using template like
Code: [Select]
<?php
/*
Template Name: Blog Template
*/
?>
we can create an extra page using this tag and use custom query.
So in such pages the $whergo_id  is null and should be null if thee is not the_content() call on that page.
Even in some plugins the is_single and is_page doesn't work for mess up with query_posts function. It changes the global $wp_query variable ...  so in my functions.php file I use a function
Code: [Select]
function php4_clone($object) {
    if (version_compare(phpversion(), '5.0') < 0) {
            return $object;
    } else {
            return @clone($object);
    }
} //end php4_clone
and use like this
Code: [Select]
$temp_query = php4_clone($wp_query); // saving ....
query_posts($query_post);
query_posts($query_post);
if(have_posts()) {
while(have_posts()) {
the_post();
......

///end while tag etc...
 at last
$wp_query = php4_clone($temp_query); // here is retrive the global $wp_query var
above is the sample way.

to solve the ajax error issue I just changed one line in the plugin
near line 139
Code: [Select]
add_action('wp_footer','add_wherego_count');
function add_wherego_count() {
global $post, $wpdb, $single, $whergo_id;
if((is_single() || is_page()) && $whergo_id != NULL ) {
$id = $whergo_id;
?>
change is in this line
Code: [Select]
if((is_single() || is_page()) && $whergo_id != NULL ) {at least this will help not to call ajax or js if  $whergo_id is null any how.

Let me
Logged

Ajay

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 596
    • View Profile
    • Ajay - On the Road called Life
Re: Ajax Error
« Reply #6 on: March 01, 2010, 10:56:37 PM »

Hi

If you go to my site & click on read the full post, you'll get the ajax error.
If you go to the next post & click on read the full article, you'll get the ajax error.
Only time I don't get the error, is if I deactivate the Where do I go from here plug-in

Try it  www.luxurybeachresorts360.com 

Egon

Yup, I am sure its the plugin creating the error. Though, I am not sure as to why exactly.

Can you temporarily switch your theme to the default theme and see if this error occurs.

If this doesn't change, can you can try deleting line 147 in the plugin file that reads
Code: [Select]
where_go_count.onError = function() { alert('Ajax error' )};

But, I think this may break the plugin. After deleting this, you'll need to logout from your site and browse through a few pages.

Logged

Ajay

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 596
    • View Profile
    • Ajay - On the Road called Life
Re: Ajax Error
« Reply #7 on: March 01, 2010, 11:01:37 PM »

@Ajay
thank you for this great plugin. After I updated this to latest vesion I am happy that it has lots of option. But like some ppl I am getting the ajax errors in some pages. I just chcked the code and got some solution.
Code: [Select]
// Function that adds wherego code to the post content
add_filter('the_content', 'ald_wherego_content');
function ald_wherego_content($content) {
global $post, $wpdb, $single, $wherego_url, $whergo_id;
$wherego_settings = wherego_read_options();

if (($wherego_settings['add_to_feed'])||($wherego_settings['add_to_content'])) $output_list = ald_wherego(); // Get the list

if(is_single() || is_page()) {
$whergo_id = intval($post->ID); // Make the $wherego_id global for detection in the footer.
}
add_filter('the_content', 'ald_wherego_content');
That hook is not done in all pages, like sometimes we use some custom pages using template like
Code: [Select]
<?php
/*
Template Name: Blog Template
*/
?>
we can create an extra page using this tag and use custom query.
So in such pages the $whergo_id  is null and should be null if thee is not the_content() call on that page.
Even in some plugins the is_single and is_page doesn't work for mess up with query_posts function. It changes the global $wp_query variable ...  so in my functions.php file I use a function
Code: [Select]
function php4_clone($object) {
    if (version_compare(phpversion(), '5.0') < 0) {
            return $object;
    } else {
            return @clone($object);
    }
} //end php4_clone
and use like this
Code: [Select]
$temp_query = php4_clone($wp_query); // saving ....
query_posts($query_post);
query_posts($query_post);
if(have_posts()) {
while(have_posts()) {
the_post();
......

///end while tag etc...
 at last
$wp_query = php4_clone($temp_query); // here is retrive the global $wp_query var
above is the sample way.

to solve the ajax error issue I just changed one line in the plugin
near line 139
Code: [Select]
add_action('wp_footer','add_wherego_count');
function add_wherego_count() {
global $post, $wpdb, $single, $whergo_id;
if((is_single() || is_page()) && $whergo_id != NULL ) {
$id = $whergo_id;
?>
change is in this line
Code: [Select]
if((is_single() || is_page()) && $whergo_id != NULL ) {at least this will help not to call ajax or js if  $whergo_id is null any how.

Let me

The last option is the perfect one that I will release in an update.

Can you explain how I can implement the php4_clone function and how exactly this works?
Logged

Ajay

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 596
    • View Profile
    • Ajay - On the Road called Life
Re: Ajax Error
« Reply #8 on: March 01, 2010, 11:03:01 PM »

Hi

If you go to my site & click on read the full post, you'll get the ajax error.
If you go to the next post & click on read the full article, you'll get the ajax error.
Only time I don't get the error, is if I deactivate the Where do I go from here plug-in

Try it  www.luxurybeachresorts360.com 

Egon

Also an you try the solution that manchumahara suggested above?
Logged

manchumahara

  • Newbie
  • *
  • Offline Offline
  • Posts: 3
    • View Profile
    • Let's start again
Re: Ajax Error
« Reply #9 on: March 23, 2010, 12:05:12 AM »


Can you explain how I can implement the php4_clone function and how exactly this works?

actually wordpress has a native function with same functionality named wp_clone()   just search wp
or you can use in your plugin using if function not exists
Code: [Select]
function php4_clone($object) {
  if (version_compare(phpversion(), '5.0') < 0) {
    return $object;
  } else {
    return @clone($object);
  }
 } //end php4_clone
example
Code: [Select]
$query_backup = php4_clone($GLOBALS['wp_query']);   
query_posts('showposts=5');
if (have_posts()) : while (have_posts()) : the_post();
?><a href="<?php the_permalink() ?>"><?php the_title() ?></a><br /><?php
endwhile; endif;
$GLOBALS['wp_query'] = $query_backup;

another way can be  using wp reset query . please see this link
http://codex.wordpress.org/Function_Reference/wp_reset_query

Sorry for late reply. I forgot to subscribe this post
« Last Edit: March 23, 2010, 12:13:23 AM by manchumahara »
Logged

Ajay

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 596
    • View Profile
    • Ajay - On the Road called Life
Re: Ajax Error
« Reply #10 on: March 24, 2010, 11:42:48 PM »

Thanks. I still need to figure all this out with my limited PHP skills!
Logged

manchumahara

  • Newbie
  • *
  • Offline Offline
  • Posts: 3
    • View Profile
    • Let's start again
Re: Ajax Error
« Reply #11 on: March 24, 2010, 11:51:11 PM »

Thanks. I still need to figure all this out with my limited PHP skills!
ha ha ha  .... Hi Ajay already you did  great in developing some plugins. If you want I can give hand with you.
Logged

Ajay

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 596
    • View Profile
    • Ajay - On the Road called Life
Re: Ajax Error
« Reply #12 on: March 25, 2010, 12:04:53 AM »

Thank you. Am welcome with all the help I can get...
Logged
Pages: [1]   Go Up