Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/09/2023 12:24:49 AM (2 years ago)
Author:
espellcaste
Message:

Properly declare missing properties to classes in the Members component.

See #7018

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/classes/class-bp-members-admin.php

    r13169 r13404  
    5555
    5656    /**
     57     * Redirect.
     58     *
     59     * @since 2.0.0
     60     * @var string
     61     */
     62    public $redirect;
     63
     64    /**
    5765     * Screen id for edit user's profile page.
    5866     *
     67     * @since 2.0.0
    5968     * @var string
    6069     */
     
    6271
    6372    /**
    64      * Setup BP Members Admin.
    65      *
    66      * @since 2.0.0
    67      *
    68      * @return BP_Members_Admin
    69      */
    70     public static function register_members_admin() {
    71         if ( ! is_admin() ) {
    72             return;
    73         }
    74 
    75         $bp = buddypress();
    76 
    77         if ( empty( $bp->members->admin ) ) {
    78             $bp->members->admin = new self;
    79         }
    80 
    81         return $bp->members->admin;
    82     }
     73     * User capability.
     74     *
     75     * @since 2.0.0
     76     * @var string
     77     */
     78    public $capability;
     79
     80    /**
     81     * Show Profile Screen id.
     82     *
     83     * @since 2.0.0
     84     * @var string
     85     */
     86    public $user_profile;
     87
     88    /**
     89     * Current user ID.
     90     *
     91     * @since 2.0.0
     92     * @var int
     93     */
     94    public $current_user_id;
     95
     96    /**
     97     * User ID being edited.
     98     *
     99     * @since 2.0.0
     100     * @var int
     101     */
     102    public $user_id = 0;
     103
     104    /**
     105     * Is a member editing their own profile.
     106     *
     107     * @since 2.0.0
     108     * @var bool
     109     */
     110    public $is_self_profile = false;
     111
     112    /**
     113     * The screen ids to load specific css for.
     114     *
     115     * @since 2.0.0
     116     * @var array
     117     */
     118    public $screen_id = array();
     119
     120    /**
     121     * The stats metabox default position.
     122     *
     123     * @since 2.0.0
     124     * @var stdClass
     125     */
     126    public $stats_metabox;
     127
     128    /**
     129     * Edit user's profile args.
     130     *
     131     * @since 2.0.0
     132     * @var array
     133     */
     134    public $edit_profile_args;
     135
     136    /**
     137     * Edit user's profile URL.
     138     *
     139     * @since 2.0.0
     140     * @var string
     141     */
     142    public $edit_profile_url = '';
     143
     144    /**
     145     * Edit URL.
     146     *
     147     * @since 2.0.0
     148     * @var string
     149     */
     150    public $edit_url = '';
     151
     152    /**
     153     * Users page.
     154     *
     155     * @since 2.0.0
     156     * @var string
     157     */
     158    public $users_page = '';
     159
     160    /**
     161     * Signups page.
     162     *
     163     * @since 2.0.0
     164     * @var string
     165     */
     166    public $signups_page = '';
     167
     168    /**
     169     * Users URL.
     170     *
     171     * @since 2.0.0
     172     * @var string
     173     */
     174    public $users_url;
     175
     176    /**
     177     * Users screen.
     178     *
     179     * @since 2.0.0
     180     * @var string
     181     */
     182    public $users_screen;
     183
     184    /**
     185     * Members' Invite Page.
     186     *
     187     * @since 2.0.0
     188     * @var string
     189     */
     190    public $members_invites_page = '';
     191
     192    /**
     193     * Status of BuddyPress network.
     194     *
     195     * @since 2.0.0
     196     * @var bool
     197     */
     198    public $subsite_activated;
     199
     200    /**
     201     * Tools menu.
     202     *
     203     * @since 2.0.0
     204     * @var string
     205     */
     206    public $tools_parent = 'tools.php';
    83207
    84208    /**
     
    101225
    102226        // Paths and URLs
    103         $this->admin_dir = trailingslashit( $bp->plugin_dir  . 'bp-members/admin' ); // Admin path.
    104         $this->admin_url = trailingslashit( $bp->plugin_url  . 'bp-members/admin' ); // Admin URL.
     227        $this->admin_dir = trailingslashit( $bp->plugin_dir . 'bp-members/admin' ); // Admin path.
     228        $this->admin_url = trailingslashit( $bp->plugin_url . 'bp-members/admin' ); // Admin URL.
    105229        $this->css_url   = trailingslashit( $this->admin_url . 'css' ); // Admin CSS URL.
    106230        $this->js_url    = trailingslashit( $this->admin_url . 'js'  ); // Admin CSS URL.
     
    109233        $this->capability = bp_core_do_network_admin() ? 'manage_network_users' : 'edit_users';
    110234
    111         // The Edit Profile Screen id.
    112         $this->user_page = '';
    113 
    114235        // The Show Profile Screen id.
    115236        $this->user_profile = is_network_admin() ? 'users' : 'profile';
     
    118239        $this->current_user_id = get_current_user_id();
    119240
    120         // The user id being edited.
    121         $this->user_id = 0;
    122 
    123         // Is a member editing their own profile.
    124         $this->is_self_profile = false;
    125 
    126         // The screen ids to load specific css for.
    127         $this->screen_id = array();
    128 
    129241        // The stats metabox default position.
    130         $this->stats_metabox = new StdClass();
     242        $this->stats_metabox = new stdClass();
    131243
    132244        // BuddyPress edit user's profile args.
    133245        $this->edit_profile_args = array( 'page' => 'bp-profile-edit' );
    134         $this->edit_profile_url  = '';
    135         $this->edit_url          = '';
    136246
    137247        // Data specific to signups.
    138         $this->users_page   = '';
    139         $this->signups_page = '';
    140248        $this->users_url    = bp_get_admin_url( 'users.php' );
    141249        $this->users_screen = bp_core_do_network_admin() ? 'users-network' : 'users';
    142 
    143         $this->members_invites_page = '';
    144250
    145251        // Specific config: BuddyPress is not network activated.
     
    157263        if ( is_multisite() && bp_core_do_network_admin() ) {
    158264            $this->tools_parent = 'network-tools';
    159         } else {
    160             $this->tools_parent = 'tools.php';
    161265        }
    162266    }
     
    169273    private function setup_actions() {
    170274
    171         /** Extended Profile *************************************************
    172          */
     275        /** Extended Profile **************************************************/
    173276
    174277        // Enqueue all admin JS and CSS.
     
    305408            ) );
    306409        }
     410    }
     411
     412    /**
     413     * Setup BP Members Admin.
     414     *
     415     * @since 2.0.0
     416     *
     417     * @return BP_Members_Admin|null
     418     */
     419    public static function register_members_admin() {
     420        if ( ! is_admin() ) {
     421            return null;
     422        }
     423
     424        $bp = buddypress();
     425
     426        if ( empty( $bp->members->admin ) ) {
     427            $bp->members->admin = new self;
     428        }
     429
     430        return $bp->members->admin;
    307431    }
    308432
     
    456580     *
    457581     * @since 2.1.0
    458      *
    459582     */
    460583    public function user_profile_menu() {
     
    493616     *
    494617     * @since 2.0.0
    495      *
    496618     */
    497619    public function admin_menus() {
Note: See TracChangeset for help on using the changeset viewer.