Global use of custom profile field

Discussion forum for MOD Writers regarding MOD Development.
Locked
Mai
Registered User
Posts: 12
Joined: Wed Sep 08, 2010 5:36 am

Global use of custom profile field

Post by Mai »

Hey everyone,

I'm currently using phpBB 3.0.7, and all is working fantastic.

I'm trying to take away some of the hump work though for some future mods of my own, and thus far...am not finding what I'm looking for in any of the files. Essentially, what I'm doing is having the user decide which page they want to see when they login to the forums first.

To do this, I've created a custom profile field, with the db field of "homepage." But, have just found that the $user->data variable does not retrieve data from the custom profile fields table. Since I need such a variable outside of the topics and profiles, this has kind of back handed my progress just a bit.

Is there a variable already in phpBB to call for custom profile fields on a global level, such as user data, if so what is the variable, as I've been unable to locate it? And if there isn't one, where might I locate the user variable's being defined so I can modify it accordingly?

Thanks. :)

Mai
Registered User
Posts: 12
Joined: Wed Sep 08, 2010 5:36 am

Re: Global use of custom profile field

Post by Mai »

Anyone got anything on this? I hate to sound relentless...

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51998
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Global use of custom profile field

Post by Brf »

Do this:

Code: Select all

$user->get_profile_fields( $user->data['user_id'] );
$user_fields = $user->profile_fields;
Then you can access$user_fields['pf_homepage']

Mai
Registered User
Posts: 12
Joined: Wed Sep 08, 2010 5:36 am

Re: Global use of custom profile field

Post by Mai »

Outstanding! Will try this tonight and get back to everyone.

Thanks very much. :)

Mai
Registered User
Posts: 12
Joined: Wed Sep 08, 2010 5:36 am

Re: Global use of custom profile field

Post by Mai »

That did the trick, thanks very much again! :)

neilsav
Registered User
Posts: 27
Joined: Tue Apr 20, 2010 3:16 am

Re: Global use of custom profile field

Post by neilsav »

In this code:

Code: Select all

$user_fields['pf_homepage']
Should 'pf_homepage' be replaced with the name of the custom profile field?

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51998
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Global use of custom profile field

Post by Brf »

Mai wrote: I've created a custom profile field, with the db field of "homepage."

Locked

Return to “[3.0.x] MOD Writers Discussion”