Advertisement:

Author Topic: Problem with gender tracking...  (Read 3490 times)

Offline Bob Perry of Web Presence Consulting

  • Sophist Member
  • *****
  • Posts: 1,001
  • Gender: Male
  • (T)ogether (E)veryone (A)chieves (M)ore
    • Bobert921 on Facebook
    • https://www.linkedin.com/in/bperry921/ on LinkedIn
    • @bperry921 on Twitter
    • Web Presence Consulting
Problem with gender tracking...
« on: January 10, 2015, 09:26:12 PM »
Just tested with a couple accounts and it seems that the 2.1 install here is not saving the changes made to profile gender status? I do have many mods installed and seems to be relatively stable so far. But before the mods being present it seemed to work for the admin account and a female account, but now I checked it with another male account change and the stats page still shows the same number of genders, no change saved apparently... the only errors generated in the log afterward are related to google member map...

btw, what type of information is being picked up by SMF when you check the box to allow sharing of usage or whatever data with SMF during an initial install? would be nice to share error messages automatically with yall? although i realize from some sites this would be a huge amount of data to sift through and manage...
Best Regards,
Bob Perry



"The world is moving so fast these days that the man who says it can't be done is generally interrupted by someone doing it." Elbert Hubbard

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 70,939
    • StoryBB/StoryBB on GitHub
Re: Problem with gender tracking...
« Reply #1 on: January 10, 2015, 09:31:14 PM »
Gender is 2.1 is stored as a custom profile field, if you're trying to get it from the members table, that's not going to work.

As for the stats, once a month (in theory), SMF would contact your server, get the PHP, MySQL versions and basic stats like number of boards. Hasn't worked in ages and a year ago I was campaigning to remove them from 2.1 entirely because it hasn't worked in ages.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Bob Perry of Web Presence Consulting

  • Sophist Member
  • *****
  • Posts: 1,001
  • Gender: Male
  • (T)ogether (E)veryone (A)chieves (M)ore
    • Bobert921 on Facebook
    • https://www.linkedin.com/in/bperry921/ on LinkedIn
    • @bperry921 on Twitter
    • Web Presence Consulting
Re: Problem with gender tracking...
« Reply #2 on: January 10, 2015, 09:40:10 PM »
Gender is 2.1 is stored as a custom profile field, if you're trying to get it from the members table, that's not going to work.

Yes, I was aware that gender was removed from members db, but still trying to learn some of the new methodologies (maybe not new, just foreign to my experience?) implemented in the new version... as I understand it, the data for gender is being stored in the Themes db yes?

Best Regards,
Bob Perry



"The world is moving so fast these days that the man who says it can't be done is generally interrupted by someone doing it." Elbert Hubbard

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 70,939
    • StoryBB/StoryBB on GitHub
Re: Problem with gender tracking...
« Reply #3 on: January 10, 2015, 09:43:28 PM »
Yes, it is, along with all the other custom fields data has been for years.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 50,573
Re: Problem with gender tracking...
« Reply #4 on: January 11, 2015, 06:08:27 AM »
Gender is 2.1 is stored as a custom profile field, if you're trying to get it from the members table, that's not going to work.

Yes, I was aware that gender was removed from members db, but still trying to learn some of the new methodologies (maybe not new, just foreign to my experience?) implemented in the new version... as I understand it, the data for gender is being stored in the Themes db yes?



they are tables, not a db. the whole db is what contains all the tables that SMF requires to run.

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Re: Problem with gender tracking...
« Reply #5 on: January 11, 2015, 04:42:56 PM »
Anyway, back to your original post, this is a bug (I'll open an issue in GH in some minutes)

I have 1 user: admin --> male
Quote
Gender stats: Male: 1
I add another user. As there is no gender defined, stats are the same

I define the new member's gender (as admin, editing his profile): Female
Quote
Gender stats:
    Male: 1
    Female: 1
Then I change the gender to "Male"
Quote
Gender stats: Male: 1
Wrong...

I change the gender to "None"
Quote
Gender stats:
    Male: 1
    None: 1

Change the gender to "Male" again:
Quote
Gender stats:
    Male: 1

So it fails to update the stats when the gender is set to "Male"...

edit: when there is only 1 user, it correctly updates the stats None/Male/Female: 1
edit2: https://github.com/SimpleMachines/SMF2.1/issues/2666
« Last Edit: January 11, 2015, 07:20:55 PM by margarett »
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline Bob Perry of Web Presence Consulting

  • Sophist Member
  • *****
  • Posts: 1,001
  • Gender: Male
  • (T)ogether (E)veryone (A)chieves (M)ore
    • Bobert921 on Facebook
    • https://www.linkedin.com/in/bperry921/ on LinkedIn
    • @bperry921 on Twitter
    • Web Presence Consulting
Re: Problem with gender tracking...
« Reply #6 on: January 12, 2015, 01:04:16 AM »
After a lot more cussing than I care to admit, I have this functioning perfectly+...

Replace in Sources/Stats.php and see what yall think of this...

Code: [Select]
// Let's calculate gender stats only every four minutes.
$disabled_fields = isset($modSettings['disabled_profile_fields']) ? explode(',', $modSettings['disabled_profile_fields']) : array();
if (!in_array('gender', $disabled_fields))
{
$context['gender']['Not Set'] = comma_format($modSettings['totalMembers']);
$context['gender']['Female'] = 0;
$context['gender']['Disabled'] = 0;
$context['gender']['Male'] = 0;

$result = $smcFunc['db_query']('', '
SELECT COUNT(m.id_member) AS notset, COUNT(c.value) AS cnt, c.value AS genderhit
FROM {db_prefix}members AS m
LEFT JOIN {db_prefix}themes AS c ON c.variable = "cust_gender"
WHERE m.id_member > {int:select} AND m.id_member = c.id_member
  GROUP BY c.value',
array(
'select' => 0,
)
);
while ($row = $smcFunc['db_fetch_assoc']($result))
{
$context['gender']['Not Set'] = $context['gender']['Not Set'] - $row['notset'];

// Assuming we're telling the genders in the forum...
if (!empty($row['genderhit']))
{
$context['gender'][$row['genderhit']] = $row['cnt'];
}
}
$smcFunc['db_free_result']($result);
}

enjoy...
Best Regards,
Bob Perry



"The world is moving so fast these days that the man who says it can't be done is generally interrupted by someone doing it." Elbert Hubbard

Offline Bob Perry of Web Presence Consulting

  • Sophist Member
  • *****
  • Posts: 1,001
  • Gender: Male
  • (T)ogether (E)veryone (A)chieves (M)ore
    • Bobert921 on Facebook
    • https://www.linkedin.com/in/bperry921/ on LinkedIn
    • @bperry921 on Twitter
    • Web Presence Consulting
Re: Problem with gender tracking...
« Reply #7 on: January 14, 2015, 09:17:57 PM »
So, as I understand it so far, this fix above would be eligible to submit at github for integration into the source? It needs some minor tweaking like putting the cache statements back in, but it functions perfect on my 2.1 site as is... I can learn to move these things over there eventually I guess, but I care little for recognition of fixing it, if someone else who wants to scrape/tweak it a little  from here and shoot it over there for consideration is more than welcome to do so if not already done, it works great is all I know right now, must sleep

Best Regards,
Bob Perry



"The world is moving so fast these days that the man who says it can't be done is generally interrupted by someone doing it." Elbert Hubbard

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 58,063
  • Gender: Male
    • Kindred-999 on GitHub
Re: Problem with gender tracking...
« Reply #8 on: January 15, 2015, 01:02:58 AM »
the thing is.... we can not scrape it from here.   Code submitted here is not released under the usage license that you agree to when you submit code to github
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Bob Perry of Web Presence Consulting

  • Sophist Member
  • *****
  • Posts: 1,001
  • Gender: Male
  • (T)ogether (E)veryone (A)chieves (M)ore
    • Bobert921 on Facebook
    • https://www.linkedin.com/in/bperry921/ on LinkedIn
    • @bperry921 on Twitter
    • Web Presence Consulting
Re: Problem with gender tracking...
« Reply #9 on: January 15, 2015, 01:29:39 AM »
the thing is.... we can not scrape it from here.   Code submitted here is not released under the usage license that you agree to when you submit code to github

Ok thanks man, I already went ahead and moved it to github as suggested but still learning how to navigate the unfamiliar format and procedures because I need to learn all that anyway with my own module under construction and progressing slowly but surely, this new SMF version hit me off guard somewhat and once I got a bit more deeply into it I saw immediately that yall have been into it amazingly over the top logically and methodically like I was accustomed to in the the IBM DB2 platform and Sequel, PHP's SQL counterpart... my enthusiasm shot through the ceiling dude, seriously this is going be be epic when completed... but anyway, so just posted it as a comment to margarett's linked issue provided, and I hope yall understand an old feller's odd mood swings at certain miscommunications and such, you'd think an old hand at non-visual text only communicating would be more tolerant, but then again... no no not going there again... this one reason I paid a small fortune for a pretty decent audio/video conference/streaming package, its not too bad but the old days of chatrooms like Yahoo was years ago are fading away fast I'm afraid, maybe the focus is just shifting to something different but you catch my drift...

« Last Edit: January 15, 2015, 01:40:42 AM by Bob Perry »
Best Regards,
Bob Perry



"The world is moving so fast these days that the man who says it can't be done is generally interrupted by someone doing it." Elbert Hubbard