Skip to content

Commit

Permalink
Merged in thobk/membership-2-thobk/fix/964172503109522-bbpress-buddyp…
Browse files Browse the repository at this point in the history
…ress-in-protection-rule (pull request #124)

Fix/964172503109522 bbpress buddypress in protection rule

Approved-by: Joel James <[email protected]>
  • Loading branch information
thobk authored and Joel James committed Mar 4, 2019
2 parents 3a42559 + dfa3934 commit 122fb3d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
7 changes: 4 additions & 3 deletions app/helper/class-ms-helper-html.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,13 @@ public static function html_admin_vertical_tabs( $tabs, $active_tab = null, $per
$url = $tab['url'];
$attributes = array();

$url = remove_query_arg( 'status', $url );

foreach ( $persistent as $param ) {
mslib3()->array->equip_request( $param );
$value = $_REQUEST[ $param ];
$url = esc_url_raw(
add_query_arg( $param, $value, $url )
);

$url = add_query_arg( $param, $value, $url );
}

$attributes[] = 'class="ms-tab-link"';
Expand Down
33 changes: 30 additions & 3 deletions premium/addon/searchindex/class-ms-addon-searchindex.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function init() {

$this->add_filter(
'ms_model_membership_is_base',
'is_valid_type',
'is_base_type',
10, 2
);

Expand All @@ -109,8 +109,13 @@ public function init() {
'apply_membership'
);

$this->add_action(
'ms_load_member',
'create_membership'
);

// Last action in the init sequence.
$this->create_membership();
// $this->create_membership();
} else {
$this->add_filter(
'ms_model_membership_get_memberships',
Expand Down Expand Up @@ -170,7 +175,7 @@ public function register( $list ) {
*
* @since 1.0.1.0
*/
protected function create_membership() {
public function create_membership() {
$this->membership = MS_Model_Membership::_get_system_membership(
self::MEMBERSHIP_TYPE,
true
Expand Down Expand Up @@ -241,6 +246,28 @@ public function is_valid_type( $result, $membership_type ) {
return $result;
}


/**
* Search Index should be a hidden type
*
* @since 1.0.1.0
* @param bool $result Default response.
* @param string $membership_type The Membership type to check.
* @return bool Is-Base-Type flag.
*/
public function is_base_type( $result, $membership_type ) {
if ( self::MEMBERSHIP_TYPE == $membership_type ) {
$result = true;

// but should be visible in protection tab
if( MS_Controller_Plugin::is_page( 'protection' ) ){
$result = false;
}
}

return $result;
}

/**
* Modify the list-table actions for the Search-index membership in the
* Membership list.
Expand Down

0 comments on commit 122fb3d

Please sign in to comment.