Ideally you should create a new config variable in the configuration table to store the membershipid you would like to make default. But htis example will allow you to set a customer as member rather than just an account holder with no membership.
In the file include/register.php you need to look for the lines.
foreach ($common_profile_fields as $field) {
if (isset(${$field}))
$profile_values[$field] = ${$field};
}After this add
if (!$is_anonymous && empty($old_userinfo)) {
$profile_values['membershipid'] = 1;
}This set the membership to 1.
If you set a value in a module you can use the following logic
if (!empty($config['my_module']['def_membershipid']) && !$is_anonymous && empty($old_userinfo)) {
//set the plan
if ($config['my_module']['def_membershipid'] > 0) {
$profile_values['membershipid'] = $config['my_module']['def_membershipid'];
}
}