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

How to track/identify visitors?

Discussion in 'XenForo Development Discussions' started by Marcus, Jul 24, 2013.

  1. Marcus

    Marcus Well-Known Member

    How can I distinguish visitors? I thought about storing the initial IP address. Do you have any idea if there is a build-in solution for distinguishing users?
    PHP:
        $visitor XenForo_Visitor::getInstance()->toArray();
         
         
    ZEND_DEBUG::dump($visitor);
    PHP:
    array(48) {
      [
    "user_id"] => int(0)
      [
    "username"] => string(0""
      
    ["email"] => string(0""
      
    ["gender"] => string(0""
      
    ["language_id"] => int(0)
      [
    "style_id"] => string(1"3"
      
    ["timezone"] => string(13"Europe/London"
      
    ["visible"] => int(1)
      [
    "user_group_id"] => int(1)
      [
    "secondary_group_ids"] => string(0""
      
    ["display_style_group_id"] => int(1)
      [
    "permission_combination_id"] => int(1)
      [
    "message_count"] => int(0)
      [
    "conversations_unread"] => int(0)
      [
    "register_date"] => int(0)
      [
    "last_activity"] => int(0)
      [
    "trophy_points"] => int(0)
      [
    "alerts_unread"] => int(0)
      [
    "avatar_date"] => int(0)
      [
    "avatar_width"] => int(0)
      [
    "avatar_height"] => int(0)
      [
    "user_state"] => string(5"valid"
      
    ["is_moderator"] => int(0)
      [
    "is_admin"] => int(0)
      [
    "is_banned"] => int(0)
      [
    "like_count"] => int(0)
      [
    "dob_day"] => int(0)
      [
    "dob_month"] => int(0)
      [
    "dob_year"] => int(0)
      [
    "csrf_token"] => string(0""
      
    ["facebook_auth_id"] => int(0)
      [
    "custom_fields"] => string(0""
      
    ["show_dob_year"] => int(0)
      [
    "show_dob_date"] => int(0)
      [
    "content_show_signature"] => string(1"0"
      
    ["receive_admin_email"] => int(0)
      [
    "default_watch_state"] => string(0""
      
    ["is_discouraged"] => int(0)
      [
    "enable_rte"] => int(1)
      [
    "enable_flash_uploader"] => int(1)
      [
    "csrf_token_page"] => string(0""
      
    ["global_permission_cache"] => string(1918"a:6:{s:11:"profilePost";a:14:{s:9:"deleteAny";b:0;s:13:"hardDeleteAny";b:0;s:8:"undelete";b:0;s:7:"editAny";b:0;s:16:"approveUnapprove";b:0;s:13:"viewModerated";b:0;s:11:"viewDeleted";b:0;s:4:"view";b:1;s:4:"like";b:0;s:9:"manageOwn";b:0;s:4:"post";b:0;s:9:"deleteOwn";b:0;s:7:"editOwn";b:0;s:4:"warn";b:0;}s:6:"avatar";a:2:{s:11:"maxFileSize";i:0;s:7:"allowed";b:0;}s:7:"general";a:17:{s:13:"editSignature";b:0;s:4:"view";b:1;s:8:"viewNode";b:1;s:7:"viewIps";b:0;s:17:"bypassUserPrivacy";b:0;s:11:"viewProfile";b:1;s:6:"search";b:1;s:9:"cleanSpam";b:0;s:14:"maxTaggedUsers";i:0;s:11:"viewWarning";b:0;s:4:"warn";b:0;s:13:"manageWarning";b:0;s:11:"editProfile";b:1;s:15:"editCustomTitle";b:0;s:21:"followModerationRules";b:1;s:16:"bypassFloodCheck";b:0;s:6:"report";b:0;}s:5:"forum";a:26:{s:18:"stickUnstickThread";b:0;s:15:"manageAnyThread";b:0;s:10:"viewOthers";b:1;s:11:"viewContent";b:1;s:4:"like";b:0;s:10:"postThread";b:0;s:9:"postReply";b:0;s:15:"deleteOwnThread";b:0;s:13:"deleteOwnPost";b:0;s:11:"editOwnPost";b:0;s:20:"editOwnPostTimeLimit";i:0;s:18:"editOwnThreadTitle";b:0;s:14:"viewAttachment";b:0;s:16:"uploadAttachment";b:0;s:8:"votePoll";b:0;s:16:"approveUnapprove";b:0;s:13:"viewModerated";b:0;s:16:"lockUnlockThread";b:0;s:11:"viewDeleted";b:0;s:17:"hardDeleteAnyPost";b:0;s:11:"editAnyPost";b:0;s:19:"hardDeleteAnyThread";b:0;s:15:"deleteAnyThread";b:0;s:13:"deleteAnyPost";b:0;s:8:"undelete";b:0;s:4:"warn";b:0;}s:12:"conversation";a:7:{s:5:"start";b:0;s:11:"editAnyPost";b:0;s:12:"alwaysInvite";b:0;s:16:"uploadAttachment";b:0;s:11:"editOwnPost";b:0;s:20:"editOwnPostTimeLimit";i:0;s:13:"maxRecipients";i:0;}s:9:"signature";a:14:{s:9:"basicText";b:0;s:12:"extendedText";b:0;s:5:"align";b:0;s:4:"list";b:0;s:5:"image";b:0;s:4:"link";b:0;s:5:"media";b:0;s:5:"block";b:0;s:12:"maxPrintable";i:0;s:8:"maxLinks";i:0;s:8:"maxLines";i:0;s:9:"maxImages";i:0;s:10:"maxSmilies";i:0;s:11:"maxTextSize";i:0;}}"
      
    ["customFields"] => array(0) {
      }
      [
    "isTrusted"] => bool(false)
      [
    "referer"] => NULL
      
    ["from_search"] => bool(false)
      [
    "ignoredUsers"] => array(0) {
      }
      [
    "permissions"] => array(6) {
        [
    "profilePost"] => array(14) {
          [
    "deleteAny"] => bool(false)
          [
    "hardDeleteAny"] => bool(false)
          [
    "undelete"] => bool(false)
          [
    "editAny"] => bool(false)
          [
    "approveUnapprove"] => bool(false)
          [
    "viewModerated"] => bool(false)
          [
    "viewDeleted"] => bool(false)
          [
    "view"] => bool(true)
          [
    "like"] => bool(false)
          [
    "manageOwn"] => bool(false)
          [
    "post"] => bool(false)
          [
    "deleteOwn"] => bool(false)
          [
    "editOwn"] => bool(false)
          [
    "warn"] => bool(false)
        }
        [
    "avatar"] => array(2) {
          [
    "maxFileSize"] => int(0)
          [
    "allowed"] => bool(false)
        }
        [
    "general"] => array(17) {
          [
    "editSignature"] => bool(false)
          [
    "view"] => bool(true)
          [
    "viewNode"] => bool(true)
          [
    "viewIps"] => bool(false)
          [
    "bypassUserPrivacy"] => bool(false)
          [
    "viewProfile"] => bool(true)
          [
    "search"] => bool(true)
          [
    "cleanSpam"] => bool(false)
          [
    "maxTaggedUsers"] => int(0)
          [
    "viewWarning"] => bool(false)
          [
    "warn"] => bool(false)
          [
    "manageWarning"] => bool(false)
          [
    "editProfile"] => bool(true)
          [
    "editCustomTitle"] => bool(false)
          [
    "followModerationRules"] => bool(true)
          [
    "bypassFloodCheck"] => bool(false)
          [
    "report"] => bool(false)
        }
        [
    "forum"] => array(26) {
          [
    "stickUnstickThread"] => bool(false)
          [
    "manageAnyThread"] => bool(false)
          [
    "viewOthers"] => bool(true)
          [
    "viewContent"] => bool(true)
          [
    "like"] => bool(false)
          [
    "postThread"] => bool(false)
          [
    "postReply"] => bool(false)
          [
    "deleteOwnThread"] => bool(false)
          [
    "deleteOwnPost"] => bool(false)
          [
    "editOwnPost"] => bool(false)
          [
    "editOwnPostTimeLimit"] => int(0)
          [
    "editOwnThreadTitle"] => bool(false)
          [
    "viewAttachment"] => bool(false)
          [
    "uploadAttachment"] => bool(false)
          [
    "votePoll"] => bool(false)
          [
    "approveUnapprove"] => bool(false)
          [
    "viewModerated"] => bool(false)
          [
    "lockUnlockThread"] => bool(false)
          [
    "viewDeleted"] => bool(false)
          [
    "hardDeleteAnyPost"] => bool(false)
          [
    "editAnyPost"] => bool(false)
          [
    "hardDeleteAnyThread"] => bool(false)
          [
    "deleteAnyThread"] => bool(false)
          [
    "deleteAnyPost"] => bool(false)
          [
    "undelete"] => bool(false)
          [
    "warn"] => bool(false)
        }
        [
    "conversation"] => array(7) {
          [
    "start"] => bool(false)
          [
    "editAnyPost"] => bool(false)
          [
    "alwaysInvite"] => bool(false)
          [
    "uploadAttachment"] => bool(false)
          [
    "editOwnPost"] => bool(false)
          [
    "editOwnPostTimeLimit"] => int(0)
          [
    "maxRecipients"] => int(0)
        }
        [
    "signature"] => array(14) {
          [
    "basicText"] => bool(false)
          [
    "extendedText"] => bool(false)
          [
    "align"] => bool(false)
          [
    "list"] => bool(false)
          [
    "image"] => bool(false)
          [
    "link"] => bool(false)
          [
    "media"] => bool(false)
          [
    "block"] => bool(false)
          [
    "maxPrintable"] => int(0)
          [
    "maxLinks"] => int(0)
          [
    "maxLines"] => int(0)
          [
    "maxImages"] => int(0)
          [
    "maxSmilies"] => int(0)
          [
    "maxTextSize"] => int(0)
        }
      }
    }
     
  2. Nobita.Kun

    Nobita.Kun Well-Known Member

    Look like you var_dump Guest visitor.
    If visitor is member 'distinguishing users' is $visitor['user_id'] :)
     
  3. Marcus

    Marcus Well-Known Member

    I want to track users who are not logged in or are not registered at all
     
  4. James

    James Well-Known Member

    I don't think anything is built in, though it shouldn't be too hard to push the IP address into the visitor array.
     

Share This Page