'; $options = get_option( 'acpwd_settings_options' ); print_r($options); echo ''; */ ?>

'.__( 'Here you can set the options of Access Category Password plugin. Set a password, check the categories with restricted access (the posts in these categories will require a password authentication), check the users roles that don\'t need authentification to access these categories and define some strings used to inform the user on frontend page.', 'access-category-password' ).'

'; } } /** The password field **/ if( !function_exists('acpwd_func_password')) { function acpwd_func_password() { /* Get the option value from the database. */ $options = get_option( 'acpwd_settings_options' ); $password = (isset($options['password']) && $options['password'] != '') ? '' : 'acpwdpass' ; /* Echo the field. */ ?>

acpwdpass.', 'access-category-password' ); ?>

0)); foreach( $cats as $cat ) { ?> cat_ID, $impacted_categories)) echo ' checked'; ?> /> cat_name ?>

__('Administrator', 'access-category-password'), 'editor'=>__('Editor', 'access-category-password'), 'author'=>__('Author', 'access-category-password'), 'contributor'=>__('Contributor', 'access-category-password'), 'subscriber'=>__('Subscriber', 'access-category-password')); /* Echo the field. */ ?>
$role_info ) { ?> />

/>


'.__('Allowed tags:', 'access-category-password').' '. allowed_tags() ?>


'.__('Allowed tags:', 'access-category-password').' '. allowed_tags() ?>

classes you can see in the code below in your current theme stylesheet:', 'access-category-password' ) ?>
/style.css.

<div class="acpwd-container">
    <p class="acpwd-info-message">This content has restricted access, please type the password below and get access.</p>
    <form class="acpwd-form" action="" method="post">
        <input class="acpwd-pass" type="password" name="acpwd-pass">
        <input class="acpwd-submit" type="submit" value="Get access">
    </form>
    <p class="acpwd-error-message" style="color: darkred;">Sorry, but this is the wrong password.</p>
</div>

'.stripslashes($acpwd_options['error_message']).'

' : '

'.__('Sorry, but this is the wrong password.', 'access-category-password').'

'; $_SESSION['acpwd_session'] = 0; } } } add_action('init', 'acpwd_session_check', 2); /* Displaying the password form or the feed replacement sentence */ function acpwd_frontend_changes($content) { if (is_user_logged_in()) { $user = wp_get_current_user(); $u_roles = $user->roles; $u_role = $u_roles[0]; } else { $u_role = 'not logged in'; } $acpwd_options = get_option('acpwd_settings_options'); $impacted_categories = (isset($acpwd_options['impacted_categories'])) ? $acpwd_options['impacted_categories'] : array(); $allowed_users = (isset($acpwd_options['allowed_users'])) ? $acpwd_options['allowed_users'] : array(); if ( in_category($impacted_categories) ) { if ((isset($_SESSION['acpwd_session']) && $_SESSION['acpwd_session'] == 1) || (isset($acpwd_options['only_single']) && $acpwd_options['only_single'] == 1 && !is_single()) || in_array($u_role, $allowed_users)) { $content = $content; } else { if (is_feed()) { // Feed content replacement $content = stripslashes($acpwd_options['feed_desc_text']) ; } else { // Post or excerpt content replacement $content = '
'; $content .= (isset($acpwd_options['info_message']) && $acpwd_options['info_message'] != '') ? '

'.stripslashes($acpwd_options['info_message']).'

' : '

'.__('This content has restricted access, please type the password below and get access.', 'access-category-password').'

'; $content .= '
'; $content .= ''; $content .= (isset($acpwd_options['valid_button_text']) && $acpwd_options['valid_button_text'] != '') ? '' : ''; $content .= '
'; if (isset ($_POST['acpwd-msg'])) $content .= $_POST['acpwd-msg']; $content .= '
'; } } } return $content; } add_filter( 'the_content', 'acpwd_frontend_changes' ); add_filter( 'get_the_excerpt', 'acpwd_frontend_changes' ); ?>