Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a small content warning when trying to add the CSS body class dynamically. #3013

Merged
merged 3 commits into from
Jun 26, 2024

Conversation

andrewlimaza
Copy link
Contributor

  • BUG FIX: Fixed an issue in some cases where a warning would be shown when trying to dynamically add the membership level body CSS class.

NOTE: I cannot replicate this but I assume there is some sort of missing data/stray data in the database that's adding to the array. A customer was facing this issue on a specific page on their site.

All Submissions:

* BUG FIX: Fixed an issue in some cases where a warning would be shown when trying to dynamically add the membership level body CSS class.

NOTE: I cannot replicate this but I assume there is some sort of missing data/stray data in the database that's adding to the array. A customer was facing this issue on a specific page on their site.

The array would be `[1] => NULL` on dumping.
Copy link
Member

@dparker1005 dparker1005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my tests, $post_levels[1] looks to be an array of IDs and $post_level is just a level ID as a string. Therefore referencing $post_level[0] doesn't really make sense.

Maybe the solution here is to just rename the variable $post_level to be $post_level_id for clarity, and then to switch $classes[] = 'pmpro-body-level-' . $post_level[0]; to $classes[] = 'pmpro-body-level-' . $post_level_id;.

@dparker1005 dparker1005 added this to the 3.1 milestone Jun 19, 2024
@dparker1005
Copy link
Member

dparker1005 commented Jun 25, 2024

@andrewlimaza I just want to confirm, do you have any concerns about this new fix?

@andrewlimaza
Copy link
Contributor Author

This does fix the warning, thanks!

@dparker1005 dparker1005 merged commit d6a9135 into strangerstudios:v3.1 Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants