示例#1
0
if (!empty($users)) {
    foreach ($users as $u) {
        showObject($u);
        echo '<hr/>' . "\n";
        break;
    }
    echo '<div style="color:#aa0000">NOTE: There are ' . (sizeof($users) - 1) . ' other users not shown</div>';
}
//create user tests
$CREATE = FALSE;
$DELETE_ID = '';
if ($CREATE) {
    //create an array of fields to create a user
    $creates = array('email' => '*****@*****.**', 'first_name' => 'Foo', 'last_name' => 'Bar', 'password' => 'password', 'password_confirmation' => 'password');
    //create the user
    $created = GoCoinAdmin::createUser($token, $creates);
    //show the created user
    echo '<h3 style="color:blue">Created User</h3>';
    showObject($created);
    //get the id to delete
    $DELETE_ID = $created->id;
}
if (!empty($DELETE_ID)) {
    //delete the user
    $deleted = GoCoinAdmin::deleteUser($token, $DELETE_ID);
    if ($deleted) {
        echo '<div style="color:#008800">User deleted successfully!</div>';
    } else {
        echo '<div style="color:#aa0000">Deletion failed!</div>';
    }
}