문제

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

 }```
도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 wordpress.stackexchange
scroll top