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

Using XenForo_Model_User functions in static function?

Discussion in 'XenForo Development Discussions' started by SirWill, Jan 16, 2016.

  1. SirWill

    SirWill Member


    I have an cron job which requires a static method but I would like to use the XenForo_Model_User functions there to get the user by id.

    Is there any way to do that or would I need to create my own query to get the user?
  2. Chris D

    Chris D XenForo Developer Staff Member

    Shouldn't be a problem. You can instantiate the user model like this:
    $userModel XenForo_Model::create('XenForo_Model_User');
    SirWill likes this.
  3. SirWill

    SirWill Member

    Ahh, thanks. That works. :)

Share This Page