Skip to:
Content

BuddyPress.org

Changeset 28


Ignore:
Timestamp:
04/14/2008 05:55:11 AM (13 years ago)
Author:
apeatling
Message:

Added member profile settings tab for members. Moved admin profile settings tab under Site Admin tab.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp_xprofile.php

    r19 r28  
    8585function xprofile_add_menu()
    8686{
    87     global $wpdb, $bp_xprofile_table_name, $bp_xprofile, $groups;
    88 
    89     add_menu_page(__("Profile"), __("Profile"), 1, basename(__FILE__), "xprofile_picture");
    90     add_submenu_page(basename(__FILE__), __("Picture"), __("Picture"), 1, basename(__FILE__), "xprofile_picture");     
    91    
    92     $groups = BP_XProfile_Group::get_all();
    93 
    94     for($i=0; $i<count($groups); $i++) {
    95         if($groups[$i]->fields) {
    96             add_submenu_page(basename(__FILE__), $groups[$i]->name, $groups[$i]->name, 1, "xprofile_" . $groups[$i]->name, "xprofile_edit");       
    97         }
    98     }
    99    
    100     /* Add the administration tab under the "Site Admin" tab for site administrators */
    101     add_submenu_page('bp_core.php', __("Profiles"), __("Profiles"), 1, "xprofile_settings", "xprofile_admin");
    102 
     87    global $wpdb, $bp_xprofile_table_name, $bp_xprofile, $groups, $userdata;
     88   
     89    if($wpdb->blogid == $userdata->primary_blog)
     90    {
     91        add_menu_page(__("Profile"), __("Profile"), 1, basename(__FILE__), "xprofile_picture");
     92        add_submenu_page(basename(__FILE__), __("Picture"), __("Picture"), 1, basename(__FILE__), "xprofile_picture");     
     93        add_options_page(__("Profile"), __("Profile"), 1, basename(__FILE__), "xprofile_add_settings");     
     94       
     95        $groups = BP_XProfile_Group::get_all();
     96
     97        for($i=0; $i<count($groups); $i++) {
     98            if($groups[$i]->fields) {
     99                add_submenu_page(basename(__FILE__), $groups[$i]->name, $groups[$i]->name, 1, "xprofile_" . $groups[$i]->name, "xprofile_edit");       
     100            }
     101        }
     102   
     103        /* Add the administration tab under the "Site Admin" tab for site administrators */
     104        add_submenu_page('wpmu-admin.php', __("Profiles"), __("Profiles"), 1, "xprofile_settings", "xprofile_admin");
     105    }
     106   
    103107    /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    104108    if($wpdb->get_var("show tables like '%" . $bp_xprofile_table_name . "%'") == false) xprofile_install();
     
    126130    add_action("admin_print_scripts", "xprofile_add_css");
    127131    add_action("admin_print_scripts", "xprofile_add_js");
     132
    128133}
    129134add_action('admin_menu','xprofile_setup');
     
    141146    query_posts('showposts=1');
    142147    if (have_posts()) : while (have_posts()) : the_post(); endwhile; endif;
    143     global $is_author, $userdata, $authordata;
     148    global $is_author, $userdata, $authordata; 
    144149}
    145150add_action('wp_head', 'xprofile_invoke_authordata');
     
    447452
    448453
    449 
     454/**************************************************************************
     455 xprofile_add_settings()
     456 
     457 Renders the profile tab under settings for each member.
     458 **************************************************************************/
     459
     460function xprofile_add_settings()
     461{
    450462?>
     463    <div class="wrap">
     464        <h2><?php _e('Profile Settings'); ?></h2>
     465        <p>Member profile settings will appear here.</p>
     466    </div>
     467<?php
     468}
     469
     470
     471?>
Note: See TracChangeset for help on using the changeset viewer.