-
Notifications
You must be signed in to change notification settings - Fork 3
/
bp-limit-group-membership-per-user.php
75 lines (61 loc) · 1.49 KB
/
bp-limit-group-membership-per-user.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
66
67
68
69
70
71
72
73
74
75
<?php
/**
* Plugin Name: BuddyPress Limit Group Membership
* Plugin URI: https://buddydev.com/plugins/bp-limit-group-membership/
* Author: BuddyDev
* Author URI: https://buddydev.com/members/sbrajesh
* Version : 1.0.7
* License: GPL
* Description: Restricts the no. of Groups a user can join
*/
if ( ! defined( 'ABSPATH' ) ) {
exit( 0 );
}
class BP_Limit_Group_Membership_Loader {
/**
* Singleton instance.
*
* @var BP_Limit_Group_Membership_Loader
*/
private static $instance = null;
/**
* Constructor.
*/
private function __construct() {
$this->setup();
}
/**
* Get the singleton instance.
*
* @return BP_Limit_Group_Membership_Loader
*/
public static function get_instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Setup actions
*/
private function setup() {
add_action( 'bp_loaded', array( $this, 'load' ) );
add_action( 'bp_init', array( $this, 'load_textdomain' ), 2 );
}
/**
* Load required files
*/
public function load() {
$path = plugin_dir_path( __FILE__ );
require_once $path . 'core/bp-limit-group-membership-action-handler.php';
require_once $path . 'core/bp-limit-group-membership-admin.php';
}
/**
* Load translation
*/
public function load_textdomain() {
load_plugin_textdomain( 'bp-limit-group-membership-per-user', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
}
}
// initialize.
BP_Limit_Group_Membership_Loader::get_instance();