MyBB Community Forums

Full Version: add custom profile field data column to managegroup under group memberships
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to add in some custom profile field data in a new column where it lists the members of a group I Lead

Where it shows: Username, Contact, Pm, Registered date, posts and checkbox, I'd like to add something like their facebook page link in a column

I know I'd have to edit the managegroup_user template, but what would I add there to get my custom profile field data in, and is that all I'd have to do. Or would their be a .php file edit as well?

After looking through the managegroup.php file, it appears that it grabs all regular userinfo, but not custom profile fields. If you want custom profile fields you will need to alter the query it uses. In management.php find:
switch($db->type)
	{
		case "pgsql":
		case "sqlite":
			$query = $db->simple_select("users", "*", "','||additionalgroups||',' LIKE '%,".$mybb->input['gid'].",%' OR usergroup='".$mybb->input['gid']."'", array('order_by' => 'username'));
			break;
		default:
			$query = $db->simple_select("users", "*", "CONCAT(',',additionalgroups,',') LIKE '%,".$mybb->input['gid'].",%' OR usergroup='".$mybb->input['gid']."'", array('order_by' => 'username'));
	}

Replace with:
switch($db->type)
	{
		case "pgsql":
		case "sqlite":
			$query = $db->query("SELECT u.*,uf.* FROM users u
				LEFT JOIN ".TABLE_PREFIX."userfields
				ON (u.uid=uf.ufid)
				WHERE u.additionalgroups LIKE '%".$mybb->input['gid']." OR usergroup='".$mybb->input['gid']." ORDER BY u.username");
			break;

I'm not quite sure on what to put for the default case, but that might help.
I don't think the syntax is correct,

The default is what mybb is using on my board, so your code doesn't help me anyway.

Anybody else care to take a shot. It would really help me out
This is the correct query for those who are instrested

Thanks to those who helpedBig Grin

	$query = $db->query("
		SELECT u.*,f.*
		FROM ".TABLE_PREFIX."users u
		LEFT JOIN ".TABLE_PREFIX."userfields f ON (u.uid=f.ufid)
		WHERE CONCAT(',',u.additionalgroups,',') LIKE '%,".$mybb->input['gid'].",%' OR u.usergroup='".$mybb->input['gid']."'
        ORDER BY u.username ASC");
	}