PDA

View Full Version : make existing users display age by default


michelle86
07-17-2013, 06:03 PM
I want all my users to have their age displayed on the forum. So I've gone ahead and already removed "hide age and date of birth" as a privacy option by editing the modifyprofile_birthday template.

New users have to select 1 of the 3 remaining options that will display their age at registration. Great!

But now, all the previously registered users who had selected "hide age and DOB" at registration still have their ages hidden. How do I unhide all their ages and change their privacy setting to "display only age" (without editing each individual profile)? Is there any way to do this?

--------------- Added 1374088727 at 1374088727 ---------------

Nevermind, figured it out!

Go to Maintenance > Execute SQL Query

UPDATE user SET showbirthday=1

Everyone's age is now displayed on the forum.

michelle86
09-11-2013, 04:46 AM
Okay, so even though the "hide age" option is gone from the registration page... members are still having their ages go back into hiding. There ages will be displayed in their profiles and postbit and then it will randomly disappear (for just a few random members) and gone until I execute the SQL query to have everyone's ages show again.

What am I missing? How do I make everyone's ages show and stay that way? I don't know what is happening that people's accounts are being reset to hide their age.

tbworld
09-11-2013, 05:12 AM
See if you cannot start narrowing down the problem a bit. Is it localized to certain user-groups maybe? Is the bit being reset in the database when this happens?

I am trying to decide if it is a permissions problem or a caching problem when you run the query?

In this kind of situation, I try to log the users actions in this section of the code, gathering data so I can narrow the problem down.

Sincerely, good luck and post if you find anymore clues -- so we can help.

michelle86
09-11-2013, 05:20 AM
Thank you for your reply!

It seems to be happening to all user groups. The users that are affected seem very random. It also doesn't seem to matter if they originally chose to display their age at registration or hide it. I've had members tell me that they were sure they chose to display their age when they registered. I don't know why their age would suddenly become hidden. It doesn't seem to be a cache problem.

michelle86
12-30-2013, 03:18 PM
So I am still having this problem. Ages disappear from postbits and profiles for random members across all usergroups. Even those that did not choose "hide age" at registration. I even tried removing the "hide age" option from the registration page but still this issue persists.

I have been regularly doing the manual sql query I mentioned in my first post which makes everyone's ages display temporarily. Since I cannot figure out the root of the disappearing age problem, I would like to somehow make this sql query a scheduled task so it happens automatically once per week.

Does anyone know how to schedule sql queries?

kh99
12-30-2013, 05:17 PM
Hmm...can't think why this would happen. Can you make it happen by editing something else in your profile?

As for scheduling a query, if you do it in php you can create a plugin using one of the cron_script_cleanup hooks (either daily or hourly, depending how often you want to run it). In case you're not in to php, the code for what you posted above would be:
$vbulletin->db->query_write("UPDATE ".TABLE_PREFIX."user SET showbirthday=1");


but I would suggest this instead:
$vbulletin->db->query_write("UPDATE ".TABLE_PREFIX."user SET showbirthday=1
WHERE showbirthday = 0");


that way if someone has chosen 2 or 3 it won't change back to 1.

michelle86
12-30-2013, 05:47 PM
Thank you for your help!

Do I just paste in the code in cleanup.php?

And how do I make it run daily, weekly, etc?

kh99
12-30-2013, 06:14 PM
You could edit the file and paste it in, but I was thinking about creating a plugin. You go to Plugins & Products > Add New Plugin, paste that code in the big box, select the hook location (either cron_script_cleanup_daily or cron_script_cleanup_hourly), enter a title (something so that you'll remember what it is in the future), check "Yes" to make it active. The other fields you can leave as default. Then press "Save" when you're done.

michelle86
12-30-2013, 08:55 PM
Thank you!

ForceHSS
12-30-2013, 10:48 PM
Maybe members are hiding their age after they see it being showen after you run that query

michelle86
12-30-2013, 11:45 PM
Maybe members are hiding their age after they see it being showen after you run that query

No, members on my forum can't change this setting, only I can. And besides, I only find out that ages go missing because the members it happens to message me and ask for me to make it display again.

ForceHSS
12-31-2013, 12:18 AM
No, members on my forum can't change this setting, only I can. And besides, I only find out that ages go missing because the members it happens to message me and ask for me to make it display again.

Did you stop them from doing that with a plugin?

michelle86
12-31-2013, 12:35 AM
I have agelock (https://vborg.vbsupport.ru/showthread.php?t=235780&highlight=agelock) installed on my forum. It makes it so members can't edit their birth dates or change their DOB privacy setting.

ozzy47
12-31-2013, 12:45 AM
I have no clue why it would be doing that, but why not just write a cron job to run daily, to update the DB if any users DOB is hidden?

michelle86
12-31-2013, 12:54 AM
I have no clue why it would be doing that, but why not just write a cron job to run daily, to update the DB if any users DOB is hidden?

Yeah, I have not been able to figure out why the ages keep disappearing for random members. As far as the updating, I already created a plugin to do this as suggested by kh99 above.

ozzy47
12-31-2013, 12:56 AM
Ahh ok good, then I would not worry to much about it, that will do it for you. :)