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

Retrieve from extern PHP XenForo infos

Discussion in 'XenForo Development Discussions' started by arsenik, Mar 11, 2015.

  1. arsenik

    arsenik Member

    Hi,

    I have done some sort of research on that but havent found much to be honest. I thought it would be simplier to ask here than start digging into XF's deep source code, but maybe it'll end up a necessity depending on the answers.

    I wonder how can I retrieve the registration IP and the confirmation IP of a user given his userid?
    Basically I'd like a function like
    GetConfirmationIP(userid)
    GetRegistrationIP(userid)

    And retrieve a string containing the IPs from these functions.

    Problem is that it looks a bit complicated on how to obtain that. Looks like the registration IPs are stocked in a MySQL BLOB, somewhere in xf_data_registry and keyname dnsBlCache, however I'm not sure how to extract the info's I want (I'm not even sure either that's the correct Key or anything).

    Note that I would retrieve this from an 'external' PHP script (i.e. not a xenforo addon, but still on the same host than my XF install). Is this possible?

    Thanks (to be clear what I wanna know is how to do the query)
     
    Last edited: Mar 11, 2015
  2. Daniel Hood

    Daniel Hood Well-Known Member

    Try:
    PHP:
    Zend_Debug::dump(XenForo_Model::create('XenForo_Model_User')->getRegistrationIps($userId));
     
  3. arsenik

    arsenik Member

    Daniel, thanks for the information. I wonder though, since this is an external PHP, which require_once should I do to be able to use those API functions.
    I would have preferred to be able to use a MySQL query for simplicity, but if it's not possible, I guess I'll stick to XF api.

    Basically, if you were to do a .php that is put directly in public_html, what modules should I include to be able to access the api (im not ultra familiar I must say
    with the inners of XF, usually when I messed with addons I was only modifying them or for my PHP, I only used queries so far to get what I wanted out of my forum)

    Thanks!
     
  4. arsenik

    arsenik Member

    Guys, I wanna revive this topic to know how to use the call.

    Basically, as said, I'm not calling this from a XenForo addon, so the Zend_Debug::dump call won't work since it's within XF.
    However is there a way I can use the call (given the fact, again, I call this from an external PHP, my own website stuff) with a require_once or something?

    And if not can this be done another way?

    I'm basically trying to get the country flag given a userid, that's my real objective. Thought I could use GeoIP against the registration IP, hence why I'm looking for the registration IP.
     
  5. Daniel Hood

    Daniel Hood Well-Known Member

    If you're including the XenForo library and can use XenForo_* classes, then you can also use the Zend_Debug one.
     

Share This Page