goldenpathsolutions / Password-Protect-Sections

WordPress Plugin that allows user to password protect sections of content within a post using a simple shortcode.
GNU General Public License v2.0
0 stars 0 forks source link

Can't have two password protected sections on the same page with ajax #1

Open pjackson1972 opened 9 years ago

pjackson1972 commented 9 years ago

Right now, we're not differentiating between different instances of the same password, so the content of each unlocked instance gets dumped into the block of all instances.

This only happens when unlocking with ajax. On refreshing the page, the correct content is inserted into the password-protected blocks. So, a simple fix is to disable ajax with the ajax='false' attribute.

I am tracking each shortcode instance in the default template, but need to make the Ajax JavaScript smart enough to use them.

Screenshot: Locked state with two instances of same password. Locked state with two instances of same password

Screenshot: Both content blocks inserted into both password blocks when using ajax. Creates duplicate insertions in the wrong locations Both content sections inserted into both password blocks when using ajax

Screenshot: After refresh, we see the expected behavior. Each content block is inserted into the correct password location. After refresh we see the expected behavior

pjackson1972 commented 9 years ago

Also note that when you re-lock on a page where the sections were duplicated erroneously, the locked content block is correspondingly duplicated for each content block.

locked state duplicated for each content block inserted