rwmb_get_field_settings with user (not logged)

Support General rwmb_get_field_settings with user (not logged)Resolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #38704
    Jean-Michel JunodJean-Michel Junod
    Participant

    I try to use the function rwmb_get_field_settings() to retrieve user custom fields options like this:

    $user_id=1;
    $choices = rwmb_get_field_settings( 'section', [ 'object_type' => 'user' ], $user_id )[ 'options' ];

    It works only if I'm logged into WP as a user, otherwise function returns empty.

    On the other end, this works properly, logged or not-logged:
    $section = rwmb_meta( 'section', ['object_type' => 'user'], $user_id )

    Purpose: I added custom fields to users that can be displayed on the front, and I want normal (non-logged) users to be able to see user's custom fields on front...

    #38713
    Long NguyenLong Nguyen
    Moderator

    Hi,

    It is possible that there is a plugin or a block of code that prevents the non-logged in user to view the field settings on your site. I do not see that on my local site, please check this screenshot https://monosnap.com/file/URvMeBWjg6BZSB6Zwgk0f7ptHHQBIl

    #38722
    Jean-Michel JunodJean-Michel Junod
    Participant

    Hi Long and thanks for the quick answer!

    Sorry for disturbance, indeed you were right, a block of deep code was the culprit... problem fixed.

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