[SMF 1.1] Undefined index: account_activate_method_14

Started by rsw686, January 30, 2008, 01:59:55 PM

Previous topic - Next topic

rsw686

I had to ban 3 of my members. When I view the profile of two of the banned members the following error shows in the error log.

8: Undefined index: account_activate_method_14
File: /home/reptilefile/public_html/forum/Sources/Profile.php
Line: 1316

I checked the database and the two users with the error show is_activated == 14. The other shows it == 11.

I would recommend a fix for this, but am unsure of what the values for is_activated mean. Could somebody give me a listing those values and their meanings?
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

karlbenson

Above 10 means banned.
Although the second digit after that can mean different things.
Such as the status at the time of banning.

4 is awaiting admin approval for account deletion.
So maybe 10+4.

rsw686

Quote from: karlbenson on January 30, 2008, 02:11:49 PM
Above 10 means banned.
Although the second digit after that can mean different things.
Such as the status at the time of banning.

4 is awaiting admin approval for account deletion.
So maybe 10+4.

Thats makes sense. I was confused as once the account is banned it not longer shows in the awaiting approval queue or gives the option to approve the deletion on the profile.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

SleePy

What is on line 1316?

Do you have mods installed.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

rsw686

Here is the line. Not sure why it shows the error since it checks to see if it is set first.


$context['activate_message'] = isset($txt['account_activate_method_' . $context['member']['is_activated'] % 10]) ? $txt['account_activate_method_' . $context['member']['is_activated']] : $txt['account_not_activated'];


The mods I have are either hand applied or custom mods that I wrote. However none are related to that section of code.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

SleePy

#5
I can see where an error would happen.
reported and for team reference is http://dev.simplemachines.org/mantis/view.php?id=1430
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

rsw686

#6
I see it too now. It's missing a % 10. Here's the fixed line.


$context['activate_message'] = isset($txt['account_activate_method_' . $context['member']['is_activated'] % 10]) ? $txt['account_activate_method_' . $context['member']['is_activated'] % 10] : $txt['account_not_activated'];
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

rsw686

This brings up another point. Since these members are banned their accounts aren't shown for deletion on the Members Admin section.

In Sources\ManageMembers.php this section (line 114) needs to be revised to include the % 10

foreach ($context['activation_numbers'] as $activation_type => $total_members)
{
if (in_array($activation_type, array(0, 2)))
$context['awaiting_activation'] += $total_members;
elseif (in_array($activation_type, array(3, 4, 5)))
$context['awaiting_approval'] += $total_members;
}


Replace with

foreach ($context['activation_numbers'] as $activation_type => $total_members)
{
if (in_array($activation_type % 10, array(0, 2)))
$context['awaiting_activation'] += $total_members;
elseif (in_array($activation_type % 10, array(3, 4, 5)))
$context['awaiting_approval'] += $total_members;
}


Along with line 559

$request = db_query("
SELECT COUNT(*)
FROM {$db_prefix}members
WHERE is_activated = $context[current_filter]", __FILE__, __LINE__);


Replaced with

$request = db_query("
SELECT COUNT(*)
FROM {$db_prefix}members
WHERE MOD(is_activated, 10) = $context[current_filter]", __FILE__, __LINE__);


And line

$request = db_query("
SELECT ID_MEMBER, memberName, emailAddress, memberIP, dateRegistered
FROM {$db_prefix}members
WHERE is_activated = $context[current_filter]
ORDER BY $_REQUEST[sort]" . (!isset($_REQUEST['desc']) ? '' : ' DESC') . "
LIMIT $context[start], $modSettings[defaultMaxMembers]", __FILE__, __LINE__);


Replaced with

$request = db_query("
SELECT ID_MEMBER, memberName, emailAddress, memberIP, dateRegistered
FROM {$db_prefix}members
WHERE MOD(is_activated, 10) = $context[current_filter]
ORDER BY $_REQUEST[sort]" . (!isset($_REQUEST['desc']) ? '' : ' DESC') . "
LIMIT $context[start], $modSettings[defaultMaxMembers]", __FILE__, __LINE__);
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

Advertisement: