Skip to content

Instantly share code, notes, and snippets.

@eric-pommereau
Created December 26, 2013 11:40
Show Gist options
  • Save eric-pommereau/8132715 to your computer and use it in GitHub Desktop.
Save eric-pommereau/8132715 to your computer and use it in GitHub Desktop.
Simple hack for PHPBB3 --> use email (first part) instead of manual username.
// Edit file includes/ucp/ucp_register.php
$emailParts = explode("@", strtolower(request_var('email', '')));
if(count($emailParts)>1) {
$userName = $emailParts[0] . "-" . substr($emailParts[1], 0,3);
}else {
$userName = utf8_normalize_nfc(request_var('username', '', true));
}
$data = array(
// 'username' => utf8_normalize_nfc(request_var('username', '', true)),
'username' => $userName,
'new_password' => request_var('new_password', '', true),
'password_confirm' => request_var('password_confirm', '', true),
'email' => strtolower(request_var('email', '')),
'email_confirm' => strtolower(request_var('email_confirm', '')),
'lang' => basename(request_var('lang', $user->lang_name)),
'tz' => request_var('tz', (float) $timezone)
);
// You can also edit cache/tpl_{$used_style}_ucp_register.html.php for hidding some fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment