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

directory.php - Shortcode pmpro_member_directory break DOM in table layout view #134

Open
Theodode opened this issue Oct 20, 2022 · 0 comments

Comments

@Theodode
Copy link

Visual symptoms :

Using the shortcode [pmpro_member_directory layout="table"] into an Elementor modal, all page footer declared styles and scripts are applied only when the modal is open. The WpAdmin Bar is also hidden until modal is open.

Coding bug description :

All html tags usually placed after the modal div tags are encapsulated into it.

Possible cause :

directory.php:596 - The closing bracket '}' at this line seems to close the layout else statement opened at line 458.
Because the closing bracket is after the directory div closing tag, when layout is set to table the directory div tag is not closed nor do_action executed.

Fix: Change the following code into directory.php:

589			endforeach;
590		?>
591		</div> <!-- end pmpro_member_directory -->
592		<?php
593
594		do_action( 'pmpro_member_directory_after', $sqlQuery, $shortcode_atts );
595		
596		}

To:

589			endforeach;
590		
591		}
592		?>
593		</div> <!-- end pmpro_member_directory -->
594		<?php
595
596		do_action( 'pmpro_member_directory_after', $sqlQuery, $shortcode_atts );

I tested the fix and it resolve the bug on my side but I am not sure if moving this closing bracket was the right way to fix. Convert the shortcode function to a class and separate HTML and PHP into different method could prevent this kind of bugs and facilitate debugging.

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

No branches or pull requests

1 participant