Support Forum ยป User Profile

Forum Replies Created

Viewing 15 posts - 1,096 through 1,110 (of 3,958 total)
  • Author
    Posts
  • in reply to: โœ…Choose File in custom table #14754
    Anh TranAnh Tran
    Keymaster

    Probably you need to increase the length for the field. The value of image field is an array of IDs, which will be serialized before saving in the database.

    For example, if you have 2 images [12, 34], then the value will be a:2:{i:0;i:12;i:1;i:34;}. It's longer than what we think ๐Ÿ™‚

    in reply to: โœ…Limitations of select_tree (field_type) #14750
    Anh TranAnh Tran
    Keymaster

    Hi ComSi,

    Have you ever drag and drop the meta boxes? If you have, then WP will save the position/location of them and makes the "context" param not working. The data is saved in the user meta meta-box-order_{screen id}:

    https://imgur.elightup.com/A7bkxT9.png

    Deleting this user meta from the database will make the context work again.

    Please try that. It's the only reason I think affects the wrong location.

    in reply to: โœ…Choose File in custom table #14749
    Anh TranAnh Tran
    Keymaster

    Hi Dave,

    Storing ID seems better in my opinion. You can get full file info later with small piece of code. Storing file path doesn't have any benefit since it's the raw path on the server, which is unusable.

    in reply to: Set Selected by default in Radio box #14746
    Anh TranAnh Tran
    Keymaster

    Probably, you're on an old post or your meta box has already been saved. See this for more details:

    https://docs.metabox.io/field-settings/#default-value

    in reply to: Duplicate group fields feature #14745
    Anh TranAnh Tran
    Keymaster

    I see. That's an opinion. Some people want to start over again to select different options for the new clone. And the existing values might take them a lot of time deleting unnecessary values, especially the group has cloneable sub-groups.

    Each option will have pros and cons. It's a choice that we made from the beginning, and changing it won't be a reasonable solution for now.

    in reply to: Problem with rwmb_get_value #14744
    Anh TranAnh Tran
    Keymaster

    Hi Camilo,

    Actually, you are setting the field in opposite. The correct pattern should be:

    'value1' => 'Label 1',
    'value2' => 'Label 2'

    (It's the 'value' => 'Label', not 'key' => 'value').

    And the helper function returns the values, not labels.

    You can get the labels, you can do this:

    $field = rwmb_get_field_settings( 'field_id' );
    $options = $field['options'];
    
    // Get all labels.
    $values = rwmb_meta( 'field_id' );
    $labels = array_map( function( $value ) use ( $options ) {
        return $options[$value];
    }, $values );
    
    // Output labels.
    foreach ( $labels as $label ) {
        echo $label;
    }
    in reply to: โœ…Limitations of select_tree (field_type) #14743
    Anh TranAnh Tran
    Keymaster

    Hi ComSi,

    1. Context: this is set at meta box's level. Did you set for meta box or for the field?
    2. Multi-select: the documentation means the value saved for those field types are always multiple (you save both parent and children). But the selection for each level is only one. It's how the tree works.
    in reply to: โœ…Choose File in custom table #14742
    Anh TranAnh Tran
    Keymaster

    Hi Dave,

    All media fields store attachment IDs by default. If you want to store file URL (not path), then you can try file field with upload_dir settings. See this for details:

    https://docs.metabox.io/fields/file/#upload-to-custom-folder

    in reply to: โœ…MB Relationships display only post name #14741
    Anh TranAnh Tran
    Keymaster

    Hi,

    I think a way to get this done is add disabled attribute to the select dropdown. You can do that with this code:

    add_action( 'init', function() {
        $mb = rwmb_get_registry( 'meta_box' )->get( 'posts_to_pages_relationships_to' );
        $mb->meta_box['fields'][0]['attributes']['disabled'] = true;
    }, 99 );

    And maybe add some CSS to hide the "+ Add more" button and the delete clone button.

    in reply to: Duplicate group fields feature #14728
    Anh TranAnh Tran
    Keymaster

    I got it.

    There is a settings clone_default for each field if you want to clone default values. You can set the default value for the whole group (which is an array of default values for sub-fields). Then when cloning, these values will be selected automatically.

    For user-selected options, they will be cleared when cloning. It's the design at first, since it makes the new clone clean and easy to start entering new values.

    in reply to: Set Selected by default in Radio box #14724
    Anh TranAnh Tran
    Keymaster

    Hi Nuno,

    You just need to define the field like this:

    array(
      'id' => 'field_id',
      'name' => 'Gender',
      'options' => array(
        'm' => 'Man',
        'w' => 'Woman',
      ),
      'std' => 'm',
    )
    in reply to: Duplicate group fields feature #14723
    Anh TranAnh Tran
    Keymaster

    Do you mean duplicate a group in the MB Builder?

    in reply to: โœ…Input type image_advanced vs image #14700
    Anh TranAnh Tran
    Keymaster

    Please send me the account via Contact page.

    in reply to: rwmb_profile_after_process don't give user_id #14699
    Anh TranAnh Tran
    Keymaster

    Hi Ribano,

    Let me check that. In the latest version, I removed the user_id in some places to fix the security bug. I'll check this again.

    in reply to: โœ…geometry field is broken after today's update #14698
    Anh TranAnh Tran
    Keymaster

    Hi Sam,

    I mean you need to download the .zip package from Github and upload to your site, overwriting the current version. It's not yet available in the .org, so you can't update from .org at the moment.

Viewing 15 posts - 1,096 through 1,110 (of 3,958 total)