本文整理汇总了PHP中common\models\LoginForm::socialmediaInsert方法的典型用法代码示例。如果您正苦于以下问题:PHP LoginForm::socialmediaInsert方法的具体用法?PHP LoginForm::socialmediaInsert怎么用?PHP LoginForm::socialmediaInsert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common\models\LoginForm
的用法示例。
在下文中一共展示了LoginForm::socialmediaInsert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: successCallback
public function successCallback($client)
{
$attributes = (object) $client->getUserAttributes();
$clientClass = get_class($client);
$validUser = false;
switch ($clientClass) {
case "yii\\authclient\\clients\\Facebook":
if (isset($attributes->email)) {
$firstName = $attributes->first_name;
$lastName = $attributes->last_name;
$email = $attributes->email;
$accessToken = $attributes->id;
$providerId = 1;
$validUser = true;
}
break;
case "yii\\authclient\\clients\\GoogleOAuth":
if (isset($attributes->emails[0]['value'])) {
$firstName = $attributes->name['givenName'];
$lastName = $attributes->name['familyName'];
$email = $attributes->emails[0]['value'];
$accessToken = $attributes->id;
$providerId = 2;
$validUser = true;
}
break;
case "dektrium\\user\\clients\\Twitter":
if (isset($attributes->email)) {
$firstName = $attributes->first_name;
$lastName = $attributes->last_name;
$email = $attributes->emails;
$accessToken = $attributes->id;
$providerId = 3;
$validUser = true;
}
break;
default:
break;
}
$model = new LoginForm();
if ($email != '') {
$socialInfo = array();
$socialInfo['email'] = $email;
$socialInfo['firstName'] = $firstName;
$socialInfo['lastName'] = $lastName;
$socialData = $model->socialmediaInsert($socialInfo);
}
}