Question

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!');

 }```
Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top