itthinx / groups

Groups provides group-based user membership management, group-based capabilities and content access control. It integrates standard WordPress capabilities and application-specific capabilities along with an extensive API.
GNU General Public License v3.0
49 stars 35 forks source link

Bypass group control by server access #56

Closed Colir closed 9 months ago

Colir commented 8 years ago

Hi. First at all thanks for this pugin, so useful!

On my WP, user can download the page in pdf format using the WKHTMLTOPDF lib. The site is only accessible for registered user and some page need specific right managed with groups.

This work well. However i have trouble when i generateing a pdf from a page protect by the groups plugin (and this is normal)

Here is my code

function template_redirect() {
    global $post;

    if( ( $_SERVER['REMOTE_ADDR'] == $_SERVER['SERVER_ADDR'] ) && isset($_GET['wkhtmltopdf']) ) return;

}
add_action( 'template_redirect',  'template_redirect'  );

How i can tell to group that if the page is asked by the server itself, it can remove his control ?

thanks

Colir commented 7 years ago

please...

itthinx commented 9 months ago

The groups_post_access_user_can_read_post filter can be used to override the protection for that particular request. See https://docs.itthinx.com/document/groups/api/filters/ for details of that filter.