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

Source for file admin_example_mdb.php

Documentation is available at admin_example_mdb.php

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

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