// Create a new profile category.
$cat1 = new stdClass();
$cat1->name = 'Example category';
- $cat1->sortorder = 1;
+ $cat1->sortorder = $DB->count_records('user_info_category') + 1;
$cat1->id = $DB->insert_record('user_info_category', $cat1);
// Trigger the event.
// Create new profile categories.
$cat1 = new stdClass();
$cat1->name = 'Example category';
- $cat1->sortorder = 1;
+ $cat1->sortorder = $DB->count_records('user_info_category') + 1;
$cat1->id = $DB->insert_record('user_info_category', $cat1);
$cat2 = new stdClass();
$cat2->name = 'Example category 2';
- $cat2->sortorder = 2;
+ $cat2->sortorder = $DB->count_records('user_info_category') + 1;
$cat2->id = $DB->insert_record('user_info_category', $cat2);
// Trigger the events.
// Create new profile categories.
$cat1 = new stdClass();
$cat1->name = 'Example category';
- $cat1->sortorder = 1;
+ $cat1->sortorder = $DB->count_records('user_info_category') + 1;
$cat1->id = $DB->insert_record('user_info_category', $cat1);
$cat2 = new stdClass();
$cat2->name = 'Example category 2';
- $cat2->sortorder = 2;
+ $cat2->sortorder = $DB->count_records('user_info_category') + 1;
$cat2->id = $DB->insert_record('user_info_category', $cat2);
// Trigger the event.
// Create a new profile category.
$cat1 = new stdClass();
$cat1->name = 'Example category';
- $cat1->sortorder = 1;
+ $cat1->sortorder = $DB->count_records('user_info_category') + 1;
$cat1->id = $DB->insert_record('user_info_category', $cat1);
// Create a new profile field.
// Create a new profile category.
$cat1 = new stdClass();
$cat1->name = 'Example category';
- $cat1->sortorder = 1;
+ $cat1->sortorder = $DB->count_records('user_info_category') + 1;
$cat1->id = $DB->insert_record('user_info_category', $cat1);
// Create a new profile field.
// Create a new profile category.
$cat1 = new stdClass();
$cat1->name = 'Example category';
- $cat1->sortorder = 1;
+ $cat1->sortorder = $DB->count_records('user_info_category') + 1;
$cat1->id = $DB->insert_record('user_info_category', $cat1);
// Create a new profile field.
$field1->signup = false;
$field1->visible = '0';
$field1->categoryid = $cat1->id;
- $field1->sortorder = 1;
+ $field1->sortorder = $DB->count_records('user_info_field') + 1;
$field1->id = $DB->insert_record('user_info_field', $field1);
// Create another that we will be moving.
$field2->datatype = 'text';
$field2->shortname = 'example2';
$field2->name = 'Example field 2';
- $field2->sortorder = 2;
+ $field2->sortorder = $DB->count_records('user_info_field') + 1;
$field2->id = $DB->insert_record('user_info_field', $field2);
// Trigger the events.
// Create a new profile category.
$cat1 = new stdClass();
$cat1->name = 'Example category';
- $cat1->sortorder = 1;
+ $cat1->sortorder = $DB->count_records('user_info_category') + 1;
$cat1->id = $DB->insert_record('user_info_category', $cat1);
$cat2 = new stdClass();
$cat2->name = 'Example category';
- $cat2->sortorder = 1;
+ $cat2->sortorder = $DB->count_records('user_info_category') + 1;
$cat2->id = $DB->insert_record('user_info_category', $cat2);
// Create a new profile field.
// Create a new profile category.
$cat1 = new stdClass();
$cat1->name = 'Example category';
- $cat1->sortorder = 1;
+ $cat1->sortorder = $DB->count_records('user_info_category') + 1;
$cat1->id = $DB->insert_record('user_info_category', $cat1);
// Create a new profile field.