本文整理汇总了PHP中CUtil::setUserCode方法的典型用法代码示例。如果您正苦于以下问题:PHP CUtil::setUserCode方法的具体用法?PHP CUtil::setUserCode怎么用?PHP CUtil::setUserCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtil
的用法示例。
在下文中一共展示了CUtil::setUserCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserDetails
public static function getUserDetails($user_id)
{
$user_fields = \Config::get('webshoppack::user_fields');
$user_id_field = \Config::get('webshoppack::user_id_field');
$user_table = \Config::get('webshoppack::user_table');
$user_details = array();
$fields = '';
foreach ($user_fields as $key => $field) {
if ($fields != '') {
$fields .= ', ';
}
$fields .= $field . ' AS ' . $key;
}
$user_info = \DB::select('SELECT ' . $fields . ' FROM ' . $user_table . ' WHERE ' . $user_id_field . ' = \'' . $user_id . '\'');
if (count($user_info) > 0) {
foreach ($user_info as $user_det) {
$user_details['user_code'] = CUtil::setUserCode($user_id);
if (isset($user_det->fname)) {
$user_details['first_name'] = $user_det->fname;
}
if (isset($user_det->lname)) {
$user_details['last_name'] = $user_det->lname;
}
if (isset($user_det->email)) {
$user_details['email'] = $user_det->email;
}
if (isset($user_det->fname) && isset($user_det->lname)) {
$user_details['display_name'] = ucfirst($user_det->fname) . ' ' . ucfirst(substr($user_det->lname, 0, 1));
}
}
}
$user_details['profile_url'] = \URL::to(\Config::get('webshopauthenticate::uri')) . "/" . $user_details['user_code'];
//."-". strtolower(str_replace(" ","", $user_details['first_name']));
return $user_details;
}
示例2: fetchUserDetails
public function fetchUserDetails($ident, $type)
{
$search_cond = 'users.user_id = ' . $ident;
if ($type == 'code') {
$search_cond = 'users.user_code = ' . $ident;
}
$user_details = array();
$user_details['err_msg'] = '';
$user_details['own_profile'] = 'No';
$udetails = User::whereRaw($search_cond)->first(array('users.first_name', 'users.id', 'users.last_name', 'users.email', 'users.activated', 'users.activated_at'));
if (count($udetails) > 0) {
$user_details['user_code'] = CUtil::setUserCode($udetails['id']);
$user_details['email'] = $udetails['email'];
$user_details['user_id'] = $user_id = $udetails['id'];
$user_details['first_name'] = $udetails['first_name'];
$user_details['last_name'] = $udetails['last_name'];
$user_display_name = $udetails['first_name'] . ' ' . substr($udetails['last_name'], 0, 1);
$user_details['display_name'] = ucwords($user_display_name);
$user_details['activated_at'] = $udetails['activated_at'];
$user_details['activated'] = $udetails['activated'];
} else {
$user_details['err_msg'] = 'No such user found';
}
return $user_details;
}