How prevent direct access to PDF file

You cannot at the same time allow access to file (via embedding) and disallow access to file. That’s just not practical and you waste your time on holes. The comment is quite right that you would need to stream file from protected location for working access control. Even then if client-side viewer has access to … Read more

Restrict access to specific users

This should do it. Place it in your theme’s functions.php or a plugin. function tst($a) { if (!current_user_can(‘edit_posts’)) { wp_die(‘You are not allowed to view this page’); } } add_filter(‘template_redirect’,’tst’); You can still get to the login page like normal by going to “/wp-login.php” or “/wp-admin”. Alternately, you could use wp_safe_redirect or wp_redirect instead of … Read more

How to restrict a page [without plugin]

You can do this pretty easily with a shortcode. Hook into init and add the shortcode in your hooked function. <?php add_action(‘init’, ‘wpse57819_add_shortcode’); /** * Adds the shortcode * * @uses add_shortcode * @return null */ function wpse57819_add_shortcode() { add_shortcode(‘restricted’, ‘wpse57819_shortcode_cb’); } Then in your callback function, you can check to see if the user … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)