XF 1.5 Duplicating custom field choices/values

Live Free

Active member
I am trying to create a near duplicate custom field - that is, create a new custom user field but duplicate the all of the possible values/choices of an existing through a MySQL query, rather than manually recreating the questions (due to the number of choices this would take hours).

I have a handful of custom field questions that have 30+ answers. I could use some help creating a database query to copy the custom field values/answers from an existing question into a brand new question, or to simply query a list of custom fields into a question I've already created.

Say I create a new custom field with 30+ checkbox options How could I query the database to add the possible choices?

Would it be better to run a query or simply duplicate the table and rename the field_id?

P.S. the value choices available for both custom fields - the old and the new - should always be the same. User choice selections will vary (i.e. what are your strengths? what are your weaknesses?)

Thanks.
 
So I'm going to try copying the table and inserting it as a new row.

When attempting to simply copy the row, I get the following error:

#1364 - Field 'field_choices' doesn't have a default value

This is when copying an existing row that should have 30+ values for field_choices.

Query:

Code:
INSERT INTO `database_name`.`xf_user_field` (
`field_id` ,
`display_group` ,
`display_order` ,
`field_type` ,
`match_type` ,
`match_regex` ,
`match_callback_class` ,
`match_callback_method` ,
`max_length` ,
`required` ,
`show_registration` ,
`user_editable` ,
`viewable_profile` ,
`viewable_message` ,
`display_template` ,
`moderator_editable` ,
`user_field_category_id`
)
VALUES (
'77726974696e675f67656e7265', 'custom', '11', 'select', 'none', '', '', '', '0', '0', '1', 'yes', '1', '0', '', '0', '1'
);

My questions are:

1. What is the insert value (and existing value for the existing field) a string of characters (7772697...) instead of the field_id like writing_genres?
2. If I view the field I want to copy, for field_choices there is [BLOB - 916] My understanding is this is a binary compilation of all of the field_choices options? When copying the table, for the MySQL function should I select BIN?

I wouldn't have much problem editing the above query except I don't know how to properly list/include all of the field_choices.
 
Top Bottom