• Is it possible to update custom fields from a php script?

    I have some (VFB Pro) forms in the WordPress site through which users can submit contributions for our magazine. I would like to be able to have custom fields (not editable by the user) which record whether a user has made a submission.

    It’s easy enough to store this information as regular WordPress metadata but I’d like to be able to pass the data through to Mailchimp (via Autochimp).

    https://wordpress.org/plugins/wp-members/

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

    (@cbutlerjr)

    Yes you can update WordPress metadata via php. But that’s a WP question, not WP-Members. If it’s user meta data, then use update_user_meta.

    Thread Starter aenea

    (@aenea)

    Sorry, didn’t make my original query clear. I am using WP-Members to create custom fields for users. I was wondering whether there were any WP-Member specific functions that would enable me to retrieve and update these fields through PHP scripts.

    Have solved the problem for myself, using
    $wpmem_fields=get_option( ‘wpmembers_fields’ )
    to get the indices of the WP-Member fields. It is this step that makes it a WP-Members query. Once I have this data, I am then able to use the standard Worpress functions to retrieve and update the relevant fields.

    get_user_meta( $user_id,$wpmem_fields[$x][2],’true’)
    retrieves the current vale of a particular field (where $x is the index of the field I want to get), and

    update_user_meta($user_id, $wpmem_fields[$x][2],$newvalue)
    will update the field.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can I update custom fields through php?’ is closed to new replies.