Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Topic started by: Sekhmet on August 24, 2004, 12:35:27 AM

Title: Showing only approved 'Latest Member'
Post by: Sekhmet 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]
Title: Re: 'Latest Member' display suggestion
Post by: 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
Title: Re: 'Latest Member' display suggestion
Post by: † ÐëepÇuT¹ † on August 24, 2004, 02:26:10 AM
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).
Title: Re: 'Latest Member' display suggestion
Post by: 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.
Title: Re: 'Latest Member' display suggestion
Post by: Metho on August 24, 2004, 07:18:36 PM
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
Title: Re: 'Latest Member' display suggestion
Post by: Sekhmet on August 25, 2004, 12:55:13 AM
Heya

Thanks a lot, worked beautifully!  :)
Title: Re: 'Latest Member' display suggestion
Post by: Elijah Bliss on August 25, 2004, 02:02:19 AM
Excellent!
Title: Re: 'Latest Member' display suggestion
Post by: Elijah Bliss on August 25, 2004, 01:56:22 PM
for some reason this doesn't work with "Member Activation" enabled.
Title: Re: 'Latest Member' display suggestion
Post by: Metho 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
Title: Re: 'Latest Member' display suggestion
Post by: Metho 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: $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
Title: Re: Showing only approved 'Latest Member'
Post by: Winters 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.)
Title: Re: Showing only approved 'Latest Member'
Post by: Metho 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
Title: Re: Showing only approved 'Latest Member'
Post by: Metho 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
Title: Re: Showing only approved 'Latest Member'
Post by: Anguz on October 14, 2004, 07:07:07 AM
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. ::)
Title: Re: Showing only approved 'Latest Member'
Post by: Winters on October 14, 2004, 01:54:39 PM
Thanks, metho! For some reason, I cannot find the proper line in subs.php...
Title: Re: Showing only approved 'Latest Member'
Post by: Metho 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
Title: Re: Showing only approved 'Latest Member'
Post by: 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
Title: Re: Showing only approved 'Latest Member'
Post by: Xenomorph on January 15, 2005, 04:17:12 AM
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.
Title: Re: Showing only approved 'Latest Member'
Post by: 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.

Title: Re: Showing only approved 'Latest Member'
Post by: smacktalk on January 27, 2005, 02:17:26 AM
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
Title: Re: Showing only approved 'Latest Member'
Post by: Xenomorph on January 27, 2005, 10:44:34 AM
Quote from: smacktalk on January 27, 2005, 02:17:26 AM

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

o whoops.. yeah, "is_activated"

where did you get the Load.php error at? what were you doing? what screen?

i have the mod installed on my forum (its the only package im using), and i havent come across any errors
Title: Re: Showing only approved 'Latest Member'
Post by: smacktalk on March 11, 2005, 12:28:17 PM
Quote from: Xenomorph on January 27, 2005, 10:44:34 AM
Quote from: smacktalk on January 27, 2005, 02:17:26 AM

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

o whoops.. yeah, "is_activated"

where did you get the Load.php error at? what were you doing? what screen?

i have the mod installed on my forum (its the only package im using), and i havent come across any errors

I was getting this after the installation on a blank page. I have since updated to the current release of SMF. Is this working with the newest build? If so, I will try to reinstall.
Title: Re: Showing only approved 'Latest Member'
Post by: Xenomorph on March 13, 2005, 12:59:00 AM
Quote from: smacktalk on March 11, 2005, 12:28:17 PM
I was getting this after the installation on a blank page. I have since updated to the current release of SMF. Is this working with the newest build? If so, I will try to reinstall.

i just installed 1.0.2, and then installed an updated version of the mod

http://xenomorph.net/files/forum/ShowOnlyAuthenticatedMembers_102.zip
Title: Re: Showing only approved 'Latest Member'
Post by: smacktalk on March 15, 2005, 02:57:06 AM
Quote from: Xenomorph on March 13, 2005, 12:59:00 AM
Quote from: smacktalk on March 11, 2005, 12:28:17 PM
I was getting this after the installation on a blank page. I have since updated to the current release of SMF. Is this working with the newest build? If so, I will try to reinstall.

i just installed 1.0.2, and then installed an updated version of the mod

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

Works fine now. Thanks!
Title: Re: Showing only approved 'Latest Member'
Post by: OAS on May 31, 2005, 11:44:23 AM
i get this message when tryin to run it:
The package you are trying to download or install is either corrupt or not compatible with this version of SMF.

probably cos i'm running version 1.0.3 :P

any possibilities of an updated version of the mod for 1.0.3 users?

cheers
Title: Re: Showing only approved 'Latest Member'
Post by: OAS on June 06, 2005, 01:05:24 AM
bump
Title: Re: Showing only approved 'Latest Member'
Post by: SeaOfSin on June 06, 2005, 01:22:28 AM
Quote from: OAS on May 31, 2005, 11:44:23 AM
i get this message when tryin to run it:
The package you are trying to download or install is either corrupt or not compatible with this version of SMF.

probably cos i'm running version 1.0.3 :P

any possibilities of an updated version of the mod for 1.0.3 users?

cheers

I had that problem myself and did a manual install that worked fine!
Title: Re: Showing only approved 'Latest Member'
Post by: OAS on June 07, 2005, 01:00:14 AM
Quote from: SeaOfSin on June 06, 2005, 01:22:28 AM
I had that problem myself and did a manual install that worked fine!

thanks SeaOfSin

all good now :)
Title: Re: Showing only approved 'Latest Member'
Post by: dvk01 on June 22, 2005, 11:21:22 AM
I get the same error message on 1.04
The package you are trying to download or install is either corrupt or not compatible with this version of SMF.

any easy way around it

how do you do a manual install
Title: Re: Showing only approved 'Latest Member'
Post by: SeaOfSin on June 22, 2005, 12:22:58 PM
Follow these simple instructions


<edit file>
Sources/Subs.php
</edit file>

<search>
$result = db_query("
SELECT COUNT(ID_MEMBER), MAX(ID_MEMBER)
FROM {$db_prefix}members", __FILE__, __LINE__);
</search>

<replace>
$result = db_query("
SELECT COUNT(ID_MEMBER), MAX(ID_MEMBER)
FROM {$db_prefix}members
                                WHERE `is_activated` = '1'", __FILE__, __LINE__);
</replace>


<edit file>
Sources/Register.php
</edit file>

<search>
updateMemberData($row['ID_MEMBER'], array('is_activated' => 1, 'validation_code' => '\'\''));
</search>

<replace>
updateMemberData($row['ID_MEMBER'], array('is_activated' => 1, 'validation_code' => '\'\''));
updateStats('member');
</replace>

<edit file>
Sources/Memberlist.php
</edit file>

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

<replace>
$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__);
</replace>

<search>
$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__);
</search>

<replace>
$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__);
</replace>
Title: Re: Showing only approved 'Latest Member'
Post by: dvk01 on June 22, 2005, 12:30:22 PM
I found the easy way is to edit the xml file to show 1.04 instead of 1.02 then it works

thanks for all the advice though
Title: Re: Showing only approved 'Latest Member'
Post by: phillyuser on June 29, 2006, 10:51:08 AM
Will this fix work for SMF 1.07?