News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Showing only approved 'Latest Member'

Started by Sekhmet, August 24, 2004, 12:35:27 AM

Previous topic - Next topic

Sekhmet

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]

Metho

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: $result = db_query("
SELECT COUNT(ID_MEMBER), MAX(ID_MEMBER)
FROM {$db_prefix}members", __FILE__, __LINE__);


REPLACE WITH: $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

† ÐëepÇuT¹ †

Quote from: Metho 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: $result = db_query("
SELECT COUNT(ID_MEMBER), MAX(ID_MEMBER)
FROM {$db_prefix}members", __FILE__, __LINE__);


REPLACE WITH: $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


Oldiesmann

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
Christian Metal Fans

Metho

Quote from: Oldiesmann 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.

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: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

Sekhmet

Heya

Thanks a lot, worked beautifully!  :)

Elijah Bliss


Elijah Bliss

for some reason this doesn't work with "Member Activation" enabled.

Metho

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

Metho

#9
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: $result = db_query("
SELECT COUNT(ID_MEMBER), MAX(ID_MEMBER)
FROM {$db_prefix}members", __FILE__, __LINE__);

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


In Register.php FIND: updateMemberData($row['ID_MEMBER'], array('is_activated' => 1, 'validation_code' => '\'\''));
ADD AFTER: updateStats('member');

In Memberlist.php FIND: $request = db_query("
SELECT COUNT(ID_MEMBER)
FROM {$db_prefix}members
WHERE LOWER(SUBSTRING(realName, 1, 1)) < '" . strtolower($_REQUEST['start']) . "'", __FILE__, __LINE__);

REPLACE WITH: $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: $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: $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
Joshua "Methonis" Frazer
Support Specialist
The Simple Machines Team

Winters

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.)

Metho

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

Metho

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

Anguz

Quote from: Oldiesmann on August 24, 2004, 07:04:39 PM
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

Winters

Thanks, metho! For some reason, I cannot find the proper line in subs.php...

Metho

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

nosleep

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

Xenomorph

Quote from: nosleep 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


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

it rebuilds member stats.

Xenomorph

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.


smacktalk

Quote from: Xenomorph 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.



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

Advertisement: