Archive for the ‘PHP’ Category

Disabling Post Revisions: WordPress 3.0.4

Saturday, January 15th, 2011

I discovered that WordPress was again saving every revision of every post after I upgraded the   Tom’s Views   blog to WordPress 3.0.4, though I had disabled this feature during the last WordPress upgrade.  Click   here   for more details.  But apparently, in this latest version, the automatic retention of these revisions became enabled once more. So I turned off this feature by commenting out line 4404 in the wp-includes/post.php file as follows:

Line 4404 was:

          if ( ! WP_POST_REVISIONS )

but now, it’s:

        // if ( ! WP_POST_REVISIONS )

Then I deleted all the revisions that had been saved to this point since applying the WordPress upgrade from each blog database, by executing the following SQL statement:

DELETE FROM wp_posts WHERE post_type = “revision”;

I then logged out and back into each site’s admin id and verified that the revisions saved thus far no longer appear on the Edit Post screen. The deletion apparently worked.   These instructions have now been verified to work with WordPress 3.0.2.

That’s all.

Tom Hesley

Related Posts

Disabling Post Revisions: WordPress 3.0.3

Saturday, December 11th, 2010

I discovered that WordPress was again saving every revision of every post after I upgraded the   Tom’s Views   blog to WordPress 3.0.3, though I had disabled this feature during the last WordPress upgrade.  Click   here   for more details.  But apparently, in this latest version, the automatic retention of these revisions became enabled once more. So I turned off this feature by commenting out line 4404 in the wp-includes/post.php file as follows:

Line 4404 was:

          if ( ! WP_POST_REVISIONS )

but now, it’s:

        // if ( ! WP_POST_REVISIONS )

Then I deleted all the revisions that had been saved to this point since applying the WordPress upgrade from each blog database, by executing the following SQL statement:

DELETE FROM wp_posts WHERE post_type = “revision”;

I then logged out and back into each site’s admin id and verified that the revisions saved thus far no longer appear on the Edit Post screen. The deletion apparently worked.   These instructions have now been verified to work with WordPress 3.0.2.

That’s all.

Tom Hesley

Related Posts

Disabling Post Revisions: WordPress 3.0.2

Saturday, December 4th, 2010

I discovered that WordPress was again saving every revision of every post after I upgraded the   Tom’s Views   blog to WordPress 3.0.2, though I had disabled this feature during the last WordPress upgrade.  Click   here   for more details.  But apparently, in this latest version, the automatic retention of these revisions became enabled once more. So I turned off this feature by commenting out line 4404 in the wp-includes/post.php file as follows:

Line 4404 was:

          if ( ! WP_POST_REVISIONS )

but now, it’s:

        // if ( ! WP_POST_REVISIONS )

Then I deleted all the revisions that had been saved to this point from each blog database by executing the following SQL statement:

DELETE FROM wp_posts WHERE post_type = “revision”;

I then logged out and back into each site’s admin id and verified that the revisions saved thus far no longer appear on the Edit Post screen. The deletion apparently worked.   These instructions have now been verified to work with WordPress 3.0.2.

That’s all.

Tom Hesley

Related Posts

Disabling Post Revisions: WordPress 3.0.1

Sunday, October 31st, 2010

I discovered that WordPress was again saving every revision of every post after I upgraded the   Tom’s Views   blog to WordPress 3.0.1, though I had disabled this feature during the last WordPress upgrade.  Click   here   for more details.  But apparently, in this latest version, the automatic retention of these revisions became enabled once more. So I turned off this feature by commenting out line 4404 in the wp-includes/post.php file as follows:

Line 4404 was:

          if ( ! WP_POST_REVISIONS )

but now, it’s:

        // if ( ! WP_POST_REVISIONS )

Then I deleted all the revisions that had been saved to this point from each blog database by executing the following SQL statement:

DELETE FROM wp_posts WHERE post_type = ‘revision’;

I then logged out and back into each site’s admin id and verified that the revisions saved thus far no longer appear on the Edit Post screen. The deletion apparently worked.   These instructions have now been verified to work with WordPress 3.0.1.

That’s all.

Tom Hesley

Related Posts

Disabling Post Revisions: WordPress 3.0

Saturday, June 26th, 2010

I discovered that WordPress was again saving every revision of every post after I upgraded the   Tom’s Views   blog to WordPress 3.0, though I had disabled this feature back in March.  Click   here   for more details.  But apparently, in this latest version, the automatic retention of these revisions became enabled once more. So I turned off this feature by commenting out line 4398 in the wp-includes/post.php file as follows:

Line 4398 was:

          if ( ! WP_POST_REVISIONS )

but now, it’s:

        // if ( ! WP_POST_REVISIONS )

Then I deleted all the revisions that had been saved to this point from each blog database by executing the following SQL statement:

DELETE FROM wp_posts WHERE post_type = ‘revision’;

I then logged out and back into each site’s admin id and verified that the revisions saved thus far no longer appear on the Edit Post screen. The deletion apparently worked.   These instructions have now been verified to work with WordPress 3.0.

That’s all.

Tom Hesley

Related Posts

Disabling Post Revisions: WordPress 2.9.2

Monday, May 10th, 2010

I discovered that WordPress was again saving every revision of every post, though I had disabled this feature back in March.  Click   here   for more details.  But apparently, in the upgrade to 2.9.2, the automatic retention of these revisions became enabled once more. So I turned off this feature by adding the following lines of code to the wp-config.php file at lines 27 and 28 for each of my blogs:

// Disable post revisions.
define(’WP_POST_REVISIONS’, false);

 I also changed line 618 in the wp-settings.php file from

$default_constants = array( ‘WP_POST_REVISIONS’ => true );

to

$default_constants = array( ‘WP_POST_REVISIONS’ => false );

Also note that the line number has not changed from what it was in WordPress 2.9.1.

Then I deleted all the revisions that had been saved to this point from each blog database by executing the following SQL statement:

DELETE FROM wp_posts WHERE post_type = “revision”;

I then logged out and back into each site’s admin id and verified that the revisions saved thus far no longer appear on the Edit Post screen. The deletion apparently worked.   These instructions have been verified to work with WordPress 2.9.2.

That’s all.

Tom

Related Posts

Today’s Business: 2010-02-25

Thursday, February 25th, 2010

Today’s Activities

  • Shower.  DONE.
  • Schedule appointment for Mom with the retina specialists in Johnstown for sometime in April, 2010. 

 

Log

07:50 AM: I’m up. My weight is unchanged from yesterday.  It’s still  177.0 Lbs.

09:00 AM: I applied a software change to all my blogs that shortens all title tags for single posts; it eliminates the string:  Blog Archive  as well as one separator character from the titles.  This should fix the issues raised by my hosting provider about some of my title tags containing too many characters.  Presumably now, search engines will index more of my posts.  I’m not sure that this is actually true.  But the IT folks at my hosting company know lots more about this stuff than I do.  So I’ll take their word for it and bring the blogs into compliance.  Next thing to do, they suggest, is to remove all duplicate titles.  I did this for   Tom’s Diary  so far.  I’ll get to work on   Tom’s Love Quest   now.

11:20 AM: Spent the past couple hours categorizing posts on the   Tom’s Love Quest   blog.  I added categories for AffirmationsAloneness,  Cheating,   and   Loneliness   among others.    

01:30 PM: Watched today’s episode of   The Young and the Restless   with   [Emmy].

02:50 PM: We dined at our favorite Indian restaurant: Tamarind Flavor of India, on Craig Street in Oakland.  Yum.

03:00 PM: Categorized more posts on the   Tom’s Love Quest   blog.  Now, there are just 18 left to do.   Details   here.

04:00 PM: Watched today’s episode of   Dr. Phil.

06:00 PM: Made numerous revisions to the   Tom’s Love Quest   blog.

07:30 PM: Watched tonight’s episodes of    NBC’s Nightly News    and   The CBS Evening News   TV news shows.

12:25 AM: Read four more chapters of the book:  The Drunkard’s Walk: How Randomness Rules Our Lives   by Leonard Mlodinow.

12:30 AM: Bed time.  See you tomorrow. 

Tom Hesley

Related Posts

Disabling Post Revisions: 2010-02-17

Wednesday, February 17th, 2010

Disabling (or turning off) the retention of post revisions in WordPress 2.9.2 involves the same procedure as it did in WordPress 2.9.1.  Click   here   to view that procedure. 

Click   here   for details of the WordPress 2.9.2 upgrade, that prompted this adjustment.

Tom

Related Posts

Disabling Post Revisions: WordPress 2.9.1

Thursday, January 21st, 2010

I discovered that WordPress was again saving every revision of every post, though I had disabled this feature back in March.  Click   here   for more details.  But apparently, in the upgrade to 2.9.1, the automatic retention of these revisions became enabled once more. So I turned off this feature by adding the following lines of code to the wp-config.php file for each of my blogs:

// Disable post revisions.
define(’WP_POST_REVISIONS’, false);

 I also changed line 618 in the wp-settings.php file from

$default_constants = array( ‘WP_POST_REVISIONS’ => true );

to

$default_constants = array( ‘WP_POST_REVISIONS’ => false );

Also note that the line number has changed from 576 in 2.8.5 to 618 in 2.9.1.

Then I deleted all the revisions that had been saved to this point from each blog database by executing the following SQL statement:

DELETE FROM wp_posts WHERE post_type = ‘revision’;

I then logged out and back into each site’s admin id and verified that the revisions saved thus far no longer appear on the Edit Post screen. The deletion apparently worked.   These instructions have been verified to work with WordPress 2.9.1.

That’s all.

Tom

Related Posts

Ads Display Bug: 2010-01-19

Tuesday, January 19th, 2010

08:30 AM: Noticed that since the plugin upgrades last night, the advertisements on this blog are appearing on the bottom three posts on the main page, and not the top three as before.  However, my other two blogs do not display this problem.  Investigating.

09:20 AM: Tried uninstalling and reinstalling the AddSense Integrator plugin.  The display problem persists.

09:30 AM: Tried restoring the site software for the   Tom’s Diary   blog from last weekend’s backups.  This had the effect of downgrading the plugins which I upgraded last night.  However, surprisingly, this did not fix the issue either.  Even with the old versions of all plugins, the ads still appear at the bottem of the main page instead of at the top.  Apparently, something has changed in the database itself.  However, I’m reluctant to restore it to last night’s backup, as I’ve made several posts and post edits since then that would be lost.   So I’ll need to find another solution. Stand by.

10:15 AM: Discovered approximately 20 blank ad records in the AddSense Integrator setup page on the   Tom’s Diary   blog, that are not present in the other two, correctly functioning blogs.  So, I deleted these.  This seems to have partially fixed the trouble.  Now, the first of the three ads indeed displays at the bottom of the first post.  This post is located at the top of the page.  However, the other two ads still appear on the bottom two posts on the main page.  So, I’ll keep digging. 

10:40 AM: Tried deleting all add records and then re creating the ones I need.  But the display issue still persists.  I’d like to have all ads close to the top of the main pages, because there, they’ll be more likely to be spotted, and clicked. 

11:00 AM: Looked for where the AddSense Integrator plugin is storing the data about the ads it displays.  First, I checked each table in the blog database. Didn’t see anything resembling these data there.  Then, I looked in the software directories for the blog, but could not find any recently-modified files there.  However, I didn’t check every possible place on the file system.  But I think I will now.

11:30 AM: Scrutenized the AddSense Integrator’s PHP code file for clues.  Nothing useful discovered so far.

01:20 PM: Looks like the AdSense Integrator stores the persistent data for the ads in the WordPress database wp-options table.  These options begin with abs_int_  . 

01:30 PM: Discovered that even when the AdSense Integrator plugin is removed, it leaves old data in the wp_options table.  So I’m going to remove these rows, reinstall the plugin, and see if the ads display where they’re supposed to.

01:35 PM: Removing the old options data from the database, and then reinstalling the AdSense Integrator plugin  did not solve the issue.  Looking further.

01:50 PM: There’s an AddSense Integrator option checkbox that appears on the post editing screen, which allows the editor to stop ads from displaying at the bottom of the post he’s working on.  In version 1.5.4 of this software, which I’d been using prior to the upgrade to 1.5.7 last night, the default value for this checkbox was UNCHECKED.  That is: Ads would display by default on all posts, unless the editor specifically checked this checkbox before saving the post. However, now the behavior is reversed.  The box is checked even though the data in the database for the post indicates that it should not be.  So whenever the editor either creates a new post, or saves an existing one, this checkbox comes up as CHECKED, and unless he specifically unchecks it before saving the post, the post is saved with the display of ads turned off, even though it was turned on before the save.  This would seem to qualify as a bug in the AddSense Integrator plugin.

Further in this latest version (1.5.7) of the AddSense Integrator, the ads still display as before, as long as you do not either add new posts, or modify existing ones.  This is why my other blogs seemed to be unaffected by the plugin upgrade, as I’ve not added or changed any posts on those since last night.  So, I pulled one post from   Tom’s Love Quest   into the editor, and then re-saved it.  Then, I went to the blog home page, and sure enough, ads no longer appeared on that particular post.  So then, I edited the document again and unchecked the “Check to disable ads on this post.” check-box, and again, re saved the post.  Proper ad display then returned.

02:15 PM: So, I’m investigating the possibility of changing the default state of this checkbox from CHECKED to UNCHECKED.

04:20 PM: Modified line 251 in the AddSense Integrator PHP file from this:

<input type=”checkbox” name=”ads_int_disable” <?php if ($ads_int_disable) echo “checked”; ?>/>

 to this:

<input type=”checkbox” name=”ads_int_disable” <?php if ($ads_int_disable) echo “unchecked”; ?>/>

However, a problem still exists that this checkbox is not correctly set from the post’s meta data.  This is a bug for the plugin’s developers to address.  But this work-around I’ve devised above will keep the box unchecked at all times, and stop the automatic setting of this flag when the post is saved.  No troubles with this here, because I prevent none of my posts from showing advertisements.

04:30 PM: Deleted all the ads_int_disable  records from the post_meta table in the database (six posts had been marked here as advertisement-disabled).  This should re enable display of ads on all posts in this blog.

 Tom Hesley

Related Posts