MyBB Community Forums

Full Version: [F] Mod-CP - Edit User & Birthday [C-Chris W B.]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
When you edit a user in the mod-cp and you set no birthday, you get this error:
Quote:The birthday you entered is invalid. Please enter a valid birthday or leave the field empty.
That seems like the standard behavior.
(2009-06-28, 12:41 PM)Ryan Gordon Wrote: [ -> ]That seems like the standard behavior.
But it does not make sense. A user is not forced to enter his birthday and you cannot know the birthday dates of all your users.
But it is not possible anymore to edit a user without setting a birthday...
See: http://community.mybboard.net/thread-50833.html

The suggested fix means that if a user doesn't enter a birthday, then an error appears. This error will also happen in the userCP when a user edits a profile (although haven't checked, it should do). In ./inc/datahandlers/user.php, find:

// Error if a day and month exists, and the birthday day and range is not in range
if($birthday['day'] < 1 || $birthday['day'] > 31 || $birthday['month'] < 1 || $birthday['month'] > 12 || ($birthday['month'] == 2 && $birthday['day'] > 29))
{
	$this->set_error("invalid_birthday");
	return false;
}

...and replace it with:

// Error if a day and month exists, and the birthday day and range is not in range
if($birthday['day'] != 0 || $birthday['month'] != 0)
{
	if($birthday['day'] < 1 || $birthday['day'] > 31 || $birthday['month'] < 1 || $birthday['month'] > 12 || ($birthday['month'] == 2 && $birthday['day'] > 29))
	{
		$this->set_error("invalid_birthday");
		return false;
	}
}

That should return the modCP and edit profile (userCP) to the normal behaviour.
I don't think that is a good fix. The User CP should get an error and the Mod CP shouldn't. You can check the "THIS_SCRIPT" define for "modcp.php".
Uhm, not to be a snipe or anything, but why should moderators be able to set a birthday incorrectly? They could technically, and inadverently, still cause the original bug the fix is for.

Changing the first line:

if(THIS_SCRIPT == "usercp.php" && ($birthday['day'] != 0 || $birthday['month'] != 0))
But I don't want to enter my birthday in User-CP, too...
Unless there's any objections, I'll go with the fix I mentioned (http://community.mybboard.net/thread-520...#pid367631).

This means that Bug #50833 is resolved properly. As Stefen mentions, under the current "fix", a user *must* enter a birthday into their profile, so the error must only appear if the user (or mod) is entering a birthday and it is invalid (as apposed to not entering anything and still getting the error).
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group
Pages: 1 2