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/Admin.php';
  4.  
  5. $admin = new LiveUser_Admin($conf, 'FR');
  6. $custom = array(
  7.     array('name' => 'name',  'value' => 'asdf',             'type' => 'text'),
  8.     array('name' => 'email', 'value' => 'fleh@example.com', 'type' => 'text')
  9. );
  10.  
  11. $user_id = $admin->addUser('johndoe', 'dummypass', true, null, null, null, $custom);
  12. echo 'Created User Id ' . $user_id . '<br />';
  13.  
  14. if ($user_id > 2) {
  15.     $admin->removeUser(($user_id - 2));
  16.     echo 'Removed User Id ' . ($user_id - 2) . '<br />';
  17. }
  18.  
  19. if ($user_id > 1) {
  20.     $custom = array(
  21.         array('name' => 'name',  'value' => 'asdfUpdated',             'type' => 'text'),
  22.         array('name' => 'email', 'value' => 'fleh@example.comUpdated', 'type' => 'text')
  23.     );
  24.     $admin->updateUser($user_id, 'johndoe', 'dummypass', true, null, null, $custom);
  25.     echo 'Updated User Id ' . ($user_id - 1) . '<br />';
  26. }
  27.  
  28. $custom = array(
  29.     'name',
  30.     'email'
  31. );
  32.  
  33. $foo = $admin->getUser($user_id, $custom);
  34. if (empty($foo)) {
  35.     echo 'No user with that ID was found';
  36. } else {
  37.     print_r($foo);
  38. }
  39. echo '<br />';
  40.  
  41. $cols = array(
  42.     'name', 
  43.     'email'
  44. );
  45.     
  46. $filters = array(
  47.         'email' => array('op' => '=', 'value' => 'fleh@example.comUpdated', 'cond' => 'AND'),
  48.         'name'  => array('op' => '=', 'value' => 'asdfUpdated', 'cond' => '')
  49. );
  50. $foo1 = $admin->searchUsers($filters, $cols);
  51. echo 'These Users were found: <br />';
  52. print_r($foo1);
  53. ?>

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