Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/13/2010 01:08:31 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Committing patch from #2566 for easier review and testing. Adds BP_Button class and associated template tags. Also includes code formatting fixes, phpdoc, widget fixes when friends component is disabled, and possibly the kitchen sink.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-core/bp-core-templatetags.php

    r3245 r3260  
    416416
    417417        return apply_filters( 'bp_member_last_active', $registered );
    418     }
    419 
    420 function bp_member_add_friend_button() {
    421     global $members_template;
    422 
    423     if ( function_exists( 'bp_add_friend_button' ) ) {
    424         if ( null === $members_template->member->is_friend )
    425             $friend_status = 'not_friends';
    426         else
    427             $friend_status = ( 0 == $members_template->member->is_friend ) ? 'pending' : 'is_friend';
    428 
    429         echo bp_add_friend_button( $members_template->member->id, $friend_status );
    430     }
    431 }
    432 
    433 function bp_member_total_friend_count() {
    434     global $members_template;
    435 
    436     echo bp_get_member_total_friend_count();
    437 }
    438     function bp_get_member_total_friend_count() {
    439         global $members_template;
    440 
    441         if ( 1 == (int) $members_template->member->total_friend_count )
    442             return apply_filters( 'bp_get_member_total_friend_count', sprintf( __( '%d friend', 'buddypress' ), (int) $members_template->member->total_friend_count ) );
    443         else
    444             return apply_filters( 'bp_get_member_total_friend_count', sprintf( __( '%d friends', 'buddypress' ), (int) $members_template->member->total_friend_count ) );
    445418    }
    446419
     
    11001073
    11011074/**
     1075 * bp_button( $button )
     1076 *
     1077 * Creates and outputs a button.
     1078 * Args: div_id | div_class | a_href | a_title | a_id | a_class | a_rel | a_text
     1079 *
     1080 * @param array $button
     1081 */
     1082function bp_button( $button = '' ) {
     1083    echo bp_get_button( $button );
     1084}
     1085    /**
     1086     * bp_get_button( $button )
     1087     *
     1088     * Creates and returns a button.
     1089     * Args: div_id | div_class | a_href | a_title | a_id | a_class | a_rel | a_text
     1090     *
     1091     * @param array $button
     1092     * @return string
     1093     */
     1094    function bp_get_button( $button = '' ) {
     1095        $btn = new BP_Button( $button );
     1096        return apply_filters( 'bp_get_button', $btn->contents, $button );
     1097    }
     1098
     1099/**
    11021100 * bp_create_excerpt()
    11031101 *
Note: See TracChangeset for help on using the changeset viewer.