• Resolved c3web

    (@c3web)


    Hi.

    I have created select fields.
    Can I export this [options]?

    e.g.
    meta_key = fruits
    apple|fruit01,
    banana|fruit02,
    orange|fruit03,

    I want to get apple or banana or orange,
    but export data was fruit01,fruit02,fruit03.

    wpmem_fields() has [“options”].
    I want to get this.
    How I get this?

    thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    You want to export options? or user meta? I can’t quite tell from your question, but it sounds like you want to export user meta.

    For an optionable field like select, multiple select, etc, the combination of values is:

    User displayed value|database saved value

    When you pull the value for a user, it’s going to be the database saved value, so keep that in mind when setting up your fields. If you want to pull “apple”, then don’t make “fruit01” the saved value for “apple”. Just make it “apple” (i.e. apple|apple,).

    Thread Starter c3web

    (@c3web)

    Hi Chad,thanks your reply.

    User displayed value|database saved value

    I want to get User displayed value.

    My select fields is “Japanese|English”.
    (i.e. リンゴ|apple,)
    So,I want to export User displayed value.

    Is it possible by using wpmem_user_export_row?

    Thread Starter c3web

    (@c3web)

    The display of the management screen could be changed.

    https://qiita.com/Kazuya_Murakami/items/b7f8f647e7f518ab2dc6

    And i want to export this.
    thanks.

    Plugin Author Chad Butler

    (@cbutlerjr)

    Yes, if it’s a single value field (like “select” or radio), I think you could do something like the following:

    add_filter( 'wpmem_user_export_row', function( $row, $user_id ) {
    
        $meta = "fruits"; // the field's meta key
    
        $fields = wpmem_fields();
    
        $row[ $meta ] = $fields[ $meta ]['options'][ $row[ $meta ] ];
    
        return $row;
    }, 10, 2 );
    Thread Starter c3web

    (@c3web)

    Hi Chad,thanks your reply.
    Your answer is what I wanted!

    $row[ $meta ] = $fields[ $meta ][‘options’][ $row[ $meta ] ];

    I didn’t understand here. So thank you for your answer.

    Thank you for your help.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Can I export [“options”] data?’ is closed to new replies.