Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions frontend/class-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ public function is_reply_to_listing_page() {
return $this->is_page_that_has_shortcode( 'AWPCPREPLYTOAD' );
}

/**
* @since x.x
*/
public function is_user_listings_page() {
return $this->is_page_that_has_shortcode( 'AWPCPUSERLISTINGS' );
}

public function is_browse_listings_page() {
return $this->is_page_that_has_shortcode( 'AWPCPBROWSEADS' );
}
Expand Down
9 changes: 9 additions & 0 deletions includes/class-authentication-redirection-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public function maybe_redirect() {
$page_requires_authentication = $this->post_listing_page_requires_authentication();
} elseif ( $this->query->is_reply_to_listing_page() ) {
$page_requires_authentication = $this->reply_to_listing_page_requires_autentication();
} elseif ( $this->query->is_user_listings_page() ) {
$page_requires_authentication = $this->user_listings_page_requires_authentication();
} else {
$page_requires_authentication = false;
}
Expand All @@ -49,6 +51,13 @@ private function reply_to_listing_page_requires_autentication() {
return $this->settings->get_option( 'reply-to-ad-requires-registration' );
}

/**
* @since x.x
*/
private function user_listings_page_requires_authentication() {
return $this->settings->get_option( 'requireuserregistration' );
}

private function redirect_to_login_page( $login_url ) {
wp_safe_redirect( add_query_arg( 'redirect_to', urlencode( awpcp_current_url() ), $login_url ) );
exit();
Expand Down
Loading