'How to change user email in PHP Firebase using CORE PHP not any framework
I'm working on a project where I need to update the user email in firebase. I'm using core PHP for that as it is the requirement of the project.
I'm following the official documentation and I'm able to delete the user successfully but when it comes to updating the email of the user I'm unable to do that. Any assistance you can provide would be greatly appreciated.
Following is the code snippet:
<?php
if(isset($_post['update_user'])){
$user_id = $_POST['user_id'];
$email = $_POST['email'];
$updateData = [
'email' => $email,
];
$updatequery_result = $auth->changeUserEmail($user_id,$updateData);
if($updatequery_result){
header('Location:manage_user.php');
}
else{
header('Location: index.php');
}
}
?>
Please note that the user email and user id are coming from an input field. So both email and id are being received on the current page.
Solution 1:[1]
Try this:
$updatequery_result = $auth->changeUserEmail($user_id,$updateData['email']);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Obsidian |
