PluginProbe
Multiple Roles / 1.3.2
Multiple Roles v1.3.2
trunk 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8
multiple-roles / multiple-roles.php

multiple-roles.php in Multiple Roles 1.3.2, at multiple-roles.php

53 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Multiple Roles
4 Description: Allow users to have multiple roles on one site.
5 Version: 1.3.2
6 Author: Florian TIAR
7 Author URI: http://tiar-florian.fr
8 Plugin URI: https://wordpress.org/plugins/multiple-roles/
9 Github URI: https://github.com/Mahjouba91/multiple-roles
10 Text Domain: multiple-roles
11 */
12
13 define( 'MDMR_PATH', plugin_dir_path( __FILE__ ) );
14 define( 'MDMR_URL', plugin_dir_url( __FILE__ ) );
15
16 /**
17 * Load files and add hooks to get things rolling.
18 */
19 require_once( MDMR_PATH . 'model.php' );
20 require_once( MDMR_PATH . 'controllers/checklist.php' );
21 require_once( MDMR_PATH . 'controllers/column.php' );
22
23 $model = new MDMR_Model();
24
25 $checklist = new MDMR_Checklist_Controller( $model );
26 add_action( 'admin_enqueue_scripts', array( $checklist, 'remove_dropdown' ) );
27 add_action( 'show_user_profile', array( $checklist, 'output_checklist' ) );
28 add_action( 'edit_user_profile', array( $checklist, 'output_checklist' ) );
29 add_action( 'user_new_form', array( $checklist, 'output_checklist' ) );
30 add_action( 'profile_update', array( $checklist, 'process_checklist' ) );
31
32 // For new user form (in Backoffice)
33 // In multisite, user_register hook is too early so wp_mu_activate_user add user role after
34 if ( is_multisite() ) {
35 if ( version_compare( get_bloginfo( 'version' ), '4.8', '>=' ) ) {
36 add_filter( 'signup_site_meta', array( $checklist, 'mu_add_roles_in_signup_meta_recently' ), 10, 7 );
37 } else {
38 add_action( 'after_signup_user', array( $checklist, 'mu_add_roles_in_signup_meta' ), 10, 4 );
39 }
40 add_action( 'wpmu_activate_user', array( $checklist, 'mu_add_roles_after_activation' ), 10, 3 );
41 } else {
42 add_action( 'user_register', array( $checklist, 'process_checklist' ) );
43 }
44
45 $column = new MDMR_Column_Controller( $model );
46 add_filter( 'manage_users_columns', array( $column, 'replace_column' ), 11 );
47 add_filter( 'manage_users_custom_column', array( $column, 'output_column_content' ), 10, 3 );
48
49 add_action( 'init', 'load_translation' );
50 function load_translation() {
51 load_plugin_textdomain( 'multiple-roles', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
52 }
53