Example #1
3
 /**
  * Process WooCommerce Memberships data to see if a member has any active
  * memberships or not. Cache the result in the Akses specific data base.
  *
  * @param int $userId User ID.
  */
 private static function process_wc_membership_member_status($userId)
 {
     $is_active = false;
     if (function_exists('wc_memberships')) {
         // check if the member has an active membership for any plan
         foreach (wc_memberships_get_membership_plans() as $plan) {
             if (wc_memberships_is_user_active_member($userId, $plan)) {
                 $is_active = true;
                 break;
             }
         }
     } else {
         error_log('Can not process membership statuses: WooCommerce Memberships is not installed.');
     }
     Akses_Membership::set_member_active($userId, $is_active);
 }
Example #2
0
 /**
  * Define the core functionality of the plugin.
  *
  */
 private function __construct()
 {
     $this->set_locale();
     Akses_Membership::register_hooks();
     $this->define_admin_hooks();
     $this->define_public_hooks();
     $this->define_post_types();
     $this->register_hooks();
 }
Example #3
0
 /**
  * Callback function for the metabox action.
  * This method is calling a rendering method in a script in the `partials`
  * folder.
  */
 public static function build_meta_box_assignment($post)
 {
     wp_nonce_field(Akses_Allowance::get_nonce_context(get_the_ID()), Akses_Allowance::ASSIGNMENT_NONCE);
     $members = Akses_Membership::get_active_members();
     akses_render_metabox_members($members);
 }