groups->image_base = BP_PLUGIN_URL . '/bp-friends/deprecated/images'; } add_action( 'plugins_loaded', 'friends_deprecated_globals', 5 ); add_action( 'admin_menu', 'friends_deprecated_globals', 2 ); function friends_add_js() { global $bp; /* If we are using a BuddyPress 1.1+ theme ignore this. */ if ( !file_exists( WP_CONTENT_DIR . '/bp-themes' ) ) return $template; if ( $bp->current_component == $bp->friends->slug ) wp_enqueue_script( 'bp-friends-js', BP_PLUGIN_URL . '/bp-friends/deprecated/js/general.js' ); } add_action( 'template_redirect', 'friends_add_js', 1 ); function friends_add_structure_css() { /* If we are using a BuddyPress 1.1+ theme ignore this. */ if ( !file_exists( WP_CONTENT_DIR . '/bp-themes' ) ) return $template; /* Enqueue the structure CSS file to give basic positional formatting for components */ wp_enqueue_style( 'bp-friends-structure', BP_PLUGIN_URL . '/bp-friends/deprecated/css/structure.css' ); } add_action( 'bp_styles', 'friends_add_structure_css' ); function friends_ajax_friends_search() { /* If we are using a BuddyPress 1.1+ theme ignore this. */ if ( !file_exists( WP_CONTENT_DIR . '/bp-themes' ) ) return false; check_ajax_referer( 'friends_search' ); load_template( get_template_directory() . '/friends/friends-loop.php' ); } add_action( 'wp_ajax_friends_search', 'friends_ajax_friends_search' ); function friends_ajax_addremove_friend() { global $bp; /* If we are using a BuddyPress 1.1+ theme ignore this. */ if ( !file_exists( WP_CONTENT_DIR . '/bp-themes' ) ) return false; if ( 'is_friend' == BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) { check_ajax_referer('friends_remove_friend'); if ( !friends_remove_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) { echo __("Friendship could not be canceled.", 'buddypress'); } else { echo '' . __( 'Add Friend', 'buddypress' ) . ''; } } else if ( 'not_friends' == BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) { check_ajax_referer('friends_add_friend'); if ( !friends_add_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) { echo __("Friendship could not be requested.", 'buddypress'); } else { echo '' . __( 'Friendship Requested', 'buddypress' ) . ''; } } else { echo __( 'Request Pending', 'buddypress' ); } return false; } add_action( 'wp_ajax_addremove_friend', 'friends_ajax_addremove_friend' ); ?>