Support » Plugin: Cimy User Extra Fields » [Plugin: Cimy User Extra Fields] How to recover fields value to put them into page or post?

Viewing 8 replies - 1 through 8 (of 8 total)
  • $contactaddy1 = get_cimyFieldValue($authorID, ‘CONTACTADDY1’);
    $contactphone = get_cimyFieldValue($authorID, ‘CONTACTPHONE’);

    does this help ?

    My field does display on the user profile in the dashboard but not on the profile page on the site.

    Here is how I am trying to output a field called PHONENUMBER:

    <div class="details_fields">
    <label for="email"><?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount27']) ?></label>
    <input type="text" name="cimy_uef_PHONENUMBER" value="<?php get_user_meta($user_id,'cimy_uef_PHONENUMBER',true);?>" class="short right20" /><br />
    </div>

    Any tips appreciated

    Here is the line I needed for the value:

    echo get_cimyFieldValue($userdata->ID, 'PHONENUMBER'); ?>

    However this only displays the value and does not let me change it upon submit?

    Plugin Author Marco Cimmino

    (@cimmo)

    How about starting to read the documentation I wrote?

    I’m looking at the documentation and all I can see is that set_cimyFieldValue returns false if the value is already set.

    Is there a way to update a cimyFieldValue that has already been set?

    USAGE:

    $result = set_cimyFieldValue($user_id, $field_name, $field_value);

    RETURNED VALUE:
    An array is returned with all user ids where the change has been successful; empty array in case of error or the value is already in the DB.

    I wrote a couple of queries to do this manually in the end:

    $field_id = $wpdb->get_var(
        "
        SELECT ID
        FROM wp_cimy_uef_fields
        WHERE NAME = '$field_name'
        "
    );
    $update_status = $wpdb->update(
        'wp_cimy_uef_data', //table name
        array(
            'value' => $wpdb->escape($field_value)//value to update
        ),
        array(
            'field_id' => $field_id, //where clause
            'user_id' => $user_id
        )
    );

    This should let you update a cimy field using the field name and the user id.

    Plugin Author Marco Cimmino

    (@cimmo)

    I’m looking at the documentation and all I can see is that set_cimyFieldValue returns false if the value is already set.

    It works perfectly if you have or not a value set.
    Unless you describe a use case where I can reproduce the issue, for now I cannot.

    Plugin Author Marco Cimmino

    (@cimmo)

    This should let you update a cimy field using the field name and the user id.

    Your code works only for text and textarea[-rich] fields, it will save garbage for other fields.
    I discourage to use this buggy code (also unsafe since it doesn’t escape properly field’s name, and has ‘wp_’ hard coded, which is also wrong) and encourage to read the documentation and file proper issues with steps when it doesn’t work, adding the code used.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Cimy User Extra Fields] How to recover fields value to put them into page or post?’ is closed to new replies.