-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtest.php
69 lines (50 loc) · 1.52 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
require_once('XenForoSDK.php');
$sdk = new XenForoSDK;
$loggedIn = $sdk->isLoggedIn();
if($loggedIn) {
echo 'Logged In';
} else {
echo 'Guest';
}
// Validate loing
$valid = $sdk->validateLogin('[email protected]', '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('[email protected]', '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);