Changeset 3955 for trunk/bp-groups/bp-groups-template.php
- Timestamp:
- 01/27/2011 09:15:35 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-template.php
r3929 r3955 797 797 global $groups_template; 798 798 799 if ( !$group)799 if ( empty( $group ) ) 800 800 $group =& $groups_template->group; 801 801 802 $admins = groups_get_group_admins( $group->id ); 803 ?> 804 <?php if ( $admins ) { ?> 805 <ul id="admins-list" class="item-list<?php if ( $admin_list ) { ?> single-line<?php } ?>"> 802 803 if ( $admins = groups_get_group_admins( $group->id ) ) : ?> 804 805 <ul id="admins-list" class="item-list<?php if ( !empty( $admin_list ) ) : ?> single-line<?php endif; ?>"> 806 806 807 <?php foreach ( (array)$admins as $admin ) { ?> 807 <?php if ( $admin_list ) { ?> 808 809 <?php if ( !empty( $admin_list ) ) : ?> 810 808 811 <li> 812 809 813 <?php echo bp_core_fetch_avatar( array( 'item_id' => $admin->user_id, 'type' => 'thumb', 'width' => 30, 'height' => 30, 'alt' => __( 'Profile picture of %s', 'buddypress' ) ) ) ?> 810 <h5><?php echo bp_core_get_userlink( $admin->user_id ) ?> <span class="small"> — <a class="confirm admin-demote-to-member" href="<?php bp_group_member_demote_link($admin->user_id) ?>"><?php _e( 'Demote to Member', 'buddypress' ) ?></a></span></h5> 814 815 <h5> 816 817 <?php echo bp_core_get_userlink( $admin->user_id ); ?> 818 819 <span class="small"> 820 <a class="button confirm admin-demote-to-member" href="<?php bp_group_member_demote_link($admin->user_id) ?>"><?php _e( 'Demote to Member', 'buddypress' ) ?></a> 821 </span> 822 </h5> 811 823 </li> 812 <?php } else { ?> 824 825 <?php else : ?> 826 813 827 <li> 828 814 829 <?php echo bp_core_fetch_avatar( array( 'item_id' => $admin->user_id, 'type' => 'thumb', 'alt' => __( 'Profile picture of %s', 'buddypress' ) ) ) ?> 830 815 831 <h5><?php echo bp_core_get_userlink( $admin->user_id ) ?></h5> 816 <span class="activity"><?php echo bp_core_get_last_activity( strtotime( $admin->date_modified ), __( 'joined %s ago', 'buddypress') ); ?></span> 832 <span class="activity"> 833 <?php echo bp_core_get_last_activity( strtotime( $admin->date_modified ), __( 'joined %s ago', 'buddypress') ); ?> 834 </span> 817 835 818 836 <?php if ( bp_is_active( 'friends' ) ) : ?> 837 819 838 <div class="action"> 820 <?php bp_add_friend_button( $admin->user_id ) ?> 839 840 <?php bp_add_friend_button( $admin->user_id ); ?> 841 821 842 </div> 843 822 844 <?php endif; ?> 845 823 846 </li> 824 <?php } ?> 825 <?php } ?> 847 848 <?php endif; 849 } ?> 850 826 851 </ul> 827 <?php } else { ?> 852 853 <?php else : ?> 854 828 855 <div id="message" class="info"> 829 856 <p><?php _e( 'This group has no administrators', 'buddypress' ); ?></p> 830 857 </div> 831 <?php } 858 859 <?php endif; 832 860 } 833 861 … … 835 863 global $groups_template, $group_mods; 836 864 837 if ( !$group)865 if ( empty( $group ) ) 838 866 $group =& $groups_template->group; 839 867 840 $group_mods = groups_get_group_mods( $group->id ); 841 ?> 842 <?php if ( $group_mods ) { ?> 843 <ul id="mods-list" class="item-list<?php if ( $admin_list ) { ?> single-line<?php } ?>"> 844 <?php foreach ( (array)$group_mods as $mod ) { ?> 845 <?php if ( $admin_list ) { ?> 846 <li> 847 <?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'type' => 'thumb', 'width' => 30, 'height' => 30, 'alt' => __( 'Profile picture of %s', 'buddypress' ) ) ) ?> 848 <h5><?php echo bp_core_get_userlink( $mod->user_id ) ?> <span class="small"> — <a href="<?php bp_group_member_promote_admin_link( array( 'user_id' => $mod->user_id ) ) ?>" class="confirm mod-promote-to-admin" title="<?php _e( 'Promote to Admin', 'buddypress' ); ?>"><?php _e( 'Promote to Admin', 'buddypress' ); ?></a> | <a class="confirm mod-demote-to-member" href="<?php bp_group_member_demote_link($mod->user_id) ?>"><?php _e( 'Demote to Member', 'buddypress' ) ?></a></span></h5> 849 </li> 850 <?php } else { ?> 851 <li> 852 <?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'type' => 'thumb', 'alt' => __( 'Profile picture of %s', 'buddypress' ) ) ) ?> 853 <h5><?php echo bp_core_get_userlink( $mod->user_id ) ?></h5> 854 <span class="activity"><?php echo bp_core_get_last_activity( strtotime( $mod->date_modified ), __( 'joined %s ago', 'buddypress') ); ?></span> 855 856 <?php if ( bp_is_active( 'friends' ) ) : ?> 857 <div class="action"> 858 <?php bp_add_friend_button( $mod->user_id ) ?> 859 </div> 860 <?php endif; ?> 861 </li> 862 <?php } ?> 868 if ( $group_mods = groups_get_group_mods( $group->id ) ) { ?> 869 870 <ul id="mods-list" class="item-list<?php if ( $admin_list ) { ?> single-line<?php } ?>"> 871 872 <?php foreach ( (array)$group_mods as $mod ) { ?> 873 874 <?php if ( !empty( $admin_list ) ) { ?> 875 876 <li> 877 878 <?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'type' => 'thumb', 'width' => 30, 'height' => 30, 'alt' => __( 'Profile picture of %s', 'buddypress' ) ) ) ?> 879 880 <h5> 881 <?php echo bp_core_get_userlink( $mod->user_id ); ?> 882 883 <span class="small"> 884 <a href="<?php bp_group_member_promote_admin_link( array( 'user_id' => $mod->user_id ) ) ?>" class="button confirm mod-promote-to-admin" title="<?php _e( 'Promote to Admin', 'buddypress' ); ?>"><?php _e( 'Promote to Admin', 'buddypress' ); ?></a> 885 <a class="button confirm mod-demote-to-member" href="<?php bp_group_member_demote_link($mod->user_id) ?>"><?php _e( 'Demote to Member', 'buddypress' ) ?></a> 886 </span> 887 </h5> 888 </li> 889 890 <?php } else { ?> 891 892 <li> 893 894 <?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'type' => 'thumb', 'alt' => __( 'Profile picture of %s', 'buddypress' ) ) ) ?> 895 896 <h5><?php echo bp_core_get_userlink( $mod->user_id ) ?></h5> 897 898 <span class="activity"><?php echo bp_core_get_last_activity( strtotime( $mod->date_modified ), __( 'joined %s ago', 'buddypress') ); ?></span> 899 900 <?php if ( bp_is_active( 'friends' ) ) : ?> 901 902 <div class="action"> 903 <?php bp_add_friend_button( $mod->user_id ) ?> 904 </div> 905 906 <?php endif; ?> 907 908 </li> 909 863 910 <?php } ?> 864 </ul> 865 <?php } else { ?> 866 <div id="message" class="info"> 867 <p><?php _e( 'This group has no moderators', 'buddypress' ); ?></p> 868 </div> 869 <?php } 911 <?php } ?> 912 913 </ul> 914 915 <?php } else { ?> 916 917 <div id="message" class="info"> 918 <p><?php _e( 'This group has no moderators', 'buddypress' ); ?></p> 919 </div> 920 921 <?php } 870 922 } 871 923 … … 2427 2479 return apply_filters( 'bp_get_current_group_name', $name ); 2428 2480 } 2481 2482 function bp_groups_action_link( $action = '', $query_args = '', $nonce = false ) { 2483 echo bp_get_groups_action_link( $action, $query_args, $nonce ); 2484 } 2485 function bp_get_groups_action_link( $action = '', $query_args = '', $nonce = false ) { 2486 global $bp; 2487 2488 // Must be displayed user 2489 if ( empty( $bp->groups->current_group->id ) ) 2490 return; 2491 2492 // Append $action to $url if there is no $type 2493 if ( !empty( $action ) ) 2494 $url = $bp->root_domain . '/' . $bp->groups->root_slug . '/' . $bp->groups->current_group->slug . '/' . $action; 2495 else 2496 $url = $bp->root_domain . '/' . $bp->groups->root_slug . '/' . $bp->groups->current_group->slug; 2497 2498 // Add a slash at the end of our user url 2499 $url = trailingslashit( $url ); 2500 2501 // Add possible query arg 2502 if ( !empty( $query_args ) && is_array( $query_args ) ) 2503 $url = add_query_arg( $query_args, $url ); 2504 2505 // To nonce, or not to nonce... 2506 if ( true === $nonce ) 2507 $url = wp_nonce_url( $url ); 2508 elseif ( is_string( $nonce ) ) 2509 $url = wp_nonce_url( $url, $nonce ); 2510 2511 // Return the url, if there is one 2512 if ( !empty( $url ) ) 2513 return $url; 2514 } 2429 2515 ?>
Note: See TracChangeset
for help on using the changeset viewer.