My code stopped working to get user ID of a user field

Support MB Frontend Submission My code stopped working to get user ID of a user field

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #39614
    YasmineYasmine
    Participant

    Hello,

    I used this rwmb_meta( 'MyFieldIDForAUserField','',$post->ID);
    And then use get_userdata() to get user info,

    But it has stopped working. I tried rwmb_get_value, but that then broke everything!!

    How do I now get the user ID of a selected user from a custom field? Thanks!

    #39641
    PeterPeter
    Moderator

    Hello Yasmine,

    Do you see any error messages on your site when getting the user data? What will display if you get the field user value?

    echo "<pre>";
    print_r( rwmb_meta( 'MyFieldIDForAUserField','',$post->ID) );
    echo "</pre>";

    and lastly, please update Meta Box to the latest version 5.6.13 and see if it works again.

    #39709
    YasmineYasmine
    Participant

    Hi Peter,

    I do not get anything with a print_r on a new template using a test post. But it is definitely the correct ID (with prefix included) and there is definitely a value in the test post to output. No error messages when trying to get the value.

    But I use elementor as my page builder, with the elementor dynamic conditions tool, I can successfully output the test post value. Does that use the rwmb_meta() ?

    I also checked in my code with a wp_mail(...sprintf()) and all the other fields had a value except this one and another number field where the value was also an integer.

    Many thanks,
    Yasmine

    #39849
    YasmineYasmine
    Participant

    Hi Peter,

    Its still not working. Do you know what else I can try?

    #39865
    PeterPeter
    Moderator

    Hello Yasmine,

    Please make sure you have the latest version of Meta Box 5.6.14 and Meta Box AIO 1.16.8 and check this issue again. If it does not help, please share your site credentials via this contact form https://metabox.io/contact/
    with the details of the issue. I will take a closer look.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.