Advertisement:
Anonymous Login
11-20-2017 11:18 PM

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002897SMF 3.0 "Saguaro"public2014-05-31 13:56
Reporterregularexpression 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
Summary0002897: Awaiting Activation - NOT shown on dropdown menu
Description7520:

Awaiting Activation tab is dependent on there being some members awaiting.
When there is, the tab is not listed on the dropdown menu (as you might expect).

See pic (for easy understanding)
TagsNo tags attached.
Attached Files
  • png file icon 03.png (51,715 bytes) 2009-01-12 20:16 -
    png file icon 03.png (51,715 bytes) 2009-01-12 20:16 +
  • diff file icon bug_2897.diff (2,577 bytes) 2009-06-07 15:29 -
    Index: Admin.php
    ===================================================================
    --- Admin.php	(revision 8593)
    +++ Admin.php	(working copy)
    @@ -67,6 +67,7 @@
     
     	// Load the language and templates....
     	loadLanguage('Admin');
    +	loadLanguage('ManageMembers');
     	loadTemplate('Admin', 'admin');
     
     	// No indexing evil stuff.
    @@ -80,6 +81,37 @@
     
     	require_once($sourcedir . '/Subs-Menu.php');
     
    +	// Get counts on every type of activation - for sections and filtering alike.
    +	$request = $smcFunc['db_query']('', '
    +		SELECT COUNT(*) AS total_members, is_activated
    +		FROM {db_prefix}members
    +		WHERE is_activated != {int:is_activated}
    +		GROUP BY is_activated',
    +		array(
    +			'is_activated' => 1,
    +		)
    +	);
    +	$context['activation_numbers'] = array();
    +	$context['awaiting_activation'] = 0;
    +	$context['awaiting_approval'] = 0;
    +	while ($row = $smcFunc['db_fetch_assoc']($request))
    +		$context['activation_numbers'][$row['is_activated']] = $row['total_members'];
    +	$smcFunc['db_free_result']($request);
    +
    +	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;
    +	}
    +
    +	// For the page header... do we show activation?
    +	$context['show_activate'] = (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 1) || !empty($context['awaiting_activation']);
    +
    +	// What about approval?
    +	$context['show_approve'] = (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 2) || !empty($context['awaiting_approval']);
    +
     	// Some preferences.
     	$context['admin_preferences'] = !empty($options['admin_preferences']) ? unserialize($options['admin_preferences']) : array();
     
    @@ -324,6 +356,8 @@
     					'subsections' => array(
     						'all' => array($txt['view_all_members']),
     						'search' => array($txt['mlist_search']),
    +						'approve' => array(sprintf($txt['admin_browse_awaiting_approval'], $context['awaiting_approval']), 'enabled' => $context['show_approve'], 'url' => $scripturl . '?action=admin;area=viewmembers;sa=browse;type=approve'),
    +						'activate' => array(sprintf($txt['admin_browse_awaiting_activate'], $context['awaiting_activation']), 'enabled' => $context['show_activate'], 'url' => $scripturl . '?action=admin;area=viewmembers;sa=browse;type=activate'),
     					),
     				),
     				'membergroups' => array(
    
    diff file icon bug_2897.diff (2,577 bytes) 2009-06-07 15:29 +

-Relationships
+Relationships

-Notes

bugnote:0006797

Nao/Gilles (Viewer)

Maybe the activation numbers are only calculated when you're in the member admin section? Which means it can't be inserted into the menu itself (which is built at Admin.php time).

bugnote:0006798

TE (Developer)

Last edited: 2009-01-13 03:05

Nao, that's the reason..

a possible solution:

in Admin.php

replace:
loadLanguage('Admin');

with:
loadLanguage('Admin');
loadLanguage('ManageMembers');

replace:
require_once($sourcedir . '/Subs-Menu.php');

with:
require_once($sourcedir . '/Subs-Menu.php');
require_once($sourcedir . '/ManageMembers.php');
ViewMembers();

replace:
                    'subsections' => array(
                        'all' => array($txt['view_all_members']),
                        'search' => array($txt['mlist_search']),

with:
                    'subsections' => array(
                        'all' => array($txt['view_all_members']),
                        'search' => array($txt['mlist_search']),
                        'approve' => array(sprintf($txt['admin_browse_awaiting_approval'], $context['awaiting_approval']), 'enabled' => $context['show_approve'], 'url' => $scripturl . '?action=admin;area=viewmembers;sa=browse;type=approve'),
                        'activate' => array(sprintf($txt['admin_browse_awaiting_activate'], $context['awaiting_activation']), 'enabled' => $context['show_activate'], 'url' => $scripturl . '?action=admin;area=viewmembers;sa=browse;type=activate'),

bugnote:0007962

regularexpression (Viewer)

I think the solution might be to store the amount as a variable like we do for unapproved members. Then we don't have to run the query on every admin page view.

bugnote:0008587

regularexpression (Viewer)

Last edited: 2009-06-07 16:21

Unfortunately the above solution won't work properly.
ViewMembers(); sets up extra tabs.

Copying the bits out of the function will work though.
I've attached a diff to do it.

I'm still not sure its the best way since these queries would be on every admin page. I do think it would be much better the total to be stored as a variable in settings_ table (aka $modSettings)

bugnote:0008878

[SiNaN] (Viewer)

I agree, it should be saved in $modSettings. Just sticking the query in updateStats() 'member' type should do it.

bugnote:0009103

regularexpression (Viewer)

* removed the "with fix" tag since its unlikely we'll be using my original patch. but i'll need to do something different.

bugnote:0015023

Antes (Team Member)

Fixed in SMF2.1
+Notes
MantisBT (Modified for SMF Intergration)[^] Copyright © 2000 - 2010 Mantis Group