Skip to:
Content

BuddyPress.org

Changeset 565


Ignore:
Timestamp:
11/21/2008 09:01:26 PM (18 years ago)
Author:
apeatling
Message:

Modified BuddyPress member theme locations.

BuddyPress member themes now sit in /wp-content/member-themes/

Added a site admin option in Site Admin > BuddyPress to select a member theme to activate for all users.

Added a new readme explaining how to turn an existing WordPress theme into a BuddyPress enabled theme.

NOTE: This will effect all existing installations. You must move /wp-content/themes/buddypress-member/ to /wp-content/member-themes/buddypress-member/

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core.php

    r540 r565  
    10921092}
    10931093
     1094function bp_core_get_member_themes() {
     1095        add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
     1096        $themes = get_themes();
     1097
     1098        if ( $themes ) {
     1099                foreach ( $themes as $name => $values ) {
     1100                        $member_themes[] = array(
     1101                                'name' => $name,
     1102                                'template' => $values['Template']
     1103                        );
     1104                }
     1105        }
     1106       
     1107        return $member_themes;
     1108}
     1109
     1110function bp_core_set_member_theme_root() {
     1111        return WP_CONTENT_DIR . "/member-themes";
     1112}
     1113
     1114function bp_core_set_member_theme_root_uri() {
     1115        return WP_CONTENT_URL . '/member-themes';
     1116}
     1117
     1118
    10941119/**
    10951120 * bp_core_email_from_name_filter()
  • trunk/bp-core/bp-core-admin.php

    r526 r565  
    1717        <div class="wrap">
    1818               
    19                 <h2>BuddyPress Settings</h2>
     19                <h2><?php _e( 'BuddyPress Settings', 'buddypress' ) ?></h2>
    2020       
    2121                <form action="<?php $_SERVER['PHPSELF'] ?>" method="post" id="bp-admin-form">
    … …  
    3939                                </tr>
    4040                                <?php } ?>
     41                                <tr>
     42                                        <th scope="row"><?php _e('Select theme to use for member pages', 'buddypress') ?>:</th>
     43                                        <td>
     44                                                <select name="bp-admin[active-member-theme]" id="active-member-theme">
     45                                                        <?php $themes = bp_core_get_member_themes() ?>
     46                                                        <?php
     47                                                                if ( $themes ) {
     48                                                                        for ( $i = 0; $i < count($themes); $i++ ) {
     49                                                                                if ( $themes[$i]['template'] == get_site_option( 'active-member-theme' ) ) {
     50                                                                                        $selected = ' selected="selected"';
     51                                                                                } else {
     52                                                                                        $selected = '';
     53                                                                                }
     54                                                        ?>
     55                                                                                <option<?php echo $selected ?> value="<?php echo $themes[$i]['template'] ?>"><?php echo $themes[$i]['name'] ?></option>
     56                                                        <?php   
     57                                                                        }
     58                                                                }
     59                                                        ?>
     60
     61                                                </select>
     62                                        </td>                   
     63                                </tr>
    4164                        </tbody>
    4265                        </table>
  • trunk/bp-core/bp-core-catchuri.php

    r556 r565  
    233233        global $is_member_page;
    234234       
     235        $member_theme = get_site_option('active-member-theme');
     236       
     237        if ( $member_theme == '' )
     238                $member_theme = 'buddypress-member';
     239       
    235240        // The theme filter does not recognize any globals, where as the stylesheet filter does.
    236241        // We have to set up the globals to use manually.
    … …  
    243248                $is_single_group = BP_Groups_Group::group_exists( $current_action, $groups_bp['groups']['table_name'] );
    244249       
    245         if ( $is_member_page )
    246                 $theme = 'buddypress-member';
    247         else if ( $current_component == $groups_bp['groups']['slug'] && $is_single_group )
    248                 $theme = 'buddypress-member';
    249         else
    250                 $theme = get_option('template');
     250        if ( $is_member_page || ( $current_component == $groups_bp['groups']['slug'] && $is_single_group ) ) {
     251                add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
     252                add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
     253
     254                return $member_theme;
     255        } else {
     256                return get_option('template');
     257        }
    251258       
    252259        return $theme;
    … …  
    256263function bp_core_force_buddypress_stylesheet() {
    257264        global $bp, $is_single_group, $is_member_page;
    258        
    259         if ( $is_member_page )
    260                 return 'buddypress-member';
    261         else if ( $bp['current_component'] == $bp['groups']['slug'] && $is_single_group )       
    262                 return 'buddypress-member';
    263         else
     265
     266        $member_theme = get_site_option('active-member-theme');
     267       
     268        if ( $member_theme == '' )
     269                $member_theme = 'buddypress-member';
     270       
     271        if ( $is_member_page || ( $bp['current_component'] == $bp['groups']['slug'] && $is_single_group ) ) {
     272                add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
     273                add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
     274               
     275                return $member_theme;
     276        } else {
    264277                return get_option('stylesheet');       
     278        }
    265279}
    266280add_filter( 'stylesheet', 'bp_core_force_buddypress_stylesheet' );
  • trunk/bp-messages/bp-messages-notifications.php

    r462 r565  
    1818                // Set up and send the message
    1919                $to = $ud->user_email;
    20                 $subject = sprintf( __( 'New message from %s', 'buddypress' ), $sender_name );
     20                $subject = sprintf( __( 'New message from %s', 'buddypress' ), stripslashes($sender_name) );
    2121
    2222                $message = sprintf( __(
  • trunk/bp-xprofile/bp-xprofile-notifications.php

    r482 r565  
    3535                        // Set up and send the message
    3636                        $to = $ud->user_email;
    37                         $subject = sprintf( __( '%s posted on your wire.', 'buddypress' ), $poster_name );
     37                        $subject = sprintf( __( '%s posted on your wire.', 'buddypress' ), stripslashes($poster_name) );
    3838
    3939$message = sprintf( __(
Note: See TracChangeset for help on using the changeset viewer.