News:

Join the Facebook Fan Page.

Main Menu

Show member info

Started by GalaticNetwork, March 03, 2011, 02:56:31 PM

Previous topic - Next topic

GalaticNetwork

Hello im new to here and i recently installed sfm, and im trying to work out how i can pull the member info like name amount of posts ect. Can someone help me please?

Thanks
Time controlls everyone, if we could master time we could master anything.
_________________________________________
Where space folds into one :D

texasman1979

$user_info // ssi.php functions

elaborate more on what youa re doing and include your smf version.
SMF 2.0.4
SimplePortal 2.3.5

LOGIC is a FOUR letter word! :)


GalaticNetwork

Sorry, Im running 1.1.13 i've already intergrated <?php ssi_recentPosts($num_recent 4); ?> and also <?php
if ($context['user']['is_guest'])
{
ssi_login();
}
else
{
ssi_welcome();
ssi_logout();
}
?>
to my website, what i'm trying to do is make a member.php page, where if you are logged in, it will bring up all the user's info.

Thanks
Time controlls everyone, if we could master time we could master anything.
_________________________________________
Where space folds into one :D

Matthew K.

How would that be different from ?action=profile or ?action=profile;u=id?

GalaticNetwork

#4
My php understanding is pretty basic, well where ssi_welcome(); is there some what way of making it give me more info on that user? And maybe where to find a good php book so i can start learning more lol

Here is a photo

Pretty much what i want to do is get all that info and put it on my website without the theme just the info.

Thanks
Time controlls everyone, if we could master time we could master anything.
_________________________________________
Where space folds into one :D

Matthew K.

You can definitely accomplish that with PHP, but you'll need to know some...I'd check out two functions. loadMemberData and loadMemberContext. If I understand what you're trying to do, correctly, they would be very valuable functions to you.

For learning PHP, have you checked out the PHP Manual and w3schools?

GalaticNetwork

Quote from: Labradoodle-360 on March 03, 2011, 04:52:34 PM
I'd check out two functions. loadMemberData and loadMemberContext.
I've read about those functions i just need to learn to insert it so the theme doesn't appear on the page. No i havn't i will give them a google. Thanks
Time controlls everyone, if we could master time we could master anything.
_________________________________________
Where space folds into one :D


GalaticNetwork

Thank you i will check it out  :)
Time controlls everyone, if we could master time we could master anything.
_________________________________________
Where space folds into one :D

Matthew K.

Not a problem, if you have any questions, feel free to ask...

ascaland

You can even use just SMF's SSI functions to accomplish this.
ssi_welcome() - can return the $context['user'] array.
ssi_queryMembers() - will simply fetch member data which is exactly the same method as Labradoodle-360 posted above however its done for you. You can use ssi_fetchMember() to fetch a specific/group of member ids to retrieve data for without having to specify the queries yourself.

Matthew K.

Thanks for sharing that stuff. I'm really no expert on what is in SSI.php, although I probably should learn what's inside it sometime.
Quote from: Project Evolution on March 03, 2011, 05:12:58 PM
You can even use just SMF's SSI functions to accomplish this.
ssi_welcome() - can return the $context['user'] array.
ssi_queryMembers() - will simply fetch member data which is exactly the same method as Labradoodle-360 posted above however its done for you. You can use ssi_fetchMember() to fetch a specific/group of member ids to retrieve data for without having to specify the queries yourself.

ascaland

Quote from: Labradoodle-360 on March 03, 2011, 05:14:13 PM
Thanks for sharing that stuff. I'm really no expert on what is in SSI.php, although I probably should learn what's inside it sometime.

No prob. ;)

Matthew K.

I think the primary reason I've never learned it is because I have not one forum I run. I am just at SMF to help out with support, have fun, and develop mods for people.
Quote from: Project Evolution on March 03, 2011, 05:14:58 PM
Quote from: Labradoodle-360 on March 03, 2011, 05:14:13 PM
Thanks for sharing that stuff. I'm really no expert on what is in SSI.php, although I probably should learn what's inside it sometime.

No prob. ;)

GalaticNetwork

Quote from: Project Evolution on March 03, 2011, 05:12:58 PM
You can even use just SMF's SSI functions to accomplish this.
ssi_welcome() - can return the $context['user'] array.
ssi_queryMembers() - will simply fetch member data which is exactly the same method as Labradoodle-360 posted above however its done for you. You can use ssi_fetchMember() to fetch a specific/group of member ids to retrieve data for without having to specify the queries yourself.

Ahhh thanks alot i will intergrate that and give it a go.  :D
Time controlls everyone, if we could master time we could master anything.
_________________________________________
Where space folds into one :D

Matthew K.


Arantor

Um. Just loading SSI.php will load $context['user'], not that there's a great deal in it. ssi_welcome() literally just displays a welcome message, nothing more.

What you actually want to do is, after SSI.php is loaded:
global $context, $memberContext;
if ($context['user']['is_logged'])
{
  $return = loadMemberData($context['user']['id'], false, 'profile');
  if (!empty($return))
    loadMemberContext($context['user']['id']);
}


Then look to see if $memberContext[$context['user']['id']] exists and if it does, you have all the information you could want on your user.

ascaland

Quote from: Arantor on March 03, 2011, 05:24:03 PM
Um. Just loading SSI.php will load $context['user'], not that there's a great deal in it. ssi_welcome() literally just displays a welcome message, nothing more.

What you actually want to do is, after SSI.php is loaded:
global $context, $memberContext;
if ($context['user']['is_logged'])
{
  $return = loadMemberData($context['user']['id'], false, 'profile');
  if (!empty($return))
    loadMemberContext($context['user']['id']);
}


Then look to see if $memberContext[$context['user']['id']] exists and if it does, you have all the information you could want on your user.

Whats wrong with just loading member data with the other functions I listed..?

GalaticNetwork

Ok this is what i've done so far on a file called Test.php   <?php
require_once('forum/SSI.php');
$_SESSION['login_url'] = 'http://galaticnetwork.co.uk' $_SERVER['PHP_SELF'];
$_SESSION['logout_url'] = 'http://galaticnetwork.co.uk' $_SERVER['PHP_SELF'];
global 
$context$memberContext;
if (
$context['user']['is_logged'])
{
  
$return loadMemberData($context['user']['id'], false'profile');
  if (!empty(
$return))
    
loadMemberContext($context['user']['id']);
}
?>

Im stuck at this bit, <?php
if ($context['user']['is_guest'])
{
ssi_login();
}
else
{
ssi_welcome();
ssi_logout();
}
?>
do i need to add $memberContext[$context['user']['id']] Or ssi_fetchMember() sorry for being a noob
Time controlls everyone, if we could master time we could master anything.
_________________________________________
Where space folds into one :D

Arantor

QuoteWhats wrong with just loading member data with the other functions I listed..?

Well, you could construct the parameters necessary, only for ssi_queryMembers to do some stuff around deciding whether the member is a valid member or not, only for it to call loadMemberData and loadMemberContext, when you could save all the time and hassle because you know it's a genuine member (since they're logged in) and get it directly.

Quotedo i need to add $memberContext[$context['user']['id']] Or ssi_fetchMember() sorry for being a noob

Neither of those will magically just print out all the information you want, but both of them in their own way *get* the data. Since I don't know the HTML you plan to use to print it out, I can't help you with the display part - but if you use the code I posted, $memberContext[$context['user']['id']] has loads of stuff in it you can use to display. You tell me what it is you want to display and how it should look (ideally with the HTML code you wanted to use) and I'll put the PHP around it to make it work.

Advertisement: