-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhd-basement.php
executable file
·65 lines (50 loc) · 2.02 KB
/
hd-basement.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
Plugin Name: Highrise Digital Basement
Description: Core utilities plugin used by Highrise Digital for building out WordPress sites. Used alongside The Ground Floor base theme.
Version: 1.0
Author: Highrise Digital Ltd
Author URI: https://highrise.digital
*/
// define variable for path to this plugin file
define( 'HD_BASEMENT_LOCATION', dirname( __FILE__ ) );
define( 'HD_BASEMENT_URL', plugins_url( '', __FILE__ ) );
// if we are in the admin
if( is_admin() ) {
// load in our included admin files for this plugin
require_once dirname( __FILE__ ) . '/inc/admin/scripts.php';
require_once dirname( __FILE__ ) . '/inc/admin/admin-menus.php';
require_once dirname( __FILE__ ) . '/inc/admin/admin-widgets.php';
require_once dirname( __FILE__ ) . '/inc/admin/user-meta.php';
require_once dirname( __FILE__ ) . '/inc/admin/admin.php';
require_once dirname( __FILE__ ) . '/inc/admin/admin-menu-content.php';
}
// require non admin files
require_once dirname( __FILE__ ) . '/inc/capabilities.php';
require_once dirname( __FILE__ ) . '/inc/widgets.php';
require_once dirname( __FILE__ ) . '/inc/admin/admin-bar.php';
require_once dirname( __FILE__ ) . '/inc/remove-customizer.php';
/**
* checks whether the current user is a highrise digital team member
* this is based on the email address. If the email domain matches
* highrise.digital the user is a hd user
* The email domain can be filtered to allow other email domains to
* be hd users too.
*
* @return boolean true is the user is a hd user and false otherwise
*/
function is_hd_user( $user_id = 0 ) {
// if no user id is passed
if( 0 === $user_id ) {
// use current user
$user_id = get_current_user_id();
} // end if have user id
// get the highrise dashboard setting from user meta
$hd_dashboard = get_user_meta( $user_id, 'hd_normal_wp_user', true );
// if no value is stored
if( '' === $hd_dashboard ) {
// assume the value is false
$hd_dashboard = false;
}
return apply_filters( 'is_hd_user', filter_var( $hd_dashboard, FILTER_VALIDATE_BOOLEAN ), $user_id );
}