Selecting Roles to Unlock Content

When published content is gated for viewing by Patreon level, it is also locked for all Wordpress roles except administrators. As an administrator, I see the following message:

This content is for Patrons only, it’s not locked for you because you are an Administrator

I would like my site editors to be able to see locked content, but do not want to elevate them all to admins. How can I expand the list of roles which are able to bypass the paywall to see posted content? Thanks for the help!

In the same manner which comments can be filtered, you can hook to the ptrn/lock_or_not filter, check for the role of a user and then turn off locking by modifying the $lock_or_not value.

I will keep trying until that advice makes sense! :joy:

In the meantime, here is what I found that worked:

  • I found a capability that aligned with the roles I wanted to bypass the paywall: edit_others_posts
  • I went through patreon_frontend.php and replaced every instance of current_user_can('manage_options') with current_user_can('edit_others_posts'). That ended up being on lines 984, 1145, 1506, 1549
  • I then made the same replacement in patreon_wordpress.php on line 1645

Those changes did what I wanted, and allowed my editors to see content published behind the paywall. I’m capturing the details because I’m sure I will have to reassert these changes if/when the plugin is updated. Or until I figure out how to hook into the filter as you described.

Thank you again!

Going the filter/hook route is always better and its the recommended way for modifying WP and plugin behavior in WordPress in general. So in the long run, it would be much better to take that route.