Skip to:
Content

BuddyPress.org

Ticket #480: fix-members-css.diff

File fix-members-css.diff, 2.3 KB (added by simonwheatley, 16 years ago)

Patch to allow members theme to accurately determine the location of wp-load.php, even if it's not in the docroot

  • Users/simon/Projects/MegaPress/site/wp-content/member-themes/buddypress-member/style.css

     
    88BuddyPress Enabled: true
    99*/
    1010
    11 @import url(css/loader.php);
    12  No newline at end of file
     11/* This file is unused */
     12 No newline at end of file
  • Users/simon/Projects/MegaPress/site/wp-content/member-themes/buddypress-member/css/loader.php

     
    11<?php
    22
    33/* Load the WP environment */
    4 require_once( preg_replace('%(.*)[/\\\\]wp-content[/\\\\].*%', '\1', $_SERVER['SCRIPT_FILENAME'] ) . '/wp-load.php' );
     4$abspath = @ $_GET[ 'abspath' ];
     5if ( $abspath ) {
     6        require_once( $abspath . '/wp-load.php' );
     7} else {
     8        require_once( preg_replace('%(.*)[/\\\\]wp-content[/\\\\].*%', '\1', $_SERVER['SCRIPT_FILENAME'] ) . '/wp-load.php' );
     9}
    510
    611/* Set the content type to CSS */
    712header('Content-type: text/css');
  • Users/simon/Projects/MegaPress/site/wp-content/member-themes/buddypress-member/functions.php

     
    3232/* Hook for custom theme functions via plugins */
    3333do_action( 'bp_member_theme_functions' );
    3434
     35
     36function fix_member_theme_css( $output, $show )
     37{
     38        if ( $show != 'stylesheet_url' ) return $output;
     39        $output = get_template_directory_uri() . '/css/loader.php';
     40        $params = array( 'abspath' => ABSPATH );
     41        $output = add_query_arg( $params, $output );
     42        return $output;
     43}
     44add_filter( 'bloginfo_url', 'fix_member_theme_css', null, 2 );
     45
    3546?>
     47 No newline at end of file