mgsisk / webcomic

Comic publishing power for the web. Turn your WordPress-powered site into a comic publishing platform with Webcomic.
http://wordpress.org/plugins/webcomic
GNU General Public License v2.0
110 stars 29 forks source link

Restricted Age/Role #322

Closed bluestockinger closed 6 years ago

bluestockinger commented 6 years ago

I've been trying to replicate Inkblot's restricted age/role in a custom theme for Webcomic, but I'm unsure of where Inkblot generates this. Even using Webcomic's Universal integration on a custom theme doesn't work when a comic is restricted. It just shows a blank page.

I've seen Inkblot's restricted-age.php and restricted-role.php template files, but how exactly does one go about implementing these on a custom theme? I've been right through the documentation and Inkblot's files. I also tried using webcomic_age_required() and webcomic_roles_required(), but this only seems to work when applied to a restricted comic page (and doesn't work when you click 'Yes' anyway), rather than on a comic itself.

When it's just a comic page that gets restricted, it works as Inkblot does, asking for age to be confirmed/stating that you don't have permission to view the comic. A related issue I seem to be having both with Inkblot and custom themes is, after clicking the link to confirm your age on an individual comic page, nothing happens... I get redirected to /confirm-age, but the comic page doesn't become viewable. Conversely, password protection works like a charm.

Any ideas as to how I might work through these points please?

Thanks in advance.

mgsisk commented 6 years ago

Hey @bluestockinger, apologies for the trouble. Inkblot itself might be causing a bit of confusion here: the way restricted content is handled changed between Webcomic 4 and Webcomic 5. The restricted templates in Inkblot are what Webcomic 4 used, and you can make Webcomic 5 use them by enabling the Compat component. Using Compat this way isn't recommended (unless you're actually using Inkblot), but it should work; turn on Compat, then create a restricted.php file inside of a webcomic directory in your theme (you should be able to copy the ones found in Inkblot and modify to taste). Webcomic 4 restrictions were also collection-wide, which is another difference when Compat is enabled; any page related to the restricted collection will be restricted.

Webcomic 5's restrictions are similar to password-protecting a post; they're comic-specific, and there's no dedicated restricted template that gets loaded in place of the usual theme template; Webcomic just blocks out the post content, comic media, and other assorted bits. I'm not sure what might be causing the /confirm-age endpoint to fail, unfortunately… I can't seem to duplicate this behavior on my dev box. What should happen is that, after clicking the "confirm your age" link, Webcomic will set a browser cookie to indicate the users age confirmation and send them to the actual comic page.

bluestockinger commented 6 years ago

Ohh, that makes sense, @mgsisk. I did have my suspicions that it might have been something specific to Inkblot/Webcomic 4, so thanks for the clarification. I won't bother enabling Compat, since I don't particularly want it one way or the other... I just was curious as to the difference in functionality.

Honestly, I don't know why /confirm-age doesn't work, as I figured it was just a cookie doing the work. All I can think is that there's some conflict on my end, as I'm developing locally.

All good and thanks again for the detailed explanation 👍