Got a problem with that mini-mod.
Guests could not post anything (in "Guild Application" forum), because posting use same validate_username() function, that we change in /includes/functions_validate.php
So, i realized that we should use different functions for posting and user registration.
Solution:
in /includes/functions_validate.php create one more validate_username() function via copy-paste. Rename one function to smth like validate_username_roster(). Make sure renamed function have "WoWRoster check" block, and delete it from origin function (if you already installed mod).
So now you have smth like that in /includes/functions_validate.php:
- Code: Select all
function validate_username($username)
{
global $db, $lang, $userdata;
$username = preg_replace('#\s+#', ' ', trim($username));
$username = phpbb_clean_username($username);
$sql = "SELECT username
FROM " . USERS_TABLE . "
WHERE LOWER(username) = '" . strtolower($username) . "'";
}
function validate_username_roster($username)
{
global $db, $lang, $userdata;
$username = preg_replace('#\s+#', ' ', trim($username));
$username = phpbb_clean_username($username);
$rostersql=" SELECT name
FROM roster_members
WHERE LOWER(name)='" . strtolower($username) . "'";
if ($result = $db->sql_query($rostersql))
{
if ($db->sql_numrows($result) < 1)
{
$db->sql_freeresult($result);
return array('error' => true, 'error_msg' => $lang['GuildMember_invalid']);
}
}
$db->sql_freeresult($result);
$sql = "SELECT username
FROM " . USERS_TABLE . "
WHERE LOWER(username) = '" . strtolower($username) . "'";
}
Then, open /includes/usercp_register.php, find line
"$result = validate_username($username);"
(aboult line #428) and replace with
"$result = validate_username_roster($username);".
Now, for registering we use function with wowroster check,
but for posting (/includes/functions_post.php) we use default function.