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

XenForo SDK 0.0.1

Software Development Kit

  1. Vincent Gabriel
    Compatible XF Versions:
    • 1.2
    Visible Branding:
    No
    Simple SDK to allow using the XenForo Classes, Helpers, Templates etc.. outside of the XenForo Scope.

    Features:
    • Check if user is logged in
    • Login
    • Logout
    • Validate Login Information
    • Verify Username
    • Verify Email
    • Encrypt/Validate Passwords
    • Create Users
    • Get current user/visitor information
    • Get forum/forums (using ids or conditions)
    • Get thread/threads (using ids or conditions)
    • Render Public/Admin Templates
    • Get all options
    • Get single option
    Contribution/Suggestions are welcome. Please use the following repository for changes:
    https://github.com/VinceG/xenforo-sdk

    PHP:
    <?php

    require_once('XenForoSDK.php');
    $sdk = new XenForoSDK;

    $loggedIn $sdk->isLoggedIn();
    if(
    $loggedIn) {
        echo 
    'Logged In';
    } else {
        echo 
    'Guest';
    }

    // Validate loing
    $valid $sdk->validateLogin('test@test.com''password'$rememberMe$loginUserIfSuccessful);

    if(
    $valid !== true) {
        echo 
    $valid// will display the error
    }

    // Login user
    $user $sdk->login($userId$rememberMe); // no validation

    // Logout
    $sdk->logout();

    // Hash password
    $passwrod $sdk->setPassword('test123''passward_confirm'); // returns array scheme_class and data

    // Add new user
    $newUser $sdk->addUser('test@test.com''myusername''mypassword', array('someotherdata' => 'someothervalue'));
    if(
    is_object($newUser)) {
        
    // user was not created show error
        
    echo $newUser;
    } else {
        
    // user created, $newUser holds id
        
    echo 'New User ID: ' $newUser;
    }

    // Get all forums
    $forums $sdk->getForums();

    // Get one forum
    $forum $sdk->getForumById(2);

    // Get all threads
    $threads $sdk->getThreads(array()); // will show all so make sure to add conditions

    // Get one thread
    $thread $sdk->getThreadById(2);

    // Get current user
    $user $sdk->getUser();

    // Get other user info
    $user $sdk->getUser(2);

    // Get current visitor/session info
    $visitor $sdk->getVisitor();
    $session $sdk->getSession();

    // Get options/option
    $options $sdk->getOptions();
    $option $sdk->getOption($key);

    // Render public/admin template
    $output $sdk->renderPublicTemplate('template_name', array $params);
    $output $sdk->renderAdminTemplate('template_name', array $params);


Recent Reviews

  1. Dan Allen
    Dan Allen
    5/5,
    Version: 0.0.1
    A lot of people seem to like this and now I am one of them. Why didn't people send me here when I asked how to login and create members from an external php program?
  2. seojoseph
    seojoseph
    5/5,
    Version: 0.0.1
    Good Job! This will answer a lot of peoples questions. :)
  3. TBDragon
    TBDragon
    5/5,
    Version: 0.0.1
    thanks ^_^