Skip to content

Commit

Permalink
fix listings bug when leaving role settings empty to allow view/edit/…
Browse files Browse the repository at this point in the history
…delete own entries
  • Loading branch information
RensTillmann committed Jun 6, 2022
1 parent 27a418c commit acd9376
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 12 deletions.
5 changes: 3 additions & 2 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@

- [PDF Generator Add-on](https://renstillmann.github.io/super-forms/#/pdf-generator-add-on)

## May 28, 2022 - Version 6.3.2
## Jun 06, 2022 - Version 6.3.2

- **Improved:** Do not store `server_http_referrer_session` and/or `tags_values` as client data when not needed
- **Improved:** Do not store `server_http_referrer_session` and/or `tags_values` as client data when not needed, which could stress the database on high traffic websites
- **Fix:** `Listings` bug fix when leaving role settings empty (did not allow the user to view/edit/delete their own entries)

## May 04, 2022 - Version 6.3.1

Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/frontend/elements.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/assets/css/frontend/elements.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/assets/css/frontend/elements.sass
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,6 @@ h1.super-thanks-title
padding: 0px 0px 0px 0px
position: relative
display: flex
align-items: center
flex-direction: column
.super-max-width-wrapper
position: relative
Expand All @@ -550,6 +549,7 @@ h1.super-thanks-title
z-index: 1
outline: none!important
&.super-center-form
align-items: center
text-align: center
form
text-align: left
Expand Down
6 changes: 6 additions & 0 deletions src/assets/css/frontend/themes/colors.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@
".(!empty($v['theme_field_colors_top']) && !empty($v['theme_field_colors_bottom']) ? "background-image: -ms-linear-gradient(bottom, ".$v['theme_field_colors_top']." 25%, ".$v['theme_field_colors_bottom']." 100%);" : "")."
".(!empty($v['theme_field_colors_top']) && !empty($v['theme_field_colors_bottom']) ? "background-image: linear-gradient(to bottom, ".$v['theme_field_colors_top']." 25%, ".$v['theme_field_colors_bottom']." 100%);" : "")."
}
".$s.".super-int-phone_selected-dial-code {
".(!empty($v['theme_field_colors_font']) ? "color: ".$v['theme_field_colors_font'].";" : "")."
}
".$s.".super-int-phone_arrow {
".(!empty($v['theme_field_colors_font']) ? "border-top: 4px solid ".$v['theme_field_colors_font'].";" : "")."
}
".$s.".super-rating-star {
".(!empty($v['theme_rating_border']) ? "border: 1px solid ".$v['theme_rating_border'].";" : "")."
".(!empty($v['theme_rating_color']) ? "color: ".$v['theme_rating_color'].";" : "")."
Expand Down
5 changes: 3 additions & 2 deletions src/docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@

- [PDF Generator Add-on](https://renstillmann.github.io/super-forms/#/pdf-generator-add-on)

## May 28, 2022 - Version 6.3.2
## Jun 06, 2022 - Version 6.3.2

- **Improved:** Do not store `server_http_referrer_session` and/or `tags_values` as client data when not needed
- **Improved:** Do not store `server_http_referrer_session` and/or `tags_values` as client data when not needed, which could stress the database on high traffic websites
- **Fix:** `Listings` bug fix when leaving role settings empty (did not allow the user to view/edit/delete their own entries)

## May 04, 2022 - Version 6.3.1

Expand Down
20 changes: 15 additions & 5 deletions src/includes/extensions/listings/listings.php
Original file line number Diff line number Diff line change
Expand Up @@ -2418,7 +2418,16 @@ public static function super_listings_func( $atts ) {
public static function get_action_permissions($atts){
global $current_user;
$list = $atts['list'];
$entry = (isset($atts['entry']) ? $atts['entry'] : null);
$entry = (array) (isset($atts['entry']) ? $atts['entry'] : null);
$authorId = 0;
if(isset($entry)){
if(isset($entry['author_id'])){
$authorId = $entry['author_id'];
}
if(isset($entry['post_author'])){
$authorId = $entry['post_author'];
}
}

// Display listings (wether or not the listing should be generated/displayed to this user)
$allowDisplay = true;
Expand Down Expand Up @@ -2566,7 +2575,7 @@ public static function get_action_permissions($atts){
if(!empty($list['view_own']) && isset($entry)) {
if($list['view_own']['enabled']==='true'){
// First check if entry author ID equals logged in user ID
if(absint($current_user->ID) === absint($entry->author_id)){
if(absint($current_user->ID) === absint($authorId)){
$allowViewOwn = true;
}
}
Expand Down Expand Up @@ -2624,7 +2633,7 @@ public static function get_action_permissions($atts){
if(!empty($list['edit_own']) && isset($entry)) {
if($list['edit_own']['enabled']==='true'){
// First check if entry author ID equals logged in user ID
if(absint($current_user->ID) === absint($entry->author_id)){
if(absint($current_user->ID) === absint($authorId)){
// Check if both roles and user ID's are empty
if( (empty($list['edit_own']['user_roles'])) && (empty($list['edit_own']['user_ids'])) ){
$allowEditOwn = true;
Expand Down Expand Up @@ -2719,7 +2728,7 @@ public static function get_action_permissions($atts){
if(!empty($list['delete_own']) && isset($entry)) {
if($list['delete_own']['enabled']==='true'){
// First check if entry author ID equals logged in user ID
if(absint($current_user->ID) === absint($entry->author_id)){
if(absint($current_user->ID) === absint($authorId)){
// Check if both roles and user ID's are empty
if( (empty($list['delete_own']['user_roles'])) && (empty($list['delete_own']['user_ids'])) ){
$allowDeleteOwn = true;
Expand Down Expand Up @@ -2763,7 +2772,7 @@ public static function get_action_permissions($atts){
}
}
}
return array(
$return = array(
'allowDisplay' => $allowDisplay,
'allowSeeAny' => $allowSeeAny,
'allowViewAny' => $allowViewAny,
Expand All @@ -2773,6 +2782,7 @@ public static function get_action_permissions($atts){
'allowDeleteAny' => $allowDeleteAny,
'allowDeleteOwn' => $allowDeleteOwn
);
return $return;
}
}
endif;
Expand Down

0 comments on commit acd9376

Please sign in to comment.