Reply New Topic
2010/5/15 17:32:36
#1
Offline
Home away from home

Profile Module - Option Fields

Hello,

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
#2
Offline
Home away from home

Re: Profile Module - Option Fields

That is an array converted to a string.

Quote:


srmcatee wrote:
Hello,

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.



In PHP, there are functions to serialize and unserialize arrays/strings. What is it you are trying to do?

_________________
Christian Web Resources
Facebook

2010/5/15 23:06:59
#3
Offline
Home away from home

Re: Profile Module - Option Fields

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";}

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
#4
Offline
Home away from home

Re: Profile Module - Option Fields

Steve,

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
#5
Offline
Home away from home

Re: Profile Module - Option Fields

You don't have to reinvent the wheel for that . Simply create a field as a copy of user_viewemail. This field is a yes/no field.

_________________
the german icms website : www.impresscms.de

2010/5/17 5:15:05
#6
Offline
Home away from home

Re: Profile Module - Option Fields

K. 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
#7
Offline
Home away from home

Re: Profile Module - Option Fields

Ahhh. 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
#8
Offline
Home away from home

Re: Profile Module - Option Fields

Quote:

I put in the option a:0:{} for a radio yes/no field


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
#9
Offline
Home away from home

Re: Profile Module - Option Fields

I 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 . Some features are a little more complicated because they have to be. For example autotasks. This feature is awesome, however, I don't think that a lot of people will use it (since they don't know how to use it).

Anyway: If you have good ideas how to improve it, let me know and I'll see what I can do .

_________________
the german icms website : www.impresscms.de

2010/5/17 11:51:58
#10
Offline
Home away from home

Re: Profile Module - Option Fields

Quote:

For example autotasks. This feature is awesome, however, I don't think that a lot of people will use it (since they don't know how to use it).


That's what our all new and improved re-released Wiki is for


2010/5/17 12:25:04
#11
Offline
Home away from home

Re: Profile Module - Option Fields

Quote:

That's what our all new and improved re-released Wiki is for



I must have missed something. Where is it?

_________________
the german icms website : www.impresscms.de

2010/5/17 13:14:32
#12
Offline
Home away from home

Re: Profile Module - Option Fields

Quote:

I must have missed something. Where is it?


Where it was for the last 18 months


Reply New Topic extras
 Previous Topic   Next Topic
You can view topic.
You can start a new topic.
You can reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You can post without approval.