2010/5/15 17:32:36
|
---|
![]() |
Profile Module - Option FieldsHello,
I just downloaded 1.2.1 and I am trying to setup custom fields for the registration process using the profile module. In the options field for one of the pre-build fields it has these values: a:3:{i:0;s:33:"Notify me of all selected updates";i:1;s:19:"Notify me only once";i:2;s:48:"Notify me once then disable until I log in again";} anyone tell me where I can look up what this syntax is? Or what this is called. I've seen this in C# before but I can't recall what it is called or what the syntax is. Thanks in advance. |
2010/5/15 20:10:21
|
---|
|
Re: Profile Module - Option FieldsThat is an array converted to a string.
Quote:
In PHP, there are functions to serialize and unserialize arrays/strings. What is it you are trying to do? |
2010/5/15 23:06:59
|
---|
|
Re: Profile Module - Option Fieldsa:3:{i:0;s:33:"Notify me of all selected updates";i:1;s:19:"Notify me only once";i:2;s:48:"Notify me once then disable until I log in again";} This is a serialized array. I figured out what the letters "a", "i" and "s" in this serialized string mean: a = the type. This time it's an array i = the index s = the length of the string You never have to worry about manually converting your array into a serialized string. We have the functions serialize and unserialize for that. I hope I make a correct array as an example: $steve = array( 'Notify me of all selected updates', 'Notify me only once', 'Notify me once then disable until I log in again' ) $arrayfordb = serialize($steve); If you want to return the serialized string into a proper array use the following: [code] $arrayfromdb = 'a:3:{i:0;s:33:"Notify me of all selected updates";i:1;s:19:"Notify me only once";i:2;s:48:"Notify me once then disable until I log in again";}'; $steve = unserialize($arrayfromdb); Hope it helps. |
2010/5/16 7:24:05
|
---|
![]() |
Re: Profile Module - Option FieldsSteve,
I am trying to add fields to the registration process with the new profile module. I have been unable to add radio yes/no buttons. Not sure what string of options the system is expecting. |
2010/5/16 9:07:38
|
---|
![]() |
Re: Profile Module - Option FieldsYou don't have to reinvent the wheel for that
![]() |
2010/5/17 5:15:05
|
---|
![]() |
Re: Profile Module - Option FieldsK. I put in the option a:0:{} for a radio yes/no field. I still get error when I submit the field and it is not created.
|
2010/5/17 5:18:28
|
---|
![]() |
Re: Profile Module - Option FieldsAhhh. I turned on debug. It appears the radio button wanted a default value set. I set it to 0 and it took.
This is not simple or user friendly. We might preset some of the fields based on selections or add some help to the screen. |
2010/5/17 6:37:48
|
---|
|
Re: Profile Module - Option FieldsQuote:
Stooooopppppp. You never ever never ever never have to make up your own a:0:{} information. All you need to do is figure out whether your field needs a serialized string (which is rare) Then, you either use serialize to put things into the database and unserialize after you've gotten the data out of the database. |
2010/5/17 10:08:09
|
---|
![]() |
Re: Profile Module - Option FieldsI totally agree that adding fields isn't as straight forward as it maybe could be but for now, I don't see how this could be improved.
On the other hand I don't want to support each and everyone who calls himself a webmaster or whatever ![]() Anyway: If you have good ideas how to improve it, let me know and I'll see what I can do ![]() |
2010/5/17 11:51:58
|
---|
|
Re: Profile Module - Option FieldsQuote:
That's what our all new and improved re-released Wiki is for ![]() |
2010/5/17 12:25:04
|
---|
![]() |
Re: Profile Module - Option FieldsQuote:
I must have missed something. Where is it? |
2010/5/17 13:14:32
|
---|
|
Re: Profile Module - Option FieldsQuote:
Where it was for the last 18 months ![]() |