/**
  * Set initial protection.
  *
  * @since  1.0.0
  *
  * @param MS_Model_Relationship $ms_relationship Optional. Not used.
  */
 public function protect_content($ms_relationship = false)
 {
     parent::protect_content($ms_relationship);
     $this->add_filter('bp_user_can_create_groups', 'protect_create_bp_group');
     $this->protect_friendship_request();
     $this->protect_private_messaging();
 }
 /**
  * Set initial protection.
  *
  * @since  1.0.0
  */
 public function protect_content()
 {
     parent::protect_content();
     /*
      * Replace the "menu" attribute of the wp_nav_menu() call
      */
     $this->add_filter('wp_nav_menu_args', 'replace_menus');
 }
 /**
  * Set initial protection.
  *
  * @since  1.0.0
  */
 public function protect_content()
 {
     parent::protect_content();
     /*
      * This filter is called by get_theme_mod() in wp-includes/theme.php
      * get_theme_mod( 'nav_menu_locations' ) returns an array of theme
      * menu-areas and assigned custom menus. Our function modifies the
      * assigned menus to reflect the specified matching table.
      */
     $this->add_filter('theme_mod_nav_menu_locations', 'replace_menus');
 }
 /**
  * Set initial protection.
  *
  * @since  1.0.0
  */
 public function protect_content()
 {
     /*
      * Only protect if cpt group.
      * Protect in list rather than on a single post.
      */
     if (!MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_CPT_POST_BY_POST)) {
         parent::protect_content();
         $this->add_action('parse_query', 'protect_posts', 98);
     }
 }
 /**
  * Set initial protection.
  *
  * @since  1.0.0
  */
 public function protect_content()
 {
     /**
      * Only protect if not cpt group.
      * Restrict query to show only has_access cpt posts.
      */
     if (MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_CPT_POST_BY_POST)) {
         parent::protect_content();
         $this->add_action('parse_query', 'protect_posts', 98);
     }
 }
 /**
  * Set initial protection.
  *
  * Add [ms-protect-content] shortcode to protect membership content inside post.
  *
  * @since  1.0.0
  */
 public function protect_content()
 {
     parent::protect_content();
     self::$membership_ids[] = $this->membership_id;
     add_shortcode(self::PROTECT_CONTENT_SHORTCODE, array(__CLASS__, 'protect_content_shortcode'));
     if (MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_SHORTCODE)) {
         global $shortcode_tags;
         $exclude = MS_Helper_Shortcode::get_membership_shortcodes();
         foreach ($shortcode_tags as $shortcode => $callback_funciton) {
             if (in_array($shortcode, $exclude)) {
                 continue;
             }
             if (!parent::has_access($shortcode)) {
                 $shortcode_tags[$shortcode] = array(&$this, 'do_protected_shortcode');
             }
         }
     }
 }
 /**
  * Set initial protection.
  *
  * @since  1.0.0
  */
 public function protect_content()
 {
     parent::protect_content();
     $this->add_filter('user_has_cap', 'prepare_caps', 1, 4);
     $this->add_filter('user_has_cap', 'modify_caps', 10, 4);
 }
 /**
  * Set initial protection.
  *
  * @since  1.0.0
  */
 public function initialize()
 {
     parent::protect_content();
     if (MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_MEDIA)) {
         // Start buffering during init action, though output should only
         // happen a lot later... This way we're save.
         $this->add_action('init', 'buffer_start');
         // Process the buffer right in the end.
         $this->add_action('shutdown', 'buffer_end');
         $this->add_action('parse_request', 'handle_download_protection', 3);
     }
 }
 /**
  * Set initial protection.
  *
  * @since  1.0.0
  */
 public function protect_content()
 {
     parent::protect_content();
     $this->add_action('pre_get_posts', 'protect_posts', 98);
     $this->add_filter('get_terms', 'protect_categories', 99, 2);
 }
 /**
  * Set initial protection.
  *
  * @since  1.0.0
  */
 public function protect_content()
 {
     parent::protect_content();
     $this->add_action('pre_get_posts', 'find_protected_posts', 99);
     $this->add_action('pre_get_posts', 'protect_posts', 100);
 }
 /**
  * Set initial protection.
  *
  * @since  1.0.0
  */
 public function protect_content()
 {
     parent::protect_content();
     // ********* COMMENTS **********
     // No comments on special pages (signup, account, ...)
     $this->add_filter('the_content', 'check_special_page');
     /*
      * We find the public comment access once.
      * This is the access ganted to guests or memberships that do not define
      * an explicit comment access rule.
      */
     if (null === self::$comment_public) {
         $base_rule = MS_Model_Membership::get_base()->get_rule($this->rule_type);
         if (null === $base_rule->get_rule_value(self::COMMENT_WRITE)) {
             self::$comment_public = self::COMMENT_WRITE;
         } elseif (null === $base_rule->get_rule_value(self::COMMENT_READ)) {
             self::$comment_public = self::COMMENT_READ;
         } else {
             self::$comment_public = self::COMMENT_NO_ACCESS;
         }
     }
     // Find the most generous comment access rule.
     $has_full = $this->get_rule_value(self::COMMENT_WRITE);
     $has_read = $this->get_rule_value(self::COMMENT_READ);
     $has_none = $this->get_rule_value(self::COMMENT_NO_ACCESS);
     if (true === $has_full) {
         // Membership allows full comment access.
         self::$comment_access = self::COMMENT_WRITE;
     } elseif (true === $has_read) {
         // Membership allows read-only access.
         if (self::$comment_access == self::COMMENT_NO_ACCESS) {
             self::$comment_access = self::COMMENT_READ;
         }
     } elseif (true === $has_none) {
         // Membership does not allow any comment access.
         // (no change, this is the default access level)
     } else {
         // This membership does not define a comment access: Use public access!
         self::$comment_access = self::$comment_public;
     }
     $this->add_action('ms_setup_protection_done', 'protect_comments');
     // ********** READ MORE **********
     $this->protection_message = MS_Plugin::instance()->settings->get_protection_message(MS_Model_Settings::PROTECTION_MSG_MORE_TAG, $this->membership_id);
     if (!parent::has_access(self::MORE_LIMIT)) {
         $this->add_filter('the_content_more_link', 'show_moretag_protection', 99, 2);
         $this->add_filter('the_content', 'replace_more_tag_content', 1);
         $this->add_filter('the_content_feed', 'replace_more_tag_content', 1);
     }
 }
Пример #12
0
 /**
  * Set initial protection (front-end only)
  *
  * @since  1.0.0
  */
 public function protect_content()
 {
     parent::protect_content();
     $this->add_filter('get_pages', 'protect_pages', 99);
 }
 /**
  * Set initial protection.
  *
  * @since  1.0.0
  */
 public function protect_content()
 {
     parent::protect_content();
     $this->add_filter('wp_setup_nav_menu_item', 'prepare_menuitem', 10, 3);
     $this->add_filter('wp_get_nav_menu_items', 'protect_menuitems', 10, 3);
 }
 /**
  * Set initial protection.
  *
  * @since  1.0.0
  *
  * @param MS_Model_Relationship $ms_relationship Optional. Not used.
  */
 public function protect_content($ms_relationship = false)
 {
     parent::protect_content($ms_relationship);
     $this->add_action('pre_get_posts', 'protect_posts', 98);
 }