Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: Sverre on November 04, 2010, 08:11:47 AM

Title: [4529][2.0 RC4/Subs.php] member awaiting approval notice
Post by: Sverre on November 04, 2010, 08:11:47 AM
After upgrading my test forum from RC3 to RC4, the "There is one member awaiting approval." line in the header is displayed despite the fact that the approval queue is empty. It only seems to happen with the "Require admin approval when member deletes account" option checked.

No mods installed.

As far as I can tell, it is caused by the changes introduced in the following line (Revision 9916? (http://dev.simplemachines.org/mantis/view.php?id=4269)):

Code (Subs.php) Select
$context['unapproved_members'] = (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 2) || !empty($modSettings['approveAccountDeletion']) ? $modSettings['unapprovedMembers'] : 0;
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: Kolya on November 04, 2010, 09:27:47 PM
Same problem here after upgrading to RC4.
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: pitta on November 05, 2010, 03:51:27 AM
I've got the same error. I opened this error related to the topic

http://www.simplemachines.org/community/index.php?topic=407527.0
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: Jfdowim5 on November 07, 2010, 02:54:03 PM
Quote from: Sverre on November 04, 2010, 08:11:47 AM
It only seems to happen with the "Require admin approval when member deletes account" option checked.
Ditto.
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: NanoSector on November 07, 2010, 03:00:34 PM
Uncheck the option for now until a fix is found.
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: Brettflan on November 07, 2010, 11:50:04 PM
Same here on my test backup forum, with account deletion requiring admin approval set. I wasn't going to report it until I'd fully investigated it and come up with a good solution, but since this topic is already here... some screenshots:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg151.imageshack.us%2Fimg151%2F3677%2Fmemberapproval1.png&hash=b3ce766e98a1509c1762030322cc1f67268e8c4f)
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg836.imageshack.us%2Fimg836%2F7778%2Fmemberapproval2.png&hash=2973b67b041a1a4f54078172f7a03f6cc2f0dff0)

When I navigate somewhere else in the admin Manage Members section, the "Awaiting Approval" menu item disappears:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg824.imageshack.us%2Fimg824%2F1315%2Fmemberapproval3.png&hash=d8a3ff15a86fea9f6a2f696b0f6564c398eaa940)
If I set the registration method to "admin approval", that menu item always shows up. So, the code that determines whether to show that menu item should also be updated to show it if account deletion requires admin approval.

Is there some place where you can actually see a list of people who have requested account deletion? I haven't come across it anywhere, but I might well have just missed it.


I came to the same conclusion as Sverre on the cause of it showing up being that particular change in Subs.php, from this in RC3:
$context['unapproved_members'] = !empty($modSettings['registration_method']) && $modSettings['registration_method'] == 2 ? $modSettings['unapprovedMembers'] : 0;
to this in RC4:
$context['unapproved_members'] = (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 2) || !empty($modSettings['approveAccountDeletion']) ? $modSettings['unapprovedMembers'] : 0;


EDIT: I made a small mod package to revert that line of code for myself, so I figured I might as well share. It's attached to this post.

EDIT 2: also, I've reopened the report Sverre linked to and added a link back to this topic.

EDIT 3: attached package removed; better package with a more proper fix posted further down the thread.
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: pitta on November 08, 2010, 03:04:04 AM
my problem is solved, thanks
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: Kolya on November 08, 2010, 07:07:22 AM
Note that downgrading the relevant code is only a temporary fix, pitta.
Thank you for re-opening the issue in the bug tracker, Brett.
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: pitta on November 08, 2010, 08:18:30 AM
I am aware. thanks
Title: There are 2 members waiting activation (2.0 RC4)
Post by: dsanchez on November 08, 2010, 08:26:37 AM
this is the message I have in the Welcome area, however, when I clic on the link there are no members waiting for activations :o
Title: Re: There are 2 members waiting activation (2.0 RC4)
Post by: xenovanis on November 08, 2010, 08:31:30 AM
There's already been a report for that. Please see here:
http://www.simplemachines.org/community/index.php?topic=407686.0
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: dsanchez on November 08, 2010, 09:00:24 AM
Quote from: Kolya on November 04, 2010, 09:27:47 PM
Same problem here after upgrading to RC4.

Same here.
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: booch_21 on November 08, 2010, 09:21:17 AM
Oddly enough, I started to see this in RC3, before upgrading.  The error would occur when I either "Reject" or "Reject and Send Mail".  All other options would clear that flag and no message was displayed.
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: Aleksi "Lex" Kilpinen on November 08, 2010, 09:22:32 AM
I believe I have come across this one as well, but at the time I thought I just had some DB hickup - and forgot all about it.
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: [SiNaN] on November 09, 2010, 03:13:28 AM
As I said to Brettflan in private as well, I'm unable to reproduce this with a fresh RC4 install. If anyone is willing to provide me with temporary admin and database access via pm, I would be happy to investigate it further.
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: Aleksi "Lex" Kilpinen on November 09, 2010, 03:48:45 AM
Just checked, and this doesn't seem to happen on my install anymore either. Don't know what has changed.
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: Brettflan on November 09, 2010, 05:22:46 AM
Yeah, I tested it out further yesterday and new account deletion requests show up fine there, and can be handled without a hitch. The problem seems to be with old account deletion requests. The listed number of "awaiting approval" went from 73 -> 74 with the new account deletion request, though only the one new request showed up on the Awaiting Approval page, and the number went back down to 73 when I handled the new account deletion request.
As I told SiNaN, I'll investigate it further today (in a couple of hours or so) to find the cause and report back.
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: Jfdowim5 on November 09, 2010, 07:53:27 AM
シナン, you're welcome to fiddle about with mine if it's any help.  Quiet forum so I'm not sure how much use it would be.

Brettflan, that would seem to make sense.  I was wondering why your number was so much higher than mine.  I know that there's only been one account deleted by a member since I started the forum and mine does say that one approval is needed.
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: Brettflan on November 09, 2010, 09:45:30 AM
OK, I think I've found the problem (or at least, a problem). The 'unapprovedMembers' value is stored in the settings table, and only ever incremented or decremented normally. Even if you run through "Recount all forum totals and statistics", it only bothers to recalculate that value if the forum is set to require admin approval for account activation, not if the forum is set to require admin approval for account deletion. So, in our cases, that value is never recalculated.

I'm currently testing it with another runthrough of "Recount all forum totals and statistics" without modification (which I did run without success earlier, but I just want be sure), and then again with a modification to the apparent problem line 285 in Subs.php. If successful, I'll post back with the code change and a mod package for it. It could take a while though, since this is a large forum it's recalculating statistics on.

EDIT: I'll go ahead and post the problem line, it's currently this:
if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 2)
Based on the other change made for RC4, it should be this:
if ((!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 2) || !empty($modSettings['approveAccountDeletion']))
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: Brettflan on November 09, 2010, 10:31:06 AM
I was right. The above line needs to be updated. As for how the "unapprovedMembers" value got so far off track for us in the first place, I don't know.

For anyone who installed my package from earlier in the topic, you should uninstall it and use the new one attached to this topic.

EDIT: fix package received a further update, see page 2 for the final version of it attached to another post.
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: Kolya on November 09, 2010, 02:23:05 PM
Worked for me. Thank you Brettflan.
Title: RC4 - Curve theme
Post by: billy2 on November 09, 2010, 02:33:13 PM
Hi
I just cant clear the "new members awaiting approval" from top left.
There are no items in the  Administration Center > Members >  View All Members > Awaiting Approval,
yet 'two are awaiting' -  which I cannot clear.
I did remove a spamming members account the other day - but did not notice if this issue happened at that point.
I updated from RC3 to RC4 with no issues
I use both FF 3.6.12 and IE8

Please see attached screen shot
Cheers
Billy

**sorry just noticed other posts - unchecked the require admin approval and error has cleared**
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: booch_21 on November 09, 2010, 02:49:53 PM
I have placed that corrected code in.  Will report if I see it come up again.
Title: Re: RC4 - Curve theme
Post by: Norv on November 09, 2010, 04:16:48 PM
Hey there,

I believe Brett has attached a package helping to correct an issue with this here:
http://www.simplemachines.org/community/index.php?topic=407686.msg2845083#msg2845083
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: Jfdowim5 on November 09, 2010, 11:18:38 PM
I can't use the package since SMF's ftp option doesn't work for me.  The package doesn't show up despite having uploaded it manually to the right directory.  I know that I solved that once before, or at least it worked for a bit, but I can't recall how.

Editing it manually and then using the recount statistics function did get it to behave so I think that you might have cracked it.  :)
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: Brettflan on November 10, 2010, 12:22:10 AM
I just noticed that in hunting down that one problem, I somehow forgot about the other.  :P
To fix the "Awaiting Approval" menu link not showing up elsewhere in the Manage Members area, line 128 of ManageMembers.php:
$context['show_approve'] = (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 2) || !empty($context['awaiting_approval']);
should be:
$context['show_approve'] = (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 2) || !empty($context['awaiting_approval']) || !empty($modSettings['approveAccountDeletion']);

Attached is what should be the final version of my earlier fix package, which includes this additional fix.
Title: Re: [2.0 RC4/Subs.php] member awaiting approval notice
Post by: Jfdowim5 on November 10, 2010, 01:08:03 AM
Excellent.
Title: Re: RC4 - Curve theme
Post by: billy2 on November 10, 2010, 03:33:11 AM
Yes - thanks Norv
regards
Billy
Title: Re: [4529][2.0 RC4/Subs.php] member awaiting approval notice
Post by: marinesct on November 15, 2010, 10:38:16 PM
Thanks for the fix Brettflan!
Title: Re: [4529][2.0 RC4/Subs.php] member awaiting approval notice
Post by: holodoc on November 23, 2010, 10:24:05 AM
The package worked for me as expected and fixed the issue.
Title: Re: [4529][2.0 RC4/Subs.php] member awaiting approval notice
Post by: Norv on November 25, 2010, 05:18:41 AM
The Admin > Members > Awaiting Approval page should have a combo-box allowing to choose between the "Accounts awaiting approval" and "Accounts awaiting deletion".
The number in user information ("there are x members awaiting approval") should add up both.
That doesn't happen?
Title: Re: [4529][2.0 RC4/Subs.php] member awaiting approval notice
Post by: Brettflan on November 27, 2010, 05:48:45 AM
It works fine. It's just that with no members actually awaiting account deletion, those options weren't showing up (which is sensible enough). So when I was first seeing that screen, I saw no hint of the "awaiting approval" page actually supporting account deletion, particularly when navigating to other pages in that admin section and having the menu link to that page disappear.
Title: Re: [4529][2.0 RC4/Subs.php] member awaiting approval notice
Post by: booch_21 on November 29, 2010, 10:32:44 AM
After making the changes listed above, when I reject users, either with or without e-mail, the notification at the top continues to say that I have x number of members awaiting approval.  When I go into maintenance and do a recount of forum stats, this clears that notification and goes back to normal.  I originally thought that the notification issue was completely fixed, but this at least allows us to clear it.
Title: Re: [4529][2.0 RC4/Subs.php] member awaiting approval notice
Post by: Brettflan on November 29, 2010, 05:12:57 PM
Quote from: booch_21 on November 29, 2010, 10:32:44 AM
After making the changes listed above, when I reject users, either with or without e-mail, the notification at the top continues to say that I have x number of members awaiting approval.  When I go into maintenance and do a recount of forum stats, this clears that notification and goes back to normal.  I originally thought that the notification issue was completely fixed, but this at least allows us to clear it.
Are you sure you have all of the changes? I've had the above package (with all changes) installed on the TaleWorlds forum, and we've had account deletion requests show up several times now. The number has been updated correctly each time as they show up and the accounts are then deleted.

EDIT: though re-reading your message, I don't recall having testing rejecting any deletion requests. I'll look into it tomorrow.
Title: Re: [4529][2.0 RC4/Subs.php] member awaiting approval notice
Post by: booch_21 on November 29, 2010, 06:02:14 PM
Accepted users don't create the notification issue, only when rejecting them.  Thanks for looking!
Title: Re: [4529][2.0 RC4/Subs.php] member awaiting approval notice
Post by: Brettflan on November 30, 2010, 05:11:25 AM
OK, I've had a chance to test it a couple of times on my test setup and I can't duplicate the problem you're having.
To be clear, this is what I'm doing:
With a member having requested account deletion, I click the link in "There is one member awaiting approval" and end up on the Awaiting Approval page, which lists the one member who has tried to delete his account (a test user I logged in as on another browser and made the request). I put a check in the checkbox for him on the far right, then on the "With Selected:" dropdown box I choose "Reject" (the only rejection option it lists for me). After confirming that, the message at the top indicating a member is awaiting approval goes away and the account is deleted.

Did you do anything significantly differently from that?
Title: Re: [4529][2.0 RC4/Subs.php] member awaiting approval notice
Post by: booch_21 on November 30, 2010, 09:43:40 AM
I haven't tried approving an account deletion.  My issue comes up when I delete a new account.  New users register and are forced to wait for Admin approval.  When I do not approve the account, mainly from an IP that has no business on a very localized forum, I either pick Reject or Reject and Send Mail from the drop down on the right.  Let me show you in slide form:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi113.photobucket.com%2Falbums%2Fn211%2Fbooch_21%2FForum%2520Pics%2FSnap1.jpg&hash=ec21ec070eb6fc5ae99152199efeef4935fe5016)
This shows the new user waiting.

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi113.photobucket.com%2Falbums%2Fn211%2Fbooch_21%2FForum%2520Pics%2FSnap2.jpg&hash=9c662f7c7025833963abc4be019579922800624e)

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi113.photobucket.com%2Falbums%2Fn211%2Fbooch_21%2FForum%2520Pics%2FSnap3.jpg&hash=95a5888714756a144fef26342ed7d9f7778b12d0)

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi113.photobucket.com%2Falbums%2Fn211%2Fbooch_21%2FForum%2520Pics%2FSnap4.jpg&hash=a7f48599969864a9198257197489a0094dcd70f7)
After rejecting the new user (yes, the user is checked in the previous screen).

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi113.photobucket.com%2Falbums%2Fn211%2Fbooch_21%2FForum%2520Pics%2FSnap5.jpg&hash=9c366845453012fae2c8a0326b40b41a3b791ecb)
Nothing in the approval list.

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi113.photobucket.com%2Falbums%2Fn211%2Fbooch_21%2FForum%2520Pics%2FSnap6.jpg&hash=43a14febdf145a4c81c3b191ed6649fdf880b87b)
Notification is still up top however.

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi113.photobucket.com%2Falbums%2Fn211%2Fbooch_21%2FForum%2520Pics%2FSnap7.jpg&hash=5ab57058b73ffbb5746f6c164fdb4c8730b54a95)
Reset the statistics will clear the notification.

Thanks for the help with this!
Title: Re: [4529][2.0 RC4/Subs.php] member awaiting approval notice
Post by: Brettflan on November 30, 2010, 10:50:15 AM
So, nothing to do with account deletion at all.
OK, I switched my test 2.0 RC4 forum over to requiring admin approval to activate accounts, then created a new account in another browser. With the admin account, I followed your steps exactly in choosing "Reject" for that account. It worked exactly as it should for me, the "one member awaiting approval" message went away. No problems.
I didn't get that database error you're showing, though. Might be from another mod package. The mod package and changes I provided for the problems related to account deletion approval do not include any changes to that file. You should check the line of the file it's indicating to see what it's trying to do there. In the unmodified 2.0 RC4 /Sources/Subs-Members.php file, there's no reference to an 'id_member' in the query at that line.
Title: Re: [4529][2.0 RC4/Subs.php] member awaiting approval notice
Post by: Мel on December 25, 2010, 08:45:47 AM
Brettflan
Thanx for the fix, this bug was bugging me :D
Title: Re: [4529][2.0 RC4/Subs.php] member awaiting approval notice
Post by: [SiNaN] on January 17, 2011, 04:35:09 PM
Fixed with rev 10331.