• Hello can anyone help me, I’m trying to code a couple of Ultimate Member fields into my Entry Wizard and I’m a numpty – I’ve done something [or a lot!] wrong. Please help!

    Below is what I have currently:

    defined( ‘ABSPATH’ ) or exit; // show a blank page if try to access this file directly

    add_action(‘init’, ‘ewz_extra_custom_class’, 10);

    function ewz_extra_custom_class(){
    class Ewz_Custom_Data
    {

    /* you may have up to 9 items here, called $custom1, $custom2 …. $custom9 */

    public $custom1;
    public $custom2;

    /* if needed, add more lines here for “$custom3”, “$custom4”, etc. */

    public static $data =
    array(
    ‘custom1’ => ‘Membership Number’,
    ‘custom2’ => ‘Grade’,

    /* if needed, add more lines here for “custom3”, “custom4”, etc. */

    );

    public function __construct( $user_id ){

    $this->custom1 = get_um_user(‘membership_number’);

    $this->custom2 = get_um_user(‘grade’);

    /* if needed, add more lines here for “custom3”, “custom4”, etc. */

    /* ( but note that too many items put an extra load on your server ) */
    }

    /* If you have a custom field that can only have a limited number of values, listing those */

    /* values here will allow you to choose items having those values in the Data Management */

    /* area of the Webforms page */

    public static function selection_list( $custom_field ){
    switch( $custom_field ){
    case ‘custom1’: return array( ); case ‘custom2’: return array( );

    /* if needed, add more lines here for “custom3”, “custom4”, etc. */

    default: return array();
    }
    }
    }
    }

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Josie Stauffer

    (@joanne123)

    I don’t know anything about Ultimate Member, but something is missing from the line
    $this->custom1 = get_um_user(‘membership_number’);
    — somehow, you need to pass in the user_id. At a guess something like
    get_um_user($user_id, ‘membership_number’);
    or
    get_um_user(‘membership_number’, $user_id);

    and the same for “grade”.

    Thread Starter vroom66

    (@vroom66)

    I found the below:
    <?php
    um_fetch_user( get_current_user_id() );
    echo um_user(‘display_name’); // returns the display name of logged-in user
    ?>

    I think that might be what I’m needing? It’s adding the columns happily enough and generating the spreadsheet but the fields are blank.

    Or maybe this still isn’t the right thing!

    Anybody who wants to help am happy to pay, would be great to get this working as it it’s a fabulous plugin.

    Thread Starter vroom66

    (@vroom66)

    Josie thanks so much – I’m getting so close it’s adding the columns but just not pulling the data in.

    The Ultimate Member people told me to use the below:

    um_fetch_user( get_current_user_id() );
    echo um_filtered_value(‘grade’);

    or for raw data with no formatting:

    echo get_user_meta(get_current_user_id(), ‘grade’, true);

    The plugin saves the data in the wp usermeta database so it could be pulled from there also as above I think.

    Is there anyone that can help me? Happy to pay?

    What I have at present:

    );

    public function __construct( $user_id ){

    $this->custom1 = um_fetch_user( get_current_user_id() );
    um_filtered_value(‘membership_number’);

    $this->custom2 = um_fetch_user( get_current_user_id() );
    um_filtered_value(‘grade_19’);

    This creates the data fields but doesn’t pull the data through.

    Most other things I have tried say there’s an error on Line 76, with an unexpected { or } [sorry can’t remember which way the bracket goes].

    Plugin Author Josie Stauffer

    (@joanne123)

    Without seeing the UM code, I can only make guesses at what it might be doing.
    But you could try:

    um_fetch_user( get_current_user_id() );
    $this->custom1 = um_filtered_value(‘membership_number’);
    $this->custom2 = um_filtered_value(‘grade_19’);

    If that doesn’t work, you would need to ask them for a single function call that returns the membership_number, and another that returns the grade.

    Thread Starter vroom66

    (@vroom66)

    What about calling the data straight from wp_usermeta as that’s where Ultimate Member stores it – is there a way to do that? Thanks.

    Plugin Author Josie Stauffer

    (@joanne123)

    If you know the meta_key that Ultimate Member uses for custom1, then use

    $this->custom1 = get_user_meta( $user_id, “meta_key_for_custom1”, true );

    etc.

    Sorry for delays in replying — I changed email addresses and forgot to update the one wordpress uses for notifications.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘EW EXTRA with Ultimate Member’ is closed to new replies.