MyBB-Plugins Forums

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

I need to use a custom profile field in my MyBB 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'];
    $user_opt = $_POST['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:

PHP Code:
$q db->simple_select('userfields''fid4''fid='.(int)$user_info['uid']);
$field $db->fetch_field($q'fid4'); 

Should put the value of the field in $field. If it doesn't work, make sure $user_info actually has a proper uid.
I get this error when I do that:

PHP Parse error: syntax error, unexpected T_OBJECT_OPERATOR in DIR on line 41
Fixed it:
$useroptq = $db->query("SELECT fid4 FROM mybb_userfields WHERE ufid=". $user_id . "");
$user_opt = $db->fetch_array($useroptq, "fid4");
$user_opt = $user_opt["fid4"];

Thanks for your help. This forum is more helpful then the official mybb forum. You can Lock/Close thread.
Yeah there was a missing $ Wink
How would use a checkbox if statement so if FID4 was a checkbox how would you check if checked or if not checked?