Title: Timed access
Last modified: May 2, 2018

---

# Timed access

 *  Resolved [vladnice](https://wordpress.org/support/users/vladnice/)
 * (@vladnice)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/timed-access/)
 * Hello,
 * I would like to know if it is possible to grant access to all content to users
   who are not logged in, but just for a short period of time. After, x minutes,
   I would like all unlogged users to be redirected to a login page.
 * Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Joachim Jensen](https://wordpress.org/support/users/intoxstudio/)
 * (@intoxstudio)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/timed-access/#post-10255963)
 * Currently this is not supported out of the box, but it would be possible grant
   access to any user for a period of time with something like this:
 *     ```
       add_filter('rua/user/global-access', function($has_access, $user) {
           $temp_access_time = 5*60; //5 minutes
           if($user->ID > 0) {
               return $has_access;
           }
           if(!isset($_COOKIE["rua-limited-access-".$user->ID])) {
               setcookie("rua-limited-access-".$user->ID,time());
           } elseif($_COOKIE["rua-limited-access-".$user->ID] + $temp_access_time > time()) {
               $has_access = true;
           }
           return $has_access;
       });
       ```
   
 * Obviously this is a very simple method of doing it, and it could be improved 
   by storing the access in a database instead of a cookie.
 * I hope this helps!
 *  Thread Starter [vladnice](https://wordpress.org/support/users/vladnice/)
 * (@vladnice)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/timed-access/#post-10256182)
 * Thank you for your reply!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Timed access’ is closed to new replies.

 * ![](https://ps.w.org/restrict-user-access/assets/icon-256x256.png?rev=1815922)
 * [Restrict User Access - Ultimate Membership & Content Protection](https://wordpress.org/plugins/restrict-user-access/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/restrict-user-access/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/restrict-user-access/)
 * [Active Topics](https://wordpress.org/support/plugin/restrict-user-access/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/restrict-user-access/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/restrict-user-access/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [vladnice](https://wordpress.org/support/users/vladnice/)
 * Last activity: [8 years, 1 month ago](https://wordpress.org/support/topic/timed-access/#post-10256182)
 * Status: resolved