如何在phpfox中获取当前用户数据 [英] how to fetch the current user data in phpfox

查看:90
本文介绍了如何在phpfox中获取当前用户数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

主题:从数据库中获取当前用户(某些特定字段)数据并将其显示在欢迎"屏幕上.

Topic: Fetch current user(some particular fields) data from the DB and display it on the Welcome Screen.

UI的说明:在注册页面上,将显示一个下拉列表.当用户选择一个选项时,它将触发一个事件以获取用户图像以显示在欢迎页面上.

Explaination of UI : On the Registration Page, A dropdown would appear. As the user selects an option, it would trigger an event to fetch user image to show on the welcome page.

我在(pages.process)模块中放置了以下代码

I have put following code in (pages.process) module

  function getUserId($iUserId)
        {
        $aRows = $this->database()->select('p.image_path')->from($this->_sTable, 'p')
->Join(Phpfox::getT('user') , 'u', ' p.page_id = u.college_name') -> 
        where('u.college_name = p.page_id AND u.user_id = ' . 
    (int)$iUserId)->execute('getRows');
            return $aRows;
            }

数据将从用户&用户"中选择Pages Table,并将用于显示用户图像.请提出建议.

The data will selected from User & Pages Table, and will be used to show the user image. Please suggest.

推荐答案

有一项服务可以通过is获取用户详细信息

There is a service to get user details by is

$user_id = Phpfox::getUserId();
$aRow  = Phpfox::getService('user')->getUser($user_id);

这将为您提供用户详细信息

This will give you user details

这篇关于如何在phpfox中获取当前用户数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆