Custom registration help

Hey there,

I'm one of the developers for a XenForo Fourm, and i'm pretty new to PHP and backend systems in general. Im usually a front end dev.

Essentially what I'm trying to do is when users register to our Forum, they have to enter their 'Handle' and are given a randomly generated string. They are told to enter this string in their public facing user profile 'bio' on another forum connected to their handle. The registration process then needs to check the content of that public profile and confirm that the string either matches or exists.

The system then needs to assign the user to a group depending on the result of a value found in that users profile.

Both the 'bio' and the data value of the user is found through and API call through

This is the returned data:

Here is what I'm thinking:
note this is just sudocode really. Just mapping things out.
If ($bio == $string) {
[INDENT]//allow registration[/INDENT]
} elseif ($bio == null) {
[INDENT]//told to try again
// told to put a new generated string in bio[/INDENT]
} else {
[INDENT]echo "Some error Message";[/INDENT]

//System checks to see value of that data

if ($OrgType == main) {
[INDENT]//assign to user group 1[/INDENT]
} elseif ($OrgType == affiliate) {
[INDENT]//assign to user group 2[/INDENT]
} else {
[INDENT]//assign to user group 3[/INDENT]
Any ideas for how I could do this?