Example of how to login to Tiki using some backend code
Used for integration with other PHP software residing on the same server and domain. This is really basic and may not do all that is required (e.g. check that account is not expired, prompt change password, direct the user to correct group homepage, set remember me, etc...), but it does log the user in.
<?php require_once 'tiki-setup.php'; $tikiuser = 'theusername'; // You would typically get the username information from the other application if (!$user && $userlib->user_exists($tikiuser)) { // first make sure that there is no current login and also that user exists $userlib->update_expired_groups(); $userlib->update_lastlogin($user); $_SESSION[$user_cookie_site] = $tikiuser; } header("Location: tiki-index.php"); // or any page you want in the Tiki
For example, the following script will log the current logged in Wordpress user (assuming that Wordpress is on the same domain but the Tiki is in a sub directory of where the Wordpress is):
<?php require_once 'tiki-setup.php'; // WP bootstrap require( '../wp-load.php' ); $current_user = wp_get_current_user(); if (!empty($current_user->user_login)) { $tikiuser = $current_user->user_login; // You would typically get the username information from the other application if (!$user && $userlib->user_exists($tikiuser)) { // first make sure that there is no current login and also that user exists $userlib->update_expired_groups(); $userlib->update_lastlogin($user); $_SESSION[$user_cookie_site] = $tikiuser; } } header("Location: tiki-index.php"); // or any page you want in the Tiki