Skip to:
Content

BuddyPress.org

Changeset 2798 for trunk/bp-xprofile.php


Ignore:
Timestamp:
03/03/2010 06:53:59 AM (16 years ago)
Author:
johnjamesjacoby
Message:

Allow xprofile field groups to be reordered. Also swept through xprofile files and cleaned up code formatting.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-xprofile.php

    r2797 r2798  
    11<?php
    2 define ( 'BP_XPROFILE_DB_VERSION', '1850' );
     2define ( 'BP_XPROFILE_DB_VERSION', '1950' );
    33
    44/* Define the slug for the component */
     
    3838                          name varchar(150) NOT NULL,
    3939                          description mediumtext NOT NULL,
     40                          group_order bigint(20) NOT NULL DEFAULT '0',
    4041                          can_delete tinyint(1) NOT NULL,
    4142                          KEY can_delete (can_delete)
     
    8687
    8788        require_once( ABSPATH . 'wp-admin/upgrade-functions.php' );
    88         dbDelta($sql);
     89        dbDelta( $sql );
    8990
    9091        do_action( 'xprofile_install' );
     
    153154
    154155        /* Add the administration tab under the "Site Admin" tab for site administrators */
    155         add_submenu_page( 'bp-general-settings', __("Profile Field Setup", 'buddypress'), __("Profile Field Setup", 'buddypress'), 'manage_options', 'bp-profile-setup', "xprofile_admin" );
     156        add_submenu_page( 'bp-general-settings', __( 'Profile Field Setup', 'buddypress' ), __( 'Profile Field Setup', 'buddypress' ), 'manage_options', 'bp-profile-setup', 'xprofile_admin' );
    156157
    157158        /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
     
    215216        /* Don't show this menu to non site admins or if you're viewing your own profile */
    216217        if ( !is_site_admin() || bp_is_my_profile() )
    217                 return false;
    218         ?>
     218                return false; ?>
     219
    219220        <li id="bp-adminbar-adminoptions-menu">
    220221                <a href=""><?php _e( 'Admin Options', 'buddypress' ) ?></a>
     
    223224                        <li><a href="<?php echo $bp->displayed_user->domain . $bp->profile->slug ?>/edit/"><?php printf( __( "Edit %s's Profile", 'buddypress' ), attribute_escape( $bp->displayed_user->fullname ) ) ?></a></li>
    224225                        <li><a href="<?php echo $bp->displayed_user->domain . $bp->profile->slug ?>/change-avatar/"><?php printf( __( "Edit %s's Avatar", 'buddypress' ), attribute_escape( $bp->displayed_user->fullname ) ) ?></a></li>
    225 
    226                         <?php if ( !bp_core_is_user_spammer( $bp->displayed_user->id ) ) : ?>
    227                                 <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>
    228                         <?php else : ?>
    229                                 <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>
    230                         <?php endif; ?>
     226<?php if ( !bp_core_is_user_spammer( $bp->displayed_user->id ) ) : ?>
     227
     228                        <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>
     229<?php else : ?>
     230
     231                        <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>
     232<?php endif; ?>
    231233
    232234                        <li><a href="<?php echo wp_nonce_url( $bp->displayed_user->domain . 'admin/delete-user/', 'delete-user' ) ?>" class="confirm"><?php printf( __( "Delete %s", 'buddypress' ), attribute_escape( $bp->displayed_user->fullname ) ) ?></a></li>
    233 
    234                         <?php do_action( 'xprofile_adminbar_menu_items' ) ?>
     235<?php do_action( 'xprofile_adminbar_menu_items' ) ?>
     236
    235237                </ul>
    236238        </li>
    237         <?php
     239<?php
    238240}
    239241add_action( 'bp_adminbar_menus', 'xprofile_setup_adminbar_menu', 20 );
     
    578580        $field_group = new BP_XProfile_Group( $field_group_id );
    579581        return $field_group->delete();
     582}
     583
     584function xprofile_update_field_group_position( $field_group_id, $position ) {
     585        return BP_XProfile_Group::update_position( $field_group_id, $position );
    580586}
    581587
     
    851857
    852858function xprofile_update_field_position( $field_id, $position ) {
    853         return BP_XProfile_Field::update_position( $field_id, $position);
     859        return BP_XProfile_Field::update_position( $field_id, $position );
    854860}
    855861
     
    953959        BP_XProfile_ProfileData::delete_data_for_user( $user_id );
    954960
    955         // delete any avatar files.
     961        /* delete any avatar files. */
    956962        @unlink( get_usermeta( $user_id, 'bp_core_avatar_v1_path' ) );
    957963        @unlink( get_usermeta( $user_id, 'bp_core_avatar_v2_path' ) );
    958964
    959         // unset the usermeta for avatars from the usermeta table.
     965        /* unset the usermeta for avatars from the usermeta table. */
    960966        delete_usermeta( $user_id, 'bp_core_avatar_v1' );
    961967        delete_usermeta( $user_id, 'bp_core_avatar_v1_path' );
     
    9951001}
    9961002
    997 // List actions to clear object caches on
     1003/* List actions to clear object caches on */
    9981004add_action( 'xprofile_groups_deleted_group', 'xprofile_clear_profile_groups_object_cache' );
    9991005add_action( 'xprofile_groups_saved_group', 'xprofile_clear_profile_groups_object_cache' );
    10001006add_action( 'xprofile_updated_profile', 'xprofile_clear_profile_data_object_cache' );
    10011007
    1002 // List actions to clear super cached pages on, if super cache is installed
     1008/* List actions to clear super cached pages on, if super cache is installed */
    10031009add_action( 'xprofile_updated_profile', 'bp_core_clear_cache' );
    10041010
Note: See TracChangeset for help on using the changeset viewer.