Ready for WP 2.7

At the start of the month, there was news that WP2.7 was going to be coming out, so like any good blogger (now defined by those who still blog more or as much as they tweet, I went about doing backups and testing restores for my database and checking to see what else I might need or want to change.

Media Uploader

During this process, I thought that to make sure that I was ready for 2.7, I would likely have to nuke my data base and start fresh, because since 2.5, I have not been able to use the media uploader. I thought that since I have a number of other WP installs that are all running on the same server and differ only in their “extended plugin” set and database and they all

work, that the database that this blog is using must be the issue. Hence thinking… blow it away, or at least hook up a new DB and see what is the matter. This was supported to some degree by some of the questions that I had asked the blogosphere for help on this topic and the only issue that was known then was that perhaps there was a permissions issue with the folders on the server. Others mentioned that it might have something to do with the Flash Uploader, so I grabbed a “no Flash Uploader” plugin and that did nothing, so I was left to suffer without the ability to easily upload images into my posts.

So while I was getting ready to create this other DB, I thought, wait, this can’t be a DB issue, it might be something that is “legacy” within my install. So I went about researching the error that I got again. And in the interest of helping out everyone else who might find themselves in the same boat, I’ll provide a bit of a trip report.

The trip started with the error “Are you sure you want to do this”. Looking up this error generally through Google and specifically within WP, I was able to track down this support doc after searching for “can’t upload media files wordpress 2.6.5”, finding that it was indeed one of my plugins (oddly, one that all my other “working” installs also have) at fault. So I followed the advice:
In wp-contactform.php, move this block of code (starting around line 13:
//Grab some default user info, if available (Submitted by Dan)
$wpcf_auto_email = get_profile('user_email');
$wpcf_auto_ID = get_profile('ID');
$wpcf_auto_first_name = get_usermeta($wpcf_auto_ID, 'first_name');
$wpcf_auto_last_name = get_usermeta($wpcf_auto_ID, 'last_name');
$wpcf_auto_name = $wpcf_auto_first_name.' '.$wpcf_auto_last_name;
if (empty($_POST['wpcf_email'])) {
$_POST['wpcf_email'] = $wpcf_auto_email;
}
if (empty($_POST['wpcf_your_name'])) {
$_POST['wpcf_your_name'] = $wpcf_auto_name;
}

and move it to [around] line 137 (I found my slot at line 124) before
if(wpcf_check_input()) // If the input check returns true (ie. there has been a submission & input is ok)
So everything looked great, and I was able to get the uploader box not to show the “are you sure ” error, but now I had another error “blah blah blah wp-includes/plugin.php on line 311”. Now this one wasn’t fatal, but as I was on a roll, I thought I might as well fix this one up as well. I found the solution to this was also a quick bit of in the wp-includes\media.php file, adding the following as the last chunk of code:
function media_admin_css() {
wp_admin_css('css/media');
}

It turns out that this was an issue with the flexible uploader. So now everything seems to work (I’ll find out with this post) – though I still want to know why this issue didn’t impact all my blogs the same way – but at least I know what the fix is now.


Posted

in

,

by

Comments

2 responses to “Ready for WP 2.7”

  1. dm42 Avatar
    dm42

    yay! How did you know to take a snippet of code from the media.php file?

    1. Raj Avatar

      The error messages were pointing in that direction and I was hunting for files that would have been related to the uploader once I found out that it was part of the problem as well. As I noted on a later post, I still have a similar problem in 2.7, but at least it’s functional – it just doesn’t look pretty.

Leave a Reply

Your email address will not be published. Required fields are marked *