サポート » 使い方全般 » wp_update_userの使用法

  • 解決済 emigre329

    (@emigre329)


    ログインユーザーのプロフィール変更フォームを任意で設置したいのですが
    wp_update_userの使い方を誤っていますでしょうか?
    それともほかのメソッドを使うのでしょうか?
    (下記のuser_lastnameはテストとして用いています)

    `
    <?php
    global $wpdb,$current_user;
    get_currentuserinfo();

    if( empty($_POST[‘user_lastname’]) == TRUE ) {
    ?>
    <form action=”<?php the_permalink(); ?>” method=”post”>
    <label for=”user_lastname”></label>
    <input type=”text” id=”user_lastname” name=”user_lastname” value=”TEST” />
    <input type=”submit” value=”送信”>
    </form>
    <?php
    } else {
    wp_update_user( array (‘ID’ => $current_user->id, ‘user_lastname’ => $_POST[‘user_lastname’]) ) ;
    }
    `

    よろしくお願いします。

2件の返信を表示中 - 1 - 2件目 (全2件中)
  • モデレーター jim912

    (@jim912)

    姓の変更をしたいのであれば、last_name です。

    トピック投稿者 emigre329

    (@emigre329)

    jim912さま

    お恥ずかしいかぎりです。動作しました
    ありがとうございました。

2件の返信を表示中 - 1 - 2件目 (全2件中)
  • トピック「wp_update_userの使用法」には新たに返信することはできません。