Search code examples
phpsqlwordpresscheckboxbuddypress

Save checkbox in SQL db with buddypress


I'm using buddypress on my wordpress site and want to store a checkbox value to the custom profile fields. Users need to be able to check the checkbox when registering for the site. I know how to add a value to the xprofile field, I just don't know what the format of the value should be.

When looking into phpMyAdmin I see the values for the checkbox are: 'a:1:{i:0;s:2:"True";}' for true, and 'a:0:{}' for false.

What does this all mean? Are these wp / bp specific? Should I just write these exact values into the db for everyone?


Solution

  • Did you add the checkbox via the DashBoard > Users > Profile Fields ? If you add it to the 'Base' group, it should show up on the register form. And BP will handle the saving for you.