1
redheadedrod
Looking to get current user information and some fields from user profile.

Ok, I am hoping someone can help me here real quick.

I want to tie some things into xroster and to do so I need the logged in user name and I need to read in some fields from the user profile. Then I will be done with what I am doing with this for now and can start on my next project.

I haven't had to do this before so I am unsure how to accomplish this task.

I am using 2.4.5 xoops and I do NOT have the profile module installed so I am just using the core profile.

Thanks!

Rodney


2
ghia
Re: Looking to get current user information and some fields from user profile.
  • 2011/1/23 9:08

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


See this.

3
redheadedrod
Re: Looking to get current user information and some fields from user profile.

Thanks, that gets me the information I need from the user database. However I need to know who the logged in user is. All information I will be pulling from the database will be dependent on the person who is logged in.

I am guessing this is a simple matter but was not able to find it in a search.

Rodney

4
iHackCode
Re: Looking to get current user information and some fields from user profile.

yea you got to use the $xoopsUser variable.

if that variable is an object then the user is logged in.

https://xoops.org/modules/mediawiki/index.php/Dev:%24xoopsUser

http://dev.xoofoo.org/dev_xoops_250/d2/df5/a00137.html
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

5
redheadedrod
Re: Looking to get current user information and some fields from user profile.

Thank you, that gives me enough to go on so I can hopefully pull up everything I need.

If I have further issues with it I will mention them here otherwise I will likely mention when I have it done.

Rodney

6
redheadedrod
Re: Looking to get current user information and some fields from user profile.

Ok for some reason this is harder then I thought.. Although I am sure once I see how it is done it will be alot easier...


global $xoopsUser
    if (
is_object($xoopsUser)) {
       echo 
"Logged in";
       echo 
$xoopsUser->email;
    }



If I do this it will echo the "Logged in" when I am logged in but that is as far as I get?

The stuff you guys have pointed out don't seem as clear as they could be?

Guess I will have to poke through some code and see if I can find it somewhere.

There was some information in there I CAN use with this too.. But I want to pull up the current logged in users name, uname, and probably email.

I am missing something...


7
zyspec
Re: Looking to get current user information and some fields from user profile.
  • 2011/1/24 4:44

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


echo $xoopsUser->email;


should be:
echo $xoopsUser->getVar('name') . '';
echo 
$xoopsUser->getVar('uname') . '';
echo 
$xoopsUser->getVar('email') . '';

8
redheadedrod
Re: Looking to get current user information and some fields from user profile.

Thanks, will try this when I get home.


9
redheadedrod
Re: Looking to get current user information and some fields from user profile.

Cool, that worked!
Thanks zyspec.

That will do all I wanted to do with the user side.


Now I need to get an array of all the users that are members of a couple of groups for the admin side.

But I think the links that were listed above will head me in the right direction for those.

Thinking it would be as simple as a query.

Then I also want to be able to add someone to a group or take them out of the group as well but I think I can get this stuff from the "groups" module.

10
redheadedrod
Re: Looking to get current user information and some fields from user profile.

I am curious about one thing though as I see it in other places for other variables too.

With the line....

global $xoopuser;


What is this actually doing? Is there a $GLOBALS[xoopsuser] variable and by declaring it like this above it allows me to use it as a normal variable?

Just trying to understand the reason as the books I have read didn't really touch on this usage.

Thanks!

Rodney

Login

Who's Online

421 user(s) are online (305 user(s) are browsing Support Forums)


Members: 0


Guests: 421


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits