PDA

View Full Version : New user profile field ("yes/no" radio buttons). How to make everyone a "yes"?


licensinglinks
01-03-2013, 10:35 PM
I have created 3 new user profile field. They are simple yes/no radio buttons.

Can anyone please explain how I can force all members to become "yes"?

kh99
01-03-2013, 11:15 PM
You could do this db query:
UPDATE userfield SET fieldX='yes'


Where X is the actual number of the field you want to set.

Obviously this is a bit dangerous since it can't be undone - make sure you get the field id right, and that the part in quotes is one of your choices (capitalize it if necessary).

licensinglinks
01-04-2013, 01:11 PM
Thanks! Seems to work OK but, when I look at my own UCP settings the "yes/no" radio buttons are both blank. Is that normal?

kh99
01-04-2013, 03:23 PM
It should show what you have selected. You created a "single selection radio button" field and entered "Yes" and "No" for the choices, right? You have to make sure that the text in the query exactly matches one of the choices (or maybe I'm wrong about how you created your field?).

licensinglinks
01-04-2013, 04:45 PM
It should show what you have selected. You created a "single selection radio button" field and entered "Yes" and "No" for the choices, right? You have to make sure that the text in the query exactly matches one of the choices (or maybe I'm wrong about how you created your field?).

What I mean is that the database change has worked perfectly. I have made everyone "yes". If I go into ACP > users > search for users and search for people who are "yes" then everyone comes up in the list.

However, if you then click on one of the users you see this:

https://vborg.vbsupport.ru/external/2013/01/3.gif

Therefore the database is basically correct, but the radio buttons graphically are blank. It is the same situation in UCP > settings > general settings. The radio buttons are blank.

Not a big problem for me, but it would be nice if there was a solution, or at the very least could you just confirm that is expected and is not a problem.

Lynne
01-04-2013, 04:51 PM
"yes" is not the same as "Yes". You need to do the query to set it to exactly what you want - Yes or yes.

kh99
01-04-2013, 04:52 PM
OK, that's what I thought you meant. And I think when you view your profile it should reflect what the database says. But when you mentioned the database you said "yes", and what I see for the choice in the picture is "Yes". Maybe you just did that when writing the post, but I was saying you should make sure the capitalization matches your choices (so maybe you have to run the query again with 'Yes' instead of 'yes'?).

Lynne
01-04-2013, 05:00 PM
If he's already run the query, then what he would actually need to run now is something like:
UPDATE userfield SET fieldX='Yes' where fieldX='yes'

As always, you should never run a query on a live site without first doing a backup!!!

kh99
01-04-2013, 05:04 PM
Sorry, I missed that you sneaked one in there, I was replying to his post. And you're right Lynne, good point. But the result would be the same either way unless someone has selected 'No' in the mean time.

licensinglinks
01-04-2013, 08:04 PM
If he's already run the query, then what he would actually need to run now is something like:
UPDATE userfield SET fieldX='Yes' where fieldX='yes'

As always, you should never run a query on a live site without first doing a backup!!!

This worked perfectly thanks! Yes I got the case wrong when I ran the query.

Thanks all for the help with this.