Patch thickbox 404 errors in p2 theme (13 posts)

  1. n8v
    Posted 6 years ago #

    I don't know if there's a better place to submit this but I was noticing 404 errors on a couple of images (loadingAnimation.gif and tb-close.png) from the thickbox media uploader on the p2 front page new post form.

    By default the media uploader uses relative paths starting with ../ because it runs inside wp-admin/. The fix, since WP 2.8.4 is to override the location inside p2's post-form.php :

    --- post-form.php       (revision 13036)
    +++ post-form.php       (working copy)
    @@ -1,4 +1,8 @@
            <script type="text/javascript" charset="utf-8">
    +                /* properly reference thickbox images */
    +                var tb_pathToImage = "./wp-includes/js/thickbox/loadingAnimation.gif";
    +                var tb_closeImage = "./wp-includes/js/thickbox/tb-close.png";
                    jQuery(document).ready(function($) {

    Oh also, I'm using WordPress 3.1-alpha from the SVN trunk and a SVN checkout of the p2 v 1.1.5 tag/branch.

  2. Lance Willett
    Posted 6 years ago #

    Hi n8v,
    This forum is the correct place to report errors, and thanks for your report.

    I'm not able to reproduce the 404 errors running the same setup you mentioned. Both those images load fine in my testing. P2 loads /wp-admin/includes/media.php directly, so the image paths should work fine as defined by default.

  3. n8v
    Posted 6 years ago #

    hmmm... you went to the homepage of a p2-themed blog,
    clicked on the "add image" icon on the new post form (html id = add_image), and got the thickbox "popup" with a working close icon (tb_close.png) in the upper right?

  4. Lance Willett
    Posted 6 years ago #

    Affirmative. No 404 errors reported in Firebug using the "Net" tab to track images loading on the page.

  5. n8v
    Posted 6 years ago #


  6. webjac
    Posted 5 years ago #

    I'm having the same error in all my p2 installations.

    I'm using the latest version 1.2.3

    The icons for media upload point to the wrong link.Let me elaborate on this:

    If my blog is at: http://mydomain.com/blog

    The media upload should point to: http://mydomain.com/blog/wp-admin/includes/media.php

    But instead it goes to: http://mydomain.com/blog/blog/wp-admin/includes/media.php

    Giving then a 404 error because of the duplicated "blog/" in the link.

    How can I fix that?

  7. yasodhara
    Posted 5 years ago #

    Same error for me.
    The problem is an extra /wordpress/ in the path
    (like the extra /blog/ on webjac's installs)
    How to fix?

  8. ChevignoN
    Posted 5 years ago #

    I'm trying to solve this problem.

    For the moment i can change the first link when you click.

    But then for the upload it still don't works ...

    In the p2.php

    function admin_url( $path ) {
    		return $path;
    		//return P2::url_filter( admin_url( $path, 'http' ) );
    	function make_media_urls( $string ) {
    		// This line does not work in .org
    		return str_replace( 'media-upload.php?', P2::admin_url( '/inside-ajilon/wordpress/wp-admin/media-upload.php?p2-upload=true&' ), $string );
    		//return str_replace( 'media-upload.php?', P2::admin_url( '/media-upload.php?p2-upload=true&' ), $string );

    [Please post code snippets between backticks or use the code button.]

  9. NathanBecker
    Posted 5 years ago #

    same problem Upload/Insert <a href="http://tap2post.com/dt/dt/

    where's that extra /dt coming from :(

  10. yasodhara
    Posted 5 years ago #

    This is 90% solved:
    I know this is a hack, but commenting out line 66 of p2/inc/p2.php fixes the problem for us.


  11. jasonashaw
    Posted 5 years ago #

    Solved this problem with a simple general setting change.

    see http://wordpress.org/support/topic/p2-123-clicking-add-media-opens-up-error-page?replies=8#post-2136945

    change the site URL.

    blog URL http://www.sitename.com/p2/
    site URL http://www.sitename.com/

    that's it!


  12. schvenk
    Posted 5 years ago #

    Changing site name solves this for the media uploaded, but I'm having the same problem elsewhere (for instance, on the image for the close box on the media uploader) even with that fix. Note that in my case the WP install is more than one directory level deep.

  13. Ryan Gatto
    Posted 5 years ago #

    We covered this a few week back on our blog, http://www.catonthecouch.com/blog.

    Best of luck

Topic Closed

This topic has been closed to new replies.

About this Topic