MyBB Community Forums

Full Version: Using Profile Fields
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I need to use a custom profile field in my plugin.  The id for the custom profile field is 4. It is a set of radio buttons one says: Yes? the other says No? They are to be used in a if statement. All the methods below don't work for some weird reason.

I have tried all of these:

$useroptq = $db->query("SELECT fid4 FROM mybb_userfields WHERE ufid=". (int)$user_info['uid']. "");
$user_opt = $db->fetch_array($useroptq);

$user_opt = $mybb->user['fid4'];

$user_opt = $userfields['fid4'];

$user_opt = $post['fid4'];

$user_opt = $_GET['profile_fields[fid4]'];

$user_opt = $GLOBALS['profile_fields']['fid4'];

if ($user_opt == "Yes?") {
  //Do Stuffs
}

I think i did the correct thing by adding this in the function?
global $mybb, $db, $user_info, $userfields;

This is what the database looks like:
[Image: loZNWrj.png]

Thanks,
Desgyz
Are you including global.php for the dbconnection info?