SMF Support > SMF 2.0.x Support

Assigning member group based on correct code in custom field

(1/1)

darkstar128:
I'm implementing a forum where customers who are given a code are able to enter it into their profile in a custom field, then the code would be checked to see if it was correct and then the user would be added to the appropriate member group

Here is what I have so far


--- Code: ---   // determine if the user has a correct ebook code
   $eBookCode = $_POST['E-Book Customers']['status'];

  $customerMemberGroupID = "9"; // the test customer membergroup id

if($eBookCode == "XXXX")
{
$smcFunc['db_query']('', '
      UPDATE {db_prefix}members
      SET id_group = {int:new_group}
      WHERE id_member = {int:member}',
      array(
            'new_group' => $customerMemberGroupID,
            'member' => $memberID
      )
);
}

--- End code ---

Storman™:
Not a Support issue.

Think this post would be better off in the Coding Discussion board where you are more likely to receive the advice you need.

Navigation

[0] Message Index

Go to full version