Add value in user table when user is created
-
21-04-2021 - |
Frage
I am trying to insert a value into a column after a user registers.
Sadly after my test I get the error "Write Error" what could be wrong with the hook?
function org_teammember( $user_id ) {
$teammember = 'yes';
$sql = "INSERT INTO wp_usermeta (ocp_team_member)".
"VALUES('$user_id','$teammember')";
$result = mysqli_query($wpdb, $sql) or die('Write Error!');
}```
Lösung
Used the method of @geouser
Why don't you just use a function WordPress already has update_user_meta()? developer.wordpress.org/reference/functions/update_user_meta There is no need to write a custom SQL queries
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit wordpress.stackexchange