Top

Fixing Post Teaser Plugin Bug for WP 2.3.1

November 17, 2007

Have you ever had problem with Post Teaser plugin for WordPress? I am using it and I found a bug. So I fixed the bug and now you can download it right from this page. I name it "Post Teaser 2" just so It won't mess up with the original one.

It's now available for download from this page: Post Teaser 2 - An Essential WordPress Plugin.

The Bug

When I click the Update Options button on the Manage Post Teaser page, I got this: "Cannot load post-teaser.php." as shown in the snapshot:

Post Teaser Bug

Locating the bug

It's annoying abit, but it's also easy to fix. I notice the following URL after the button is clicked:

http://binh.name/wp/wp-admin/options-general.php?page=post-teaser.php&saved=true

And this is the URL before the button is clicked:

http://binh.name/wp/wp-admin/options-general.php?page=post-teaser/post-teaser.php

The different here is noticable.

  • The failed query is: post-teaser.php&saved=true
  • The unfailed query is: post-teaser/post-teaser.php

So the correct query for saving the options should be: post-teaser/post-teaser.php&saved=true

Debugging it

Open file "post-teaser/post-teaser.php" in the Plugin Editor (found in the Plugins page in Admin panel).

Search for the string "post-teaser.php&saved=true" in the file , and found the following lines:

  • 101: header('Location: ' . get_settings('siteurl') . '/wp-admin/options-general.php?page=post-teaser.php&saved=true');
  • 103: header('Location: ' . get_settings('siteurl') . '/wp-admin/options-general.php?page=post-teaser.php&saved=true');

Replace "post-teaser.php&saved=true" with "post-teaser/post-teaser.php&saved=true" and we get:

  • 101: header('Location: ' . get_settings('siteurl') . '/wp-admin/options-general.php?page=post-teaser/post-teaser.php&saved=true');
  • 103: header('Location: ' . get_settings('siteurl') . '/wp-admin/options-general.php?page=post-teaser/post-teaser.php&saved=true');

Alternatively you could edit the plugin file locally then upload it.

A screenshot where it is located:

Edit Post Teaser Code File

Problem Fixed:

Post Teaser Bug Fixed

Conclusion

The author of this plugin actually wrote it up to version 2.3 of WordPress. Or maybe because he just didn't mean to have the user keep the post-teaser.php file under the post-teaser folder. Either way, I hope when writing the plugin and packaging it the author should consider the end user first.

I, a web developer still didn't realise I had to extract the php file into the plugins folder instead of the whole folder which contains the php file? Most of the plugins come packaged with readme.txt, plugin-name.pot, etc. How does the user know what to do without reading pages of documentation? We should make it simple for the end users. KISS principle is appreciated.

Since this wonderful plugin has a public license I would like to continue supporting it. If you have any problem please feel free to leave a comment on this page. And... sorry I couldn't fix the translation files. So if you are using another language, please bear not having it, or modify the original file as directed by this debugging tutorial.

You can directly download Post Teaser 2 now.

Tags: Plugin, Site

Related posts

Comments

Got something to say?





Bottom