Advertisement:

Author Topic: Custom profile fields in a global variable  (Read 1134 times)

Offline Alex4108

  • Jr. Member
  • **
  • Posts: 128
Custom profile fields in a global variable
« on: July 17, 2012, 12:16:44 AM »
Are the custom profile fields in any global variables I can get? 
Or do I have to use $smcFunc to pull them out of the database?

Offline CapadY

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,107
  • Gender: Male
Re: Custom profile fields in a global variable
« Reply #1 on: July 17, 2012, 03:45:54 AM »
take a look at $context[' user']
Please, don't PM me for support unless invited.
If you don't understand this, you will be blacklisted.

Offline Arantor

  • SMF Legend
  • *
  • Posts: 50,848
    • wedgebook on Facebook
Re: Custom profile fields in a global variable
« Reply #2 on: July 17, 2012, 06:55:18 AM »
Where are you trying to use these variables?

Offline Alex4108

  • Jr. Member
  • **
  • Posts: 128
Re: Custom profile fields in a global variable
« Reply #3 on: July 20, 2012, 02:06:02 AM »
take a look at $context[' user']

Did that, can't find them :(

Where are you trying to use these variables?
Sources/clanmgmt.php (A custom script)
Sources/Staff.php (Staff page mod)
and a few others

Offline CapadY

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,107
  • Gender: Male
Re: Custom profile fields in a global variable
« Reply #4 on: July 20, 2012, 02:47:51 AM »
Not ?

Try $context[' user_info']

I'm sure it's one of those two.
Please, don't PM me for support unless invited.
If you don't understand this, you will be blacklisted.

Offline Alex4108

  • Jr. Member
  • **
  • Posts: 128
Re: Custom profile fields in a global variable
« Reply #5 on: July 20, 2012, 03:20:41 AM »
Not ?

Try $context[' user_info']

I'm sure it's one of those two.

(A write in to index.template.php)
Code: [Select]
function template_html_above() {

global $context, $settings, $options, $scripturl, $txt, $modSettings;
        if (isset($_GET['debug']) && $context['user']['is_admin']) {

header("Content-type: text/plain"); // So our array is readable
global $user_info;
var_dump($user_info);
var_dump($context);
die();

}

I CTRL+F'd three times for three different custom values.  Didn't show up.

Offline Arantor

  • SMF Legend
  • *
  • Posts: 50,848
    • wedgebook on Facebook
Re: Custom profile fields in a global variable
« Reply #6 on: July 20, 2012, 09:08:23 AM »
So you're trying to look at the values of other peoples' custom fields rather than the current users, in which case no magic variable will help you and you'll have to go query the database yourself for the fields you want.

Namely querying smf_themes where id_member is the user id and the variable column is derived from the name of your field (begins with cust_)