Changeset 4845
- Timestamp:
- 07/25/2011 12:11:32 AM (14 years ago)
- Location:
- trunk/bp-friends
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-friends/bp-friends-actions.php
r4822 r4845 10 10 11 11 function friends_action_add_friend() { 12 global $bp;13 14 12 if ( !bp_is_friends_component() || !bp_is_current_action( 'add-friend' ) ) 15 13 return false; 16 14 17 $potential_friend_id = $bp->action_variables[0]; 18 19 if ( !is_numeric( $potential_friend_id ) || !isset( $potential_friend_id ) ) 15 if ( !$potential_friend_id = (int)bp_action_variable( 0 ) ) 20 16 return false; 21 17 22 if ( $potential_friend_id == $bp->loggedin_user->id)18 if ( $potential_friend_id == bp_loggedin_user_id() ) 23 19 return false; 24 20 25 $friendship_status = BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $potential_friend_id );21 $friendship_status = BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), $potential_friend_id ); 26 22 27 23 if ( 'not_friends' == $friendship_status ) { … … 30 26 return false; 31 27 32 if ( !friends_add_friend( $bp->loggedin_user->id, $potential_friend_id ) ) {28 if ( !friends_add_friend( bp_loggedin_user_id(), $potential_friend_id ) ) { 33 29 bp_core_add_message( __( 'Friendship could not be requested.', 'buddypress' ), 'error' ); 34 30 } else { … … 49 45 50 46 function friends_action_remove_friend() { 51 global $bp;52 53 47 if ( !bp_is_friends_component() || !bp_is_current_action( 'remove-friend' ) ) 54 48 return false; 55 49 56 $potential_friend_id = $bp->action_variables[0]; 57 58 if ( !is_numeric( $potential_friend_id ) || !isset( $potential_friend_id ) ) 50 if ( !$potential_friend_id = (int)bp_action_variable( 0 ) ) 59 51 return false; 60 52 61 if ( $potential_friend_id == $bp->loggedin_user->id)53 if ( $potential_friend_id == bp_loggedin_user_id() ) 62 54 return false; 63 55 64 $friendship_status = BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $potential_friend_id );56 $friendship_status = BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), $potential_friend_id ); 65 57 66 58 if ( 'is_friend' == $friendship_status ) { … … 69 61 return false; 70 62 71 if ( !friends_remove_friend( $bp->loggedin_user->id, $potential_friend_id ) ) {63 if ( !friends_remove_friend( bp_loggedin_user_id(), $potential_friend_id ) ) { 72 64 bp_core_add_message( __( 'Friendship could not be canceled.', 'buddypress' ), 'error' ); 73 65 } else { -
trunk/bp-friends/bp-friends-screens.php
r4822 r4845 21 21 22 22 function friends_screen_requests() { 23 global $bp; 24 25 if ( isset( $bp->action_variables[0] ) && isset( $bp->action_variables[1] ) && 'accept' == $bp->action_variables[0] && is_numeric( $bp->action_variables[1] ) ) { 23 if ( bp_is_action_variable( 'accept', 0 ) && is_numeric( bp_action_variable( 1 ) ) ) { 26 24 // Check the nonce 27 25 check_admin_referer( 'friends_accept_friendship' ); 28 26 29 if ( friends_accept_friendship( $bp->action_variables[1]) )27 if ( friends_accept_friendship( bp_action_variable( 1 ) ) ) 30 28 bp_core_add_message( __( 'Friendship accepted', 'buddypress' ) ); 31 29 else 32 30 bp_core_add_message( __( 'Friendship could not be accepted', 'buddypress' ), 'error' ); 33 31 34 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action);32 bp_core_redirect( bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action() ); 35 33 36 } elseif ( isset( $bp->action_variables[0] ) && isset( $bp->action_variables[1] ) && 'reject' == $bp->action_variables[0] && is_numeric( $bp->action_variables[1]) ) {34 } elseif ( bp_is_action_variable( 'reject', 0 ) && is_numeric( bp_action_variable( 1 ) ) ) { 37 35 // Check the nonce 38 36 check_admin_referer( 'friends_reject_friendship' ); 39 37 40 if ( friends_reject_friendship( $bp->action_variables[1]) )38 if ( friends_reject_friendship( bp_action_variable( 1 ) ) ) 41 39 bp_core_add_message( __( 'Friendship rejected', 'buddypress' ) ); 42 40 else 43 41 bp_core_add_message( __( 'Friendship could not be rejected', 'buddypress' ), 'error' ); 44 42 45 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action);43 bp_core_redirect( bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action() ); 46 44 } 47 45 … … 49 47 50 48 if ( isset( $_GET['new'] ) ) 51 bp_core_delete_notifications_by_type( $bp->loggedin_user->id, $bp->friends->id, 'friendship_request' );49 bp_core_delete_notifications_by_type( bp_loggedin_user_id(), 'friends', 'friendship_request' ); 52 50 53 51 bp_core_load_template( apply_filters( 'friends_template_requests', 'members/single/home' ) ); -
trunk/bp-friends/bp-friends-template.php
r4822 r4845 51 51 } 52 52 53 /** 54 * Displays Friends header tabs 55 * 56 * @package BuddyPress 57 * @todo Deprecate? 58 */ 53 59 function bp_friends_header_tabs() { 54 60 global $bp; ?> 55 61 56 <li<?php if ( ! isset($bp->action_variables[0]) || 'recently-active' == $bp->action_variables[0]) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_friends_slug() ?>/my-friends/recently-active"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li>57 <li<?php if ( 'newest' == $bp->action_variables[0]) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_friends_slug() ?>/my-friends/newest"><?php _e( 'Newest', 'buddypress' ) ?></a></li>58 <li<?php if ( 'alphabetically' == $bp->action_variables[0]) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_friends_slug() ?>/my-friends/alphabetically"><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li>62 <li<?php if ( !bp_action_variable( 0 ) || bp_is_action_variable( 'recently-active', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_friends_slug() ?>/my-friends/recently-active"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li> 63 <li<?php if ( bp_is_action_variable( 'newest', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_friends_slug() ?>/my-friends/newest"><?php _e( 'Newest', 'buddypress' ) ?></a></li> 64 <li<?php if ( bp_is_action_variable( 'alphabetically', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_friends_slug() ?>/my-friends/alphabetically"><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li> 59 65 60 66 <?php … … 62 68 } 63 69 70 /** 71 * Filters the title for the Friends component 72 * 73 * @package BuddyPress 74 * @todo Deprecate? 75 */ 64 76 function bp_friends_filter_title() { 65 global $bp; 66 67 $current_filter = $bp->action_variables[0]; 68 77 $current_filter = bp_action_variable( 0 ); 78 69 79 switch ( $current_filter ) { 70 80 case 'recently-active': default:
Note: See TracChangeset
for help on using the changeset viewer.