LiveUser
[ class tree: LiveUser ] [ index: LiveUser ] [ all elements ]

Source for file admin_example.php

Documentation is available at admin_example.php

  1. <?php
  2. require_once 'config.inc.php';
  3. require_once 'LiveUser/Admin.php';
  4.  
  5. $increment = time();
  6.  
  7. $admin = new LiveUser_Admin($conf, 'FR');
  8. $custom = array(
  9.     'name'  => 'asdfDB',
  10.     'email' => 'fleh@example.comDB'
  11. );
  12.  
  13. $user_id = $admin->addUser('johndoe' . $increment, 'dummypass', null, true, null, null, null, $custom);
  14. echo 'Created User Id ' . $user_id . '<br />';
  15.  
  16. if (DB::isError($user_id)) {
  17.     var_dump($user_id);
  18. }
  19.  
  20. if (!DB::isError($user_id) && $user_id > 2) {
  21.     $echo_user_id = $user_id - 2;
  22.     $admin->removeUser($echo_user_id);
  23.     echo 'Removed Perm User Id ' . $echo_user_id . '<br />';
  24. }
  25.  
  26. if (!DB::isError($user_id) && $user_id > 1) {
  27.     $custom = array(
  28.         'name'  => 'asdfDBUpdated',
  29.         'email' => 'fleh@example.comDBUpdated'
  30.     );
  31.     $updated_id = $user_id - 1;
  32.     $admin->updateUser($updated_id, 'johndoe' . $increment, 'dummypass', null, true, null, null, $custom);
  33.     echo 'Updated User Id ' . $updated_id . '<br />';
  34. }
  35.  
  36. $foo = $admin->getUser($user_id);
  37. if (empty($foo)) {
  38.     echo 'No user with that ID was found';
  39. } else {
  40.     print_r($foo);
  41. }
  42. echo '<br />';
  43.  
  44. $filters = array(
  45.         'email' => array('name' => 'email', 'op' => '=', 'value' => 'fleh@example.comDBUpdated', 'cond' => 'AND'),
  46.         'name'  => array('name' => 'name',  'op' => '=', 'value' => 'asdfDBUpdated', 'cond' => '')
  47. );
  48. $foo1 = $admin->searchUsers($filters);
  49. echo 'These Users were found: <br />';
  50. print_r($foo1);
  51. ?>

Documentation generated on Mon, 11 Mar 2019 13:56:15 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.