WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Popular Posts
[How to] Timthumb.php with WPP on WP Multisite (4 posts)

  1. cristianfloyd
    Member
    Posted 1 year ago #

    Hola Héctor, tu trabajo con este plugin es excelente.
    Me he encontrado con una dificultad usando tu plugin en un Worpress multisitio. Lo que sucede es lo siguiente: En el dominio raíz funciona a la perfección las miniaturas, pero en los Sub Dominios no funciona; en realidad es una limitación en el Timthumb.php, dado que la url de la imagen que se le pasa al timthumb es una url ficticia, o sea que no es la real donde esta la imagen físicamente; entonces Timthumb.php te dice que no encuentra la imagen.

    Investigando un poco encontre esta pagina donde comenta como arreglarlo: Aquí

    Pense en pasarte esta solución porque me parece que va a ser muy útil para lo que usan multisitio, ya que anda en los dos; y podría servirte para una futura revisión del plugin que ya incluya este arreglo y que no haga una llamada al wp-load.php en cada miniatura que se carga.

    OJO que en el código del enlace hay un error y no funciona para el dominio raíz, hay que cambiar el numero de BlogID por el del dominio raiz, que por defecto es uno, pero puede ser otro ID el dominio raiz tambien. Hay que tener en cuenta eso.
    Abajo pego el codigo.

    Te mando un saludo desde Argentina!!!

    Hello Hector, your work with this plugin is excellent.
    I have encountered a difficulty using your plugin on a multisite Worpress. What happens is this: in the root domain works perfectly thumbnails, but in the Sub Domains does not work, it's actually a limitation in Timthumb.php since the url of the image that is passed to TimThumb url is a fictional, so it is not true where the image physically Timthumb.php then tells you that you do not see the image.

    With a little research I found this page which discusses how to fix it: Here

    I thought about pass this solution because I think it will be very useful for what they use multisite, and who walks in the two, and could serve for a future revision of the plugin that already includes this fix and not make a call to the wp-load.php on each thumbnail to load.
    Well I foun an error in the code. With this fix all blogs with ID > 1 work like a charm, BUT in the main site ie ID == 1, timthumb not found image in the url.
    To correct this in the second part of CODE in the sintax "IF blablabla > 0" here change to 1. Its very easy.

    I send you greetings from Argentina!

    To Timthumb ('VERSION', '2.8.10') here the fix:

    Part 1:

    [ Moderator note: thanks for using the code or backticks but please put them above and below your code on a new line. It formats better that way. ]

    // MULTISITE FIX  (parte 1 de 2) (2 at line #834)
    require( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' );
    timthumb::start();

    Part 2:

    // MULTISITE FIX  2012-12-03 (part 2 of 2) (1 at line #149)
    if (is_multisite())
    {
        global $blog_id;
        if (isset($blog_id) && $blog_id > 1) //changed 0 to 1 to not use fix in root domain
        {
            $docRoot .= '/wp-content/blogs.dir/' . $blog_id . '/';
        }
    }

    Here the full code fixed.

    http://wordpress.org/extend/plugins/wordpress-popular-posts/

  2. Héctor Cabrera
    Member
    Plugin Author

    Posted 1 year ago #

    Thank you, cristianfloyd!

    I'm sticking this topic so it serves as a reference to others. This modification applies only on versions 1.5.0 to 2.1.4, 2.3.0 to 2.3.2.

  3. Mladen Gradev
    Member
    Posted 1 year ago #

    Hi cristianfloyd,

    Thanks for this tip. Unfortunately it didn't work for me. My multisite images are located in wp-content/uploads/sites/2. I have tried to modify your code from:
    $docRoot .= '/wp-content/blogs.dir/' . $blog_id . '/';
    to
    $docRoot .= '/wp-content/uploads/sites/' . $blog_id . '/';
    but with no luck.

    Thanks anyway.

  4. silvanaincucina
    Member
    Posted 11 months ago #

    Hello Hector, I've updated your plugins today popula Post, unfortunately, now all the photos are appicicate to one another, I had used the HTML in the previous version, but it was a black quadtatino right in the middle of the recipe title link. I have uninstalled and reinstalled the plugin this time without the html code, unfortunately this is the result. What should I do to space the photos and get its title below the photo on the right instead? Appearance news thanks and good day

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic