コード例 #1
0
ファイル: buddyboss-bmt.php プロジェクト: tvolmari/hammydowns
function BUDDYBOSS_BMT_init()
{
    if (!function_exists('bp_is_active')) {
        return;
    }
    global $BUDDYBOSS_BMT;
    $main_include = BUDDYBOSS_BMT_PLUGIN_DIR . 'includes/main-class.php';
    try {
        if (file_exists($main_include)) {
            require $main_include;
        } else {
            $msg = sprintf(__("Couldn't load main class at:<br/>%s", 'bp-member-types'), $main_include);
            throw new Exception($msg, 404);
        }
    } catch (Exception $e) {
        $msg = sprintf(__("<h1>Fatal error:</h1><hr/><pre>%s</pre>", 'bp-member-types'), $e->getMessage());
        echo $msg;
    }
    $BUDDYBOSS_BMT = BuddyBoss_BMT_Plugin::instance();
}
コード例 #2
0
ファイル: bmt-actions.php プロジェクト: tvolmari/hammydowns
 private function __construct()
 {
     //register internal post type used to handle the member type
     add_action('bp_init', array($this, 'register_post_type'));
     add_action('admin_menu', array($this, 'add_import_menu'));
     add_action('admin_menu', array($this, 'add_help_menu'), 11);
     //register member type
     add_action('bp_register_member_types', array($this, 'register_member_type'));
     add_action('bp_signup_validate', array($this, 'bmt_validate_member_type_field'));
     add_action('bp_core_signup_user', array($this, 'bmt_member_type_on_registration'), 10, 5);
     add_action('bp_core_activated_user', array($this, 'bmt_member_type_on_registration_multisite'), 10, 3);
     add_filter('bp_signup_usermeta', array($this, 'bmt_alter_usermeta'));
     // add setting link
     $buddyboss = BuddyBoss_BMT_Plugin::instance();
     $plugin = $buddyboss->basename;
     add_filter("plugin_action_links_{$plugin}", array($this, 'plugin_settings_link'));
     add_action("admin_init", array($this, 'changing_listing_label'));
     // remove users of a specific member type from members directory
     add_action('bp_ajax_querystring', array($this, 'exclude_users_from_directory_and_searches'), 999, 2);
     // set member type while update user profile
     add_action('profile_update', array($this, 'update_user_member_type_set'), 10, 2);
     // fix all member count
     add_filter('bp_core_get_active_member_count', array($this, 'fixed_all_member_count'), 999);
 }
コード例 #3
0
ファイル: main-class.php プロジェクト: tvolmari/hammydowns
 /**
  * Main BuddyBoss BMT Instance.
  *
  * BuddyBoss BMT is great
  * Please load it only one time
  * For this, we thank you
  *
  * Insures that only one instance of BuddyBoss BMT exists in memory at any
  * one time. Also prevents needing to define globals all over the place.
  *
  * @since BuddyBoss BMT (1.0.0)
  *
  * @static object $instance
  * @uses BuddyBoss_BMT_Plugin::setup_globals() Setup the globals needed.
  * @uses BuddyBoss_BMT_Plugin::setup_actions() Setup the hooks and actions.
  * @uses BuddyBoss_BMT_Plugin::setup_textdomain() Setup the plugin's language file.
  * @see buddyboss_bmt()
  *
  * @return BuddyBoss BMT The one true BuddyBoss.
  */
 public static function instance()
 {
     // Store the instance locally to avoid private static replication
     static $instance = null;
     // Only run these methods if they haven't been run previously
     if (null === $instance) {
         $instance = new BuddyBoss_BMT_Plugin();
         $instance->setup_globals();
         $instance->setup_actions();
         $instance->setup_textdomain();
     }
     // Always return the instance
     return $instance;
 }