Jump to the post that solved this thread.
Solved: 4 Years, 1 Month ago Make custom profile field unique
#3
Solved: 4 Years, 1 Month ago
You need to edit member.php, probably at line 260 after CAPTCHA verification. The code roughly should be:

$unique_id = $db->escape_string($mybb->get_input('some_id')); // 'some_id' is form input field name

// target_id is database column name
$query = $db->query("
	SELECT target_id
	FROM ".TABLE_PREFIX."users
	WHERE target_id='{$unique_id}'
");
if($db->num_rows($query) > 0)
{
	$errors[] = "Provided {$some_id} is already in use!"; // $some_id is Field name description (example: 'discord username')
}

Note:
Code not tested but should work.
You need to make sure the desired column in users table exists and the form input field name and database column name are correct.
Reply
Jump to the post that solved this thread.


Messages In This Thread
Make custom profile field unique - by tvman99 - 2018-08-24, 02:53 AM
RE: Make custom profile field unique - by Wires - 2018-08-24, 05:04 AM
RE: Make custom profile field unique - by effone - 2018-08-24, 06:08 AM
RE: Make custom profile field unique - by tvman99 - 2018-08-24, 07:01 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)