Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/13/2009 01:24:21 AM (17 years ago)
Author:
apeatling
Message:

Add first revision of new default BuddyPress parent theme. This theme is designed to be extended from with child themes, not used directly. The original default themes from the old two theme system are deprecated, but will remain compatible with 1.1. Still more work to do there.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-templatetags.php

    r1648 r1655  
    8181                        $link = str_replace( $bp->loggedin_user->domain, $bp->displayed_user->domain, $user_nav_item['link'] );
    8282                else
    83                         $link = $user_nav_item['link'];
     83                        $link = $bp->displayed_user->domain . $user_nav_item['link'];
    8484               
    8585                echo '<li' . $selected . '><a id="user-' . $user_nav_item['css_id'] . '" href="' . $link . '">' . $user_nav_item['name'] . '</a></li>';
    … …  
    212212                extract( $r, EXTR_SKIP );
    213213               
    214                 return apply_filters( 'bp_get_loggedin_user_avatar', bp_core_fetch_avatar( array( 'user_id' => $bp->loggedin_user->id, 'type' => $type, 'width' => $width, 'height' => $height ) ) );
     214                return apply_filters( 'bp_get_loggedin_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->loggedin_user->id, 'type' => $type, 'width' => $width, 'height' => $height ) ) );
    215215        }
    216216
    … …  
    230230                extract( $r, EXTR_SKIP );
    231231               
    232                 return apply_filters( 'bp_get_displayed_user_avatar', bp_core_fetch_avatar( array( 'user_id' => $bp->displayed_user->id, 'type' => $type, 'width' => $width, 'height' => $height ) ) );
     232                return apply_filters( 'bp_get_displayed_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => $type, 'width' => $width, 'height' => $height ) ) );
    233233        }
    234234
    … …  
    267267
    268268function bp_site_name() {
    269         echo apply_filters( 'bp_site_name', get_blog_option( 1, 'blogname' ) );
     269        echo apply_filters( 'bp_site_name', get_blog_option( BP_ROOT_BLOG, 'blogname' ) );
    270270}
    271271
    … …  
    317317?>
    318318
    319 <div class="info-group wp-profile">
     319<div class="bp-widget wp-profile">
    320320        <h4><?php _e( 'My Profile' ) ?></h4>
    321321
    … …  
    533533        if ( file_exists( WP_CONTENT_DIR . '/themes/' . get_blog_option( BP_ROOT_BLOG, 'template') . '/register.php') )
    534534                return true;
    535        
     535
     536        if ( file_exists( WP_CONTENT_DIR . '/themes/' . get_blog_option( BP_ROOT_BLOG, 'template') . '/registration/register.php') )
     537                return true;
     538               
    536539        return false;
    537540}
    538541
    539 function bp_signup_page( $echo = true ) {
    540         global $bp;
    541        
    542         if ( bp_has_custom_signup_page() ) {
    543                 if ( $echo )
    544                         echo $bp->root_domain . '/' . BP_REGISTER_SLUG;
    545                 else
    546                         return $bp->root_domain . '/' . BP_REGISTER_SLUG;
    547         } else {
    548                 if ( $echo )
    549                         echo $bp->root_domain . '/wp-signup.php';
    550                 else
    551                         return $bp->root_domain . '/wp-signup.php';
    552         }
    553 }
     542function bp_signup_page( $deprecated = true ) {
     543        if ( !$deprecated )
     544                return bp_get_signup_page();
     545        else
     546                echo bp_get_signup_page();
     547}
     548        function bp_get_signup_page() {
     549                global $bp;
     550               
     551                if ( bp_has_custom_signup_page() ) {
     552                                return apply_filters( 'bp_get_signup_page', $bp->root_domain . '/' . BP_REGISTER_SLUG );
     553                } else {
     554                                return apply_filters( 'bp_get_signup_page', $bp->root_domain . '/wp-signup.php' );
     555                }
     556        }
    554557
    555558function bp_has_custom_activation_page() {
    556         if ( file_exists( WP_CONTENT_DIR . '/themes/' . get_blog_option( 1, 'template') . '/activate.php') )
     559        if ( file_exists( WP_CONTENT_DIR . '/themes/' . get_blog_option( BP_ROOT_BLOG, 'template') . '/activate.php') )
     560                return true;
     561
     562        if ( file_exists( WP_CONTENT_DIR . '/themes/' . get_blog_option( BP_ROOT_BLOG, 'template') . '/registration/activate.php') )
    557563                return true;
    558564       
    … …  
    617623}
    618624
    619 function bp_login_bar() {
    620         global $bp;
    621        
    622         if ( !is_user_logged_in() ) : ?>
    623                
    624                 <form name="login-form" id="login-form" action="<?php echo $bp->root_domain . '/wp-login.php' ?>" method="post">
    625                         <input type="text" name="log" id="user_login" value="<?php _e( 'Username', 'buddypress' ) ?>" onfocus="if (this.value == '<?php _e( 'Username', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Username', 'buddypress' ) ?>';}" />
    626                         <input type="password" name="pwd" id="user_pass" class="input" value="" />
    627                        
    628                         <input type="checkbox" name="rememberme" id="rememberme" value="forever" title="<?php _e( 'Remember Me', 'buddypress' ) ?>" />
    629                        
    630                         <input type="submit" name="wp-submit" id="wp-submit" value="<?php _e( 'Log In', 'buddypress' ) ?>"/>                           
    631                         <input type="button" name="signup-submit" id="signup-submit" value="<?php _e( 'Sign Up', 'buddypress' ) ?>" onclick="location.href='<?php echo bp_signup_page() ?>'" />
    632 
    633                         <input type="hidden" name="redirect_to" value="http://<?php echo $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] ?>" />
    634                         <input type="hidden" name="testcookie" value="1" />
    635                                                
    636                         <?php do_action( 'bp_login_bar_logged_out' ) ?>
    637                 </form>
    638        
    639         <?php else : ?>
    640                
    641                 <div id="logout-link">
    642                         <?php bp_loggedinuser_avatar_thumbnail( 20, 20 ) ?> &nbsp;
    643                         <?php bp_loggedinuser_link() ?>
    644                         <?php
    645                                 if ( function_exists('wp_logout_url') ) {
    646                                         $logout_link = '/ <a href="' . wp_logout_url( $bp->root_domain ) . '">' . __( 'Log Out', 'buddypress' ) . '</a>';
    647                                 } else {
    648                                         $logout_link = '/ <a href="' . $bp->root_domain . '/wp-login.php?action=logout&amp;redirect_to=' . $bp->root_domain . '">' . __( 'Log Out', 'buddypress' ) . '</a>';                                   
    649                                 }                       
    650                                
    651                                 echo apply_filters( 'bp_logout_link', $logout_link );
    652                         ?>
    653                        
    654                         <?php do_action( 'bp_login_bar_logged_in' ) ?>
    655                 </div>
    656                
    657         <?php endif;
     625function bp_log_out_link() {
     626        global $bp;
     627        if ( function_exists('wp_logout_url') )
     628                $logout_link = '<a href="' . wp_logout_url( $bp->root_domain ) . '">' . __( 'Log Out', 'buddypress' ) . '</a>';
     629        else
     630                $logout_link = '<a href="' . $bp->root_domain . '/wp-login.php?action=logout&amp;redirect_to=' . $bp->root_domain . '">' . __( 'Log Out', 'buddypress' ) . '</a>';             
     631
     632        echo apply_filters( 'bp_logout_link', $logout_link );
    658633}
    659634
    … …  
    868843                }
    869844        }
     845
     846function bp_signup_allowed() {
     847        echo bp_get_signup_allowed();
     848}
     849        function bp_get_signup_allowed() {
     850                return get_site_option( 'registration' );
     851        }
     852
     853function bp_account_was_activated() {
     854        global $bp;
     855       
     856        return $bp->activation_complete;
     857}
    870858
    871859
    … …  
    10521040
    10531041        echo sprintf( __( 'Viewing member %d to %d (of %d members)', 'buddypress' ), $from_num, $to_num, $site_members_template->total_member_count ); ?> &nbsp;
    1054         <img id="ajax-loader-members" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" /><?php
     1042        <span class="ajax-loader"></span><?php
    10551043}
    10561044
    … …  
    12521240}
    12531241
     1242function bp_root_domain() {
     1243        echo bp_get_root_domain();
     1244}
     1245        function bp_get_root_domain() {
     1246                global $bp;
     1247               
     1248                return $bp->root_domain;
     1249        }
     1250
    12541251/* Template is_() functions to determine the current page */
    12551252
    … …  
    13711368}
    13721369
     1370function bp_is_my_groups() {
     1371        global $bp;
     1372       
     1373        if ( BP_GROUPS_SLUG == $bp->current_component && ( !$bp->current_action || 'my-groups' == $bp->current_action ) )
     1374                return true;
     1375       
     1376        return false;           
     1377}
     1378
    13731379function bp_is_group_home() {
    13741380        global $bp;
    … …  
    15521558       
    15531559        return false;
     1560}
     1561
     1562function bp_is_activation_page() {
     1563        global $bp;
     1564       
     1565        if ( BP_ACTIVATION_SLUG == $bp->current_component )
     1566                return true;
     1567       
     1568        return false;   
     1569}
     1570
     1571function bp_is_register_page() {
     1572        global $bp;
     1573       
     1574        if ( BP_REGISTER_SLUG == $bp->current_component )
     1575                return true;
     1576       
     1577        return false;   
    15541578}
    15551579
    … …  
    15621586
    15631587        function bp_get_the_body_class() {
    1564                 if ( bp_is_blog_page() )
     1588                if ( bp_is_blog_page() || bp_is_activation_page() || bp_is_register_page() )
    15651589                        $class[] = 'blog-page';
    1566                 else
    1567                         $class[] = 'social-page';
     1590                       
     1591                if ( !bp_is_blog_page() && !is_home() && !bp_is_register_page() && !bp_is_activation_page() )
     1592                        $class[] = 'internal-page';
     1593               
     1594                if ( bp_is_blog_page() && is_home() )
     1595                        $class[] = 'home-page';
    15681596               
    15691597                if ( bp_is_directory() )
    15701598                        $class[] = 'directory';
    1571                
    1572                 if ( bp_is_activity() )
     1599                       
     1600                if ( bp_is_profile() && !bp_is_blog_page() )
     1601                        $class[] = 'profile';
     1602               
     1603                if ( bp_is_activity() && !bp_is_blog_page()  )
    15731604                        $class[] = 'activity';         
    15741605
    1575                 if ( bp_is_blogs() )
     1606                if ( bp_is_blogs() && !bp_is_blog_page()  )
    15761607                        $class[] = 'blogs';
    15771608
    1578                 if ( bp_is_wire() )
     1609                if ( bp_is_wire() && !bp_is_blog_page()  )
    15791610                        $class[] = 'wire';
    15801611
    1581                 if ( bp_is_messages() )
     1612                if ( bp_is_messages() && !bp_is_blog_page()  )
    15821613                        $class[] = 'messages';                                 
    15831614               
    1584                 if ( bp_is_friends() )
     1615                if ( bp_is_friends() && !bp_is_blog_page()  )
    15851616                        $class[] = 'friends';
    15861617                       
    1587                 if ( bp_is_groups() )
     1618                if ( bp_is_groups() && !bp_is_blog_page()  )
    15881619                        $class[] = 'groups';
    15891620
    1590                 if ( bp_is_settings() )
     1621                if ( bp_is_settings() && !bp_is_blog_page()  )
    15911622                        $class[] = 'settings';
    15921623                       
    … …  
    16121643                        $class[] = 'recent-posts';
    16131644                       
    1614                 if ( bp_is_my_blogs() )
     1645                if ( bp_is_my_blogs() && !bp_is_directory() )
    16151646                        $class[] = 'my-blogs';
     1647                       
     1648                if ( bp_is_my_groups() && !bp_is_directory() )
     1649                        $class[] = 'my-groups';
    16161650                       
    16171651                if ( bp_is_group_leave() )
    … …  
    16481682                        $class[] = 'change-avatar';
    16491683                       
    1650                 if ( bp_is_profile() )
    1651                         $class[] = 'profile';
    1652                        
    16531684                if ( bp_is_profile_edit() )
    16541685                        $class[] = 'profile-edit';
    … …  
    16591690                if ( bp_is_my_activity() )
    16601691                        $class[] = 'my-activity';
     1692               
     1693                if ( bp_is_register_page() )
     1694                        $class[] = 'registration';
     1695               
     1696                if ( bp_is_activation_page() )
     1697                        $class[] = 'activation';
    16611698                       
    16621699                if ( is_single() )
Note: See TracChangeset for help on using the changeset viewer.