WordPress.org

Make WordPress Core

Ticket #43885: 43885.patch

File 43885.patch, 705 bytes (added by keraweb, 3 years ago)

Add $display_name property to WP_Role class

  • wp-includes/class-wp-role.php

     
    2222        public $name;
    2323
    2424        /**
     25         * Role display name.
     26         *
     27         * @since 5.x
     28         * @var string
     29         */
     30        public $display_name;
     31
     32        /**
    2533         * List of capabilities the role contains.
    2634         *
    2735         * @since 2.0.0
     
    4351        public function __construct( $role, $capabilities ) {
    4452                $this->name         = $role;
    4553                $this->capabilities = $capabilities;
     54
     55                $names = wp_roles()->get_names();
     56                if ( isset( $names[ $role ] ) ) {
     57                        $this->display_name = $names[ $role ];
     58                }
    4659        }
    4760
    4861        /**