There is something is wrong with my delete function or i do not know what i have missed.
The id of the user is stored in both User (struct) and userIds (array) and i want to be able to delete the id from userIds and the entire user(id, userInfo, userData;) from my block chain. my current function does not really delete the user :(
function delete_user_byId(uint _id) public returns(uint[]) {
if (_id >= userIds.length) return;
for (uint i = _id; i<userIds.length-1; i++){
userIds[i] = userIds[i+1];
}
delete users[_id];
delete userIds[userIds.length-1];
userIds.length--;
return userIds;
}