1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Maximum Guest Views by Waindigo [Deleted]

Discussion in 'Add-on Releases' started by Jon W, Jul 3, 2013.

  1. Jon W

    Jon W Well-Known Member

    Waindigo submitted a new resource:

    Maximum Guest Views by Waindigo - Limit the number of posts that guests and/or unconfirmed users can view before register/confirming.

    Read more about this resource...
     
    fEaRz likes this.
  2. DRE

    DRE Well-Known Member

    This wasn't working back when you posted it on XFShowcase. Is it working now?
     
  3. Jon W

    Jon W Well-Known Member

    All the add-ons that I am uploading now have been fully Waindigo-ified and tested on and optimised for both XenForo 1.1 and 1.2.
     
    D.O.A., Divvens and DRE like this.
  4. Moshe1010

    Moshe1010 Well-Known Member

    Is it possible to make a custom message for users with two levels? Level one message only to register at the top and level 2 complete block with a message?( Like vB?)
     
  5. Jon W

    Jon W Well-Known Member

    Not sure I understand -- although it has been a long night, so it is probably just me. Can you please explain with pictures? ;)
     
  6. DRE

    DRE Well-Known Member

    Oh YEAH IT'S WORKING!!! 5 STARS!
     
    Jon W likes this.
  7. Jon W

    Jon W Well-Known Member

    Lol at your review. You'll get me into trouble saying stuff like that!
     
  8. fEaRz

    fEaRz Member

    Good Work @Waindigo

    How does this plugin detects the number of pages views? With cookies or database?

    I dont know why, but it's not working with invalid users. I have marked both boxes.
     
    Jon W likes this.
  9. Jon W

    Jon W Well-Known Member

    Thanks. It uses cookies.

    Try replacing this code in library/Waindigo/MaxGuestViews/Extend/XenForo/Model/Thread.php:
    Code:
            //Set the cookies for users who haven't validated their accounts yet
            if (!isset($_COOKIE['invalid_views'])) {
                if (!self::$cookieSet) {
                    setcookie("invalid_views", "1");
                    self::$cookieSet = true;
                }
            } else {
                $invalid_views = $_COOKIE['invalid_views'] + 1;
                if (!self::$cookieSet) {
                    setcookie("invalid_views", $invalid_views);
                    self::$cookieSet = true;
                }
            }
    with:
    Code:
            //Set the cookies for users who haven't validated their accounts yet
            if (!isset($_COOKIE['invalid_views'])) {
                if (!self::$cookieSet) {
                    setcookie("invalid_views", "1", time() + 3600, "/");
                    self::$cookieSet = true;
                }
            } else {
                $invalid_views = $_COOKIE['invalid_views'] + 1;
                if (!self::$cookieSet) {
                    setcookie("invalid_views", $invalid_views, time() + 3600, "/");
                    self::$cookieSet = true;
                }
            }
     
  10. fEaRz

    fEaRz Member

    Still not working @Waindigo, if you need help to test i'm here all the night =)
     
    Jon W likes this.
  11. Jon W

    Jon W Well-Known Member

    I'm just about to head home. Will take a look tomorrow. Thanks for the offer though
     
    fEaRz likes this.
  12. Anthony Parsons

    Anthony Parsons Well-Known Member

    How does this affect bots such as Google, considering they're a guest pretty much.
     
    otto likes this.
  13. Moshe1010

    Moshe1010 Well-Known Member

    It works like this:
    1. Let's say you set view of 5 threads for level1. After a vistor enters 5 threads, it shows a message at the top of the board; custom message that you can edit through ACP. At level1, users don't get a complete block, they can still visit threads until level 2
    2. Then, you can set that after 10 threads level2 is activated and users are shown a message (again, custom through ACP) that they need to register. At this level, they are complete blocked, and they can also view the list of nodes/threads, but cannot enter a thread (it shows them the message again).

    You can set a timer for how long you want to block users (through ACP), and you can choose if you want to activate level 1, 2 or both. You can test here:
    http://www.theadminzone.com/forums/

    Try to visit about 5 threads, you will get to level 1. Then keep entering different threads, and you will get to level 2.

    Bots don't have cookies, so it doesn't affect them. However, a whitelist and bot detection as a backup would be appreciated.
     
    otto likes this.
  14. fEaRz

    fEaRz Member

    Hey @Waindigo, did you figured out the fix?
     
  15. Jon W

    Jon W Well-Known Member

    Not yet. I may just re-write that bit of code as counts for invalid users would probably be better being stored in the database instead of as cookies.
     
    fEaRz likes this.
  16. Jon W

    Jon W Well-Known Member

    RoldanLT likes this.
  17. fEaRz

    fEaRz Member

    @Waindigo Perfect!!! Great Work again!!!!
     
    Jon W likes this.
  18. fEaRz

    fEaRz Member

    @Waindigo on ACP -> Admin Log

    A lot of errors like this one below, when used with another plugin Login As User.

    ErrorException: Undefined index: is_robot - library/Waindigo/MaxGuestViews/Extend/XenForo/Model/Thread.php:22
     
  19. Jon W

    Jon W Well-Known Member

    What version of XenForo?
     
  20. fEaRz

    fEaRz Member

    1.1.5

    @Waindigo, The error occurs without the plugin also when you try to reply to a thread.

    Sometimes it opens a big red error box with the same message as Admin log.
     
    Last edited: Jul 6, 2013

Share This Page