Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Multisite (http://forum.bytesforall.com/forumdisplay.php?f=46)
-   -   Multisite header images array atahualpa376 (http://forum.bytesforall.com/showthread.php?t=17430)

Aubergine Apr 27, 2012 12:34 PM

Multisite header images array atahualpa376
 
With WP MultiSite, bfa_m_find_in_dir.php appears to create a header image array that includes every folder and file in blogs.dir/n/files/ for subsites, and in wp-content/uploads/ for the primary site.

This behavior is the same whether header images are placed directly in the files folder, or uploaded via Media Manager (according to the new instructions). It does this with a single header image file as well as multiple image files, rotated or not. (Yes, files that reference /wpmu-settings.php were changed to /wp-includes/ms-settings.php and I also tried using is_multisite(), with same results.)

If rotated with Javascript, the #header background image url will list files that don't fit the pattern, atahualpa_header_x.ext, but the rotated files in ul/list-items may be correct.

If using a single header image, or multiple images not rotated with Javascript, incorrect images with filenames that don't fit the pattern, atahualpa_header_x.ext will be displayed in the rotation. Images on the primary site will always be incorrect.

With a single-site installation, version 3.7.6 works fine. I rolled back from 376 to 367 on multisite, except for a test web with no plugins. If you paste the 376 bfa_m_find_in_dir.php contents into the 367 version on a multisite that's working fine, you can also replicate the problem.

I've been using Atahualpa for several years and this is the first time I've had a serious problem, so I'm optimistic about a fix. :)

jeffvand Sep 18, 2012 03:30 PM

Did you ever find a solution to this one? I am having the same problem after my update to 3.4.2 to my multisite network today. Would love to find a header solution that works for folks on a multisite network! :)

jeffvand Sep 18, 2012 03:36 PM

Here is a post on wordpress.org that explains the problem as well: http://wordpress.org/support/topic/t...ages?replies=2

jeffvand Sep 18, 2012 03:40 PM

Sorry for all the links. Here is one other that might help:

http://alantait.net/2011/01/13/wordp...-multisite-wp/

This was for an earlier version. It was working for me, but now that I upgraded to 3.4.2 it is not working either any more. Wonder if that branch is about done.

ctrl-alt-esc Oct 4, 2012 02:22 PM

I just updated to 3.7.9 and also hit this issue.

I found several problems in the functions/bfa_m_find_inDir.php file. Replace the contents of that file with the following code for the fix:

PHP Code:

<?php
function bfa_m_find_in_dir$root$pattern$recursive true$case_sensitive false ) {
    
$result = array();
    if( 
$case_sensitive ) {
        if( 
false === bfa_m_find_in_dir__$root$pattern$recursive$result )) {
            return 
false;
        }
    } else {
        if( 
false === bfa_m_find_in_dir_i__$root$pattern$recursive$result )) {
            return 
false;
        }
    }
    return 
$result;
}

/**
 * @access private
 */
function bfa_m_find_in_dir__$root$pattern$recursive, &$result ) {
    
$dh = @opendir$root );
    if( 
false === $dh ) {
        return 
false;
    }
    while( 
$file readdir$dh )) {
        if( 
"." == $file || ".." == $file ){
            continue;
        }
//              Note: ereg() is depreciated in php 5.3
//      if( false !== @ereg( $pattern, "{$root}/{$file}" )) {
        
if( == @preg_match'/'.$pattern.'/'"{$root}/{$file})) {
            
$result[] = "{$root}/{$file}";
        }
        if( 
false !== $recursive && is_dir"{$root}/{$file})) {
            
bfa_m_find_in_dir__"{$root}/{$file}"$pattern$recursive$result );
        }
    }
    
closedir$dh );
    return 
true;
}

/**
 * @access private
 */
function bfa_m_find_in_dir_i__$root$pattern$recursive, &$result ) {
    
$dh = @opendir$root );
    if( 
false === $dh ) {
        return 
false;
    }
    while( 
$file readdir$dh )) {
        if( 
"." == $file || ".." == $file ){
            continue;
        }
//              Note: ergi() is depreciated in php 5.3
//      if( false !== @eregi( $pattern, "{$root}/{$file}" )) {
        
if( == @preg_match'/'.$pattern.'/i'"{$root}/{$file})) {
            
$result[] = "{$root}/{$file}";
        }
        if( 
false !== $recursive && is_dir"{$root}/{$file})) {
            
bfa_m_find_in_dir_i__"{$root}/{$file}"$pattern$recursive$result );
        }
    }
    
closedir$dh );
    return 
true;
}
?>



All times are GMT -6. The time now is 08:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.