Advertisement:

Author Topic: Showing only approved 'Latest Member'  (Read 22830 times)

Offline Sekhmet

  • Semi-Newbie
  • *
  • Posts: 15
  • Gender: Male
  • Iron of Sekhmet
Showing only approved 'Latest Member'
« on: August 24, 2004, 12:35:27 AM »
Heya

I think the 'Latest Member' should not display newly registered members that are still awaiting for approval, since they're not 'official' forum members yet -they have to be approved by an admin first-

This may sound like a minor thing at first, but for some (well at least for me  :P) it would be of some help, especially when you have unwanted people registering users on your forum with offensive/insulting names, etc. It would prevent regular users from seeing such nasty stuff on the forum index.

Anyone else think this could be useful?

[edit] changed topic title [/edit]
« Last Edit: September 29, 2004, 02:31:53 AM by A.M.A »

Offline Metho

  • SMF Friend
  • Full Member
  • *
  • Posts: 564
  • Gender: Male
Re: 'Latest Member' display suggestion
« Reply #1 on: August 24, 2004, 01:20:28 AM »
Ok, I'll go along with that. Lets see, it's late, I should be in bed, and I'm tired, but one line later a quick test makes me think this should do it...

In Subs.php FIND:
Code: [Select]
$result = db_query("
SELECT COUNT(ID_MEMBER), MAX(ID_MEMBER)
FROM {$db_prefix}members", __FILE__, __LINE__);

REPLACE WITH:
Code: [Select]
$result = db_query("
SELECT COUNT(ID_MEMBER), MAX(ID_MEMBER)
FROM {$db_prefix}members
                                WHERE is_activated = 1", __FILE__, __LINE__);

Boom. Worky. Hopefully. Post if you have problems.

- Methonis
Joshua "Methonis" Frazer
Support Specialist
The Simple Machines Team

Offline † ÐëepÇuT¹ †

  • Jr. Member
  • **
  • Posts: 353
  • Gender: Male
  • YaBBSe
    • x3Generation
Re: 'Latest Member' display suggestion
« Reply #2 on: August 24, 2004, 02:26:10 AM »
Ok, I'll go along with that. Lets see, it's late, I should be in bed, and I'm tired, but one line later a quick test makes me think this should do it...

In Subs.php FIND:
Code: [Select]
$result = db_query("
 SELECT COUNT(ID_MEMBER), MAX(ID_MEMBER)
 FROM {$db_prefix}members", __FILE__, __LINE__);

REPLACE WITH:
Code: [Select]
$result = db_query("
 SELECT COUNT(ID_MEMBER), MAX(ID_MEMBER)
 FROM {$db_prefix}members
 WHERE is_activated = 1", __FILE__, __LINE__);

Boom. Worky. Hopefully. Post if you have problems.

- Methonis

If that works (haven't tested it) I think you should make that a mod, easy to use and install for people who want it (like me).
Personal Website
x3Generation - gaming
graphics and anime.
 
Favorite Forums
> SimpleMachines Forum
> GamerzPlanet Forums


Offline Oldiesmann

  • Developer
  • SMF Super Hero
  • *
  • Posts: 24,814
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • http://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: 'Latest Member' display suggestion
« Reply #3 on: August 24, 2004, 07:04:39 PM »
A minor change like that usually doesn't warrant mod status. It's not that difficult to do it yourself and probably should be implemented in SMF by default.
Michael Eshom
Webmaster / SMF Lead Developer
oldiesmann@simplemachines.org

Offline Metho

  • SMF Friend
  • Full Member
  • *
  • Posts: 564
  • Gender: Male
Re: 'Latest Member' display suggestion
« Reply #4 on: August 24, 2004, 07:18:36 PM »
A minor change like that usually doesn't warrant mod status. It's not that difficult to do it yourself and probably should be implemented in SMF by default.

Yeah. I know that quite a few users have no knowledge of any programming languages or how things work behind the scenes, which I always try to take into account when releasing a mod or explaining changes to users. However, for something this basic, where one can just find and paste, it seems overkill to actually make a mod package. In reality, all that is changed is one line is added:
Code: [Select]
WHERE is_activated = 1 I just put a bit more surrounding code so that it would be easy to find and you can see precisely where it should go. Things that require many changes to files and/or have additional files are, of course, always put into mod form.

And, as always, being as I'm here to help, if you're trying to apply a piece of code that I've posted here that you don't understand or need help with, I'm always willing to go the extra step and either explain in greater detail through pm's or a messenger service how to accomplish it, or do it for you if it still doesn't work.

- Methonis
Joshua "Methonis" Frazer
Support Specialist
The Simple Machines Team

Offline Sekhmet

  • Semi-Newbie
  • *
  • Posts: 15
  • Gender: Male
  • Iron of Sekhmet
Re: 'Latest Member' display suggestion
« Reply #5 on: August 25, 2004, 12:55:13 AM »
Heya

Thanks a lot, worked beautifully!  :)

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: 'Latest Member' display suggestion
« Reply #6 on: August 25, 2004, 02:02:19 AM »
Excellent!

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: 'Latest Member' display suggestion
« Reply #7 on: August 25, 2004, 01:56:22 PM »
for some reason this doesn't work with "Member Activation" enabled.

Offline Metho

  • SMF Friend
  • Full Member
  • *
  • Posts: 564
  • Gender: Male
Re: 'Latest Member' display suggestion
« Reply #8 on: August 25, 2004, 07:30:23 PM »
Yeah, I figured it'd mess up with something. I'll look at it tonight and figure it out.

- Methonis
Joshua "Methonis" Frazer
Support Specialist
The Simple Machines Team

Offline Metho

  • SMF Friend
  • Full Member
  • *
  • Posts: 564
  • Gender: Male
Re: 'Latest Member' display suggestion
« Reply #9 on: August 25, 2004, 09:48:51 PM »
Ok, got it. Basically what was happening was that when activate by email is selected for registering, when the user finally activates his account, it runs the queries to activate his account, BUT it doesn't run a function which updates the stats BECAUSE the way the system works, it does that when they initially register it updates the stats prior to activating (hence without modification you see their name as the latest member and the number of users increases) So, here's the updated code, plus a bit extra, as I noticed while trying to solve the problem that the member list will list them prior to activating as well. Sorry for the delay.

Ok, complete instructions. If you've already done the initial step, skip this first step:

In Subs.php FIND:
Code: [Select]
$result = db_query("
SELECT COUNT(ID_MEMBER), MAX(ID_MEMBER)
FROM {$db_prefix}members", __FILE__, __LINE__);
REPLACE WITH:
Code: [Select]
$result = db_query("
SELECT COUNT(ID_MEMBER), MAX(ID_MEMBER)
FROM {$db_prefix}members
                                WHERE is_activated = 1", __FILE__, __LINE__);

In Register.php FIND:
Code: [Select]
updateMemberData($row['ID_MEMBER'], array('is_activated' => 1, 'validation_code' => '\'\''));ADD AFTER:
Code: [Select]
updateStats('member');
In Memberlist.php FIND:
Code: [Select]
$request = db_query("
SELECT COUNT(ID_MEMBER)
FROM {$db_prefix}members
WHERE LOWER(SUBSTRING(realName, 1, 1)) < '" . strtolower($_REQUEST['start']) . "'", __FILE__, __LINE__);
REPLACE WITH:
Code: [Select]
$request = db_query("
SELECT COUNT(ID_MEMBER)
FROM {$db_prefix}members
WHERE LOWER(SUBSTRING(realName, 1, 1)) < '" . strtolower($_REQUEST['start']) . "'
AND is_activated != 0", __FILE__, __LINE__);
FIND:
Code: [Select]
$request = db_query("
SELECT
mem.memberName, mem.realName, mem.websiteTitle, mem.websiteUrl, mem.posts,
mem.ID_GROUP, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.emailAddress,
mem.hideEmail, mem.ID_MEMBER, IFNULL(lo.logTime, 0) AS isOnline,
IFNULL(mg.groupName, '') AS groupName, mem.showOnline, mem.dateRegistered
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
ORDER BY " . $sort_methods[$_REQUEST['sort']][$context['sort_direction']] . "
LIMIT $_REQUEST[start], $modSettings[defaultMaxMembers]", __FILE__, __LINE__);
REPLACE WITH:
Code: [Select]
$request = db_query("
SELECT
mem.memberName, mem.realName, mem.websiteTitle, mem.websiteUrl, mem.posts,
mem.ID_GROUP, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.emailAddress,
mem.hideEmail, mem.ID_MEMBER, IFNULL(lo.logTime, 0) AS isOnline,
IFNULL(mg.groupName, '') AS groupName, mem.showOnline, mem.dateRegistered
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
WHERE is_activated != 0
ORDER BY " . $sort_methods[$_REQUEST['sort']][$context['sort_direction']] . "
LIMIT $_REQUEST[start], $modSettings[defaultMaxMembers]", __FILE__, __LINE__);

Hateful little mistakes. :) Anyhow, this should make everything worky, if you find anything else, do tell me.

- Methonis
« Last Edit: October 29, 2004, 03:47:51 PM by Metho »
Joshua "Methonis" Frazer
Support Specialist
The Simple Machines Team

Offline Winters

  • Jr. Member
  • **
  • Posts: 266
  • Gender: Female
    • DykesVision. Reality-based.
Re: Showing only approved 'Latest Member'
« Reply #10 on: October 13, 2004, 02:37:40 PM »
Hello metho, sounds like a great tip to me. It has been bugging me that members not yet activated are listed as new members.

Does this work with RC2, too? (We just upgraded.)

Offline Metho

  • SMF Friend
  • Full Member
  • *
  • Posts: 564
  • Gender: Male
Re: Showing only approved 'Latest Member'
« Reply #11 on: October 13, 2004, 07:11:15 PM »
It should. It didn't modify much and I don't think that rc2 public release changed any of those queries from the rc1, but lemme check quick.

- Methonis
Joshua "Methonis" Frazer
Support Specialist
The Simple Machines Team

Offline Metho

  • SMF Friend
  • Full Member
  • *
  • Posts: 564
  • Gender: Male
Re: Showing only approved 'Latest Member'
« Reply #12 on: October 13, 2004, 07:24:18 PM »
Alright, one query changed a tinsy bit - the last one, but I've updated the post with all the instructions (the big one) so if you follow that everything should be fine. Lemme know if you run into problems.

- Methonis
Joshua "Methonis" Frazer
Support Specialist
The Simple Machines Team

Offline Anguz

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,430
  • Gender: Male
    • cristianlavaque.com
Re: Showing only approved 'Latest Member'
« Reply #13 on: October 14, 2004, 07:07:07 AM »
A minor change like that usually doesn't warrant mod status.

Well, it is nice to have them as packages, as silly as it may sound, because when upgrading SMF or setting up a new one, those changes may need to be reapplied and it's quicker with the package manager. A couple of clicks will always beat something that requires more work. :P I'm not talking for myself, though, since even packaged, I usually go apply mods by hand to make sure nothing is messed up. ::)
Cristián Lávaque http://cristianlavaque.com

Offline Winters

  • Jr. Member
  • **
  • Posts: 266
  • Gender: Female
    • DykesVision. Reality-based.
Re: Showing only approved 'Latest Member'
« Reply #14 on: October 14, 2004, 01:54:39 PM »
Thanks, metho! For some reason, I cannot find the proper line in subs.php...

Offline Metho

  • SMF Friend
  • Full Member
  • *
  • Posts: 564
  • Gender: Male
Re: Showing only approved 'Latest Member'
« Reply #15 on: October 14, 2004, 03:13:59 PM »
Hmm, odd. I'm not at my computer so I can't look at the source, but just try searching for the first few lines of that query. Sometimes when you search for that much text things go screwy.

- Methonis
Joshua "Methonis" Frazer
Support Specialist
The Simple Machines Team

Offline nosleep

  • Semi-Newbie
  • *
  • Posts: 56
Re: Showing only approved 'Latest Member'
« Reply #16 on: December 17, 2004, 04:22:14 AM »
I applied the full mod as listed by Metho. Still, people who applied are already shown as members BEFORE being approved - and that's what I want to avoid. How?

(only 6 members of these 105 have been approved)

Total Members: 105
Latest Member: skipjack
Your Personal Messages: 8 New: 0

Offline Xenomorph

  • Semi-Newbie
  • *
  • Posts: 35
  • Gender: Male
    • Xenomorph dot Net
Re: Showing only approved 'Latest Member'
« Reply #17 on: January 15, 2005, 04:17:12 AM »
I applied the full mod as listed by Metho. Still, people who applied are already shown as members BEFORE being approved - and that's what I want to avoid. How?

(only 6 members of these 105 have been approved)

Total Members: 105
Latest Member: skipjack
Your Personal Messages: 8 New: 0


you have to run maintenance. under general maintenance, click "Recount all forum totals and statistics."

it rebuilds member stats.

Offline Xenomorph

  • Semi-Newbie
  • *
  • Posts: 35
  • Gender: Male
    • Xenomorph dot Net
Re: Showing only approved 'Latest Member'
« Reply #18 on: January 15, 2005, 04:57:10 AM »
i updated the MOD that does all this

http://xenomorph.net/files/forum/ShowOnlyAuthenticatedMembers_101.zip

there was one error in the original mod (it said "$is_authenticated" instead of "is_authenticated", which caused a MySQL  error in memberlist). i also updated the mod version to 1.0.1 to work with the latest SMF forum.


Offline smacktalk

  • Jr. Member
  • **
  • Posts: 222
  • Gender: Male
    • MarcoBarrera.com
Re: Showing only approved 'Latest Member'
« Reply #19 on: January 27, 2005, 02:17:26 AM »
i updated the MOD that does all this

http://xenomorph.net/files/forum/ShowOnlyAuthenticatedMembers_101.zip

there was one error in the original mod (it said "$is_authenticated" instead of "is_authenticated", which caused a MySQL  error in memberlist). i also updated the mod version to 1.0.1 to work with the latest SMF forum.



Do you mean is_activated?

also, I get this:

Fatal error: Call to undefined function: db_query() in /.../.../forum/Sources/Load.php on line 37