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

How to develop XenForo add-ons?

Discussion in 'XenForo Development Discussions' started by Luxus, May 20, 2012.

  1. Luxus

    Luxus Well-Known Member

    Ok, I decided to learn how to write add-ons for XF. I tried this tutorial successfully: http://xenforo.com/community/threads/creating-an-addon.5416/

    The general way to create add-ons is very easy (the ACP stuff), but my question is, where do I get these fancy functions like

    public function actionAddThread()
    $username = $visitor['username'];


    Is there any documentation with all of XenForo's functions, variables and such? I mean if I want to write an add-on that checks how many likes a user recieved, from where do I get the function besides browsing through all of XenForo's core file and looking for some strings that make sense?

    I have experience with MyBB and was able to make my own small mods solely due to a list of available functions and examples. This is something what I miss for XF.
    sbj likes this.
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    If you want to check the current logged in user then you can use the visitor object:

    $visitor = XenForo_Visitor::getInstance();
    $likes = $visitor['like_count'];
    Or use the user model to fetch the user record for a specific user:

    $userModel = XenForo_Model::create('XenForo_Model_User');
    $user = $userModel->getUserByName('name here');
    $likes = $user['like_count'];
  3. Luxus

    Luxus Well-Known Member

    That's exactly what I mean. From where did you get those variables?
  4. Syndol

    Syndol Guest

    I think many here are confused as to what exactly it is you are asking since we do not know your level of knowledge.
    You will find most action related functions in the library/XenForo/ControllerPublic folder, while most database related functions are located in the library/XenForo/Model folder.
    OakleyForum, Luxus and Lycaon like this.

Share This Page