Support » Plugin: Gianism » Let social login users create their own usernames?

  • I enabled Yahoo! social login, then tested with my Yahoo account and noticed that when an external service user logs in, they’re given system generated long username which looks ugly…

    Would it be possible for a new user to create their own desired username upon user creation process from the plugin?

    http://wordpress.org/extend/plugins/gianism/

Viewing 1 replies (of 1 total)
  • Plugin Author Takahashi Fumiki

    (@takahashi_fumiki)

    I guess you are Japanese, so I write in Japanes. Sorry for that.

    管理画面にマニュアルがあるのですが(ユーザー > 外部連携 > 上級者向け)、ユーザーが登録を終えた時点のアクションが用意されています。

    Facebook、Yahooともにそうなのですが、OAuth連携時にWordPressのログイン名として使用できる情報(半角英数かつユーザーの名前っぽい情報)が取得できないので、このような仕様になっています。

    具体的なやり方はとしては、次の通りです。

    /**
     * SNS接続時に追加情報を保存する
     * @param int $user_id
     * @param mixed $data Inforamtioon provided from Service
     * @param string $service Service name(facebook, twitter, google, yahoo, mixi)
     * @param boolean $on_creation If user is newly created, true.
     */
    function _my_additional_info($user_id, $data, $service, $on_creation){
        global $wpdb;
        switch($service){
            case 'yahoo':
                $wpdb->update($wpdb->users,
                    array('user_login' => 'yahoo'.$user_id), //← ここでなにかログイン名を設定
                    array('ID' => $user_id),
                    array('%s), array('%d'));
                break;
        }
    }
    //Add hook. Don't forget to pass 4th argument(arguments length).
    add_action('wpg_connect', '_my_additional_info', 10, 4);
Viewing 1 replies (of 1 total)
  • The topic ‘Let social login users create their own usernames?’ is closed to new replies.