Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/04/2011 02:07:08 PM (13 years ago)
Author:
johnjamesjacoby
Message:

Introduce _has_directory() functions for forums, groups, members, and activity components. This replaces the need for enabling/disabling the forum directory, since if it is not set it does not exist.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-xprofile/bp-xprofile-buddybar.php

    r4482 r4596  
    11<?php
    22
    3 /**
    4  * Creates the administration interface menus and checks to see if the DB
    5  * tables are set up.
    6  *
    7  * @package BuddyPress XProfile
    8  * @global object $bp Global BuddyPress settings object
    9  * @global $wpdb WordPress DB access object.
    10  * @uses is_super_admin() returns true if the current user is a site admin, false if not
    11  * @uses bp_xprofile_install() runs the installation of DB tables for the xprofile component
    12  * @uses wp_enqueue_script() Adds a JS file to the JS queue ready for output
    13  * @uses add_submenu_page() Adds a submenu tab to a top level tab in the admin area
    14  * @uses xprofile_install() Runs the DB table installation function
    15  * @return
    16  */
    17 function xprofile_add_admin_menu() {
    18     global $wpdb, $bp;
    19 
    20     if ( !is_super_admin() )
    21         return false;
    22 
    23     // Add the administration tab under the "Site Admin" tab for site administrators
    24     $hook = add_submenu_page( 'bp-general-settings', __( 'Profile Fields', 'buddypress' ), __( 'Profile Fields', 'buddypress' ), 'manage_options', 'bp-profile-setup', 'xprofile_admin' );
    25     add_action( "admin_print_styles-$hook", 'bp_core_add_admin_menu_styles' );
    26 }
    27 add_action( bp_core_admin_hook(), 'xprofile_add_admin_menu' );
    28 
    29 /**
    30  * Adds an admin bar menu to any profile page providing site admin options
    31  * for that user.
    32  *
    33  * @package BuddyPress XProfile
    34  * @global $bp BuddyPress
    35  */
    36 function xprofile_setup_adminbar_menu() {
    37     global $bp;
    38 
    39     if ( !$bp->displayed_user->id )
    40         return false;
    41 
    42     // Don't show this menu to non site admins or if you're viewing your own profile
    43     if ( !is_super_admin() || bp_is_my_profile() )
    44         return false; ?>
    45 
    46     <li id="bp-adminbar-adminoptions-menu">
    47         <a href=""><?php _e( 'Admin Options', 'buddypress' ) ?></a>
    48 
    49         <ul>
    50             <li><a href="<?php echo $bp->displayed_user->domain . $bp->profile->slug; ?>/edit/"><?php printf( __( "Edit %s's Profile", 'buddypress' ), esc_attr( $bp->displayed_user->fullname ) ) ?></a></li>
    51             <li><a href="<?php echo $bp->displayed_user->domain . $bp->profile->slug; ?>/change-avatar/"><?php printf( __( "Edit %s's Avatar", 'buddypress' ), esc_attr( $bp->displayed_user->fullname ) ) ?></a></li>
    52 
    53             <?php if ( bp_is_active( 'settings' ) ) : ?>
    54 
    55                 <li><a href="<?php echo $bp->displayed_user->domain . $bp->settings->slug; ?>/general/"><?php printf( __( "Edit %s's Settings", 'buddypress' ), esc_attr( $bp->displayed_user->fullname ) ) ?></a></li>
    56 
    57             <?php endif; ?>
    58 
    59             <?php if ( !bp_core_is_user_spammer( $bp->displayed_user->id ) ) : ?>
    60 
    61                 <li><a href="<?php echo wp_nonce_url( $bp->displayed_user->domain . 'admin/mark-spammer/', 'mark-unmark-spammer' ) ?>" class="confirm"><?php _e( "Mark as Spammer", 'buddypress' ) ?></a></li>
    62 
    63             <?php else : ?>
    64 
    65                 <li><a href="<?php echo wp_nonce_url( $bp->displayed_user->domain . 'admin/unmark-spammer/', 'mark-unmark-spammer' ) ?>" class="confirm"><?php _e( "Not a Spammer", 'buddypress' ) ?></a></li>
    66 
    67             <?php endif; ?>
    68 
    69             <li><a href="<?php echo wp_nonce_url( $bp->displayed_user->domain . 'admin/delete-user/', 'delete-user' ) ?>" class="confirm"><?php printf( __( "Delete %s", 'buddypress' ), esc_attr( $bp->displayed_user->fullname ) ) ?></a></li>
    70 
    71             <?php do_action( 'xprofile_adminbar_menu_items' ) ?>
    72 
    73         </ul>
    74     </li>
    75 
    76     <?php
    77 }
    78 //add_action( 'bp_adminbar_menus', 'xprofile_setup_adminbar_menu', 20 );
     3// Nothing to see here
    794
    805?>
Note: See TracChangeset for help on using the changeset viewer.