Login integration

From FUDforum Wiki
Jump to: navigation, search

FUDforum provides a login integration API that can be used to log users in from external applications (like wiki's and blogs) on to the forum.

To use the API, include the forum_login.php script into your project. This script can be found inside the forum's scripts/ directory.

Contents

Functions

This API provides the following functions:

external_get_user_by_auth

Lookup a forum $user_id from a username and password combination:

int external_get_user_by_auth  ( char $login, char $passwd )

Return a forum $user_id or NULL if the username and/or password is incorrect.

external_fud_login

Log a user into the forum.

int external_fud_login  ( int $user_id )

Return session id.

external_fud_status

Register what the user is busy doing in the forum's iSpy action list. This function was introduced with FUDforum 3.0.1.

void external_fud_status  ( char $action )

external_fud_logout

Log a user out from the forum.

void external_fud_logout  ( int $user_id )

Example

Example PHP script to authenticate 'user1/pass' against the forum database and log them on to the forum:

<?php
 ini_set('display_errors', 1);
 include_once('GLOBALS.php');
 include_once('forum_login.php');

 echo 'Authenticate against the forum DB.<br />';
 $user_id = external_get_user_by_auth('user1', 'pass');
 
 echo 'Login to forum.<br />';
 $ses_id = external_fud_login($user_id);
 
 echo 'Set action.<br />';
 external_fud_status('Busy doing laundry...');
 
 // echo 'Log the user out.<br />';
 // external_fud_logout($user_id);
 ?>

Also see

  • FUDAPI, additional functions to help you integrate your application with FUDforum.
Languages
Personal tools