Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 2,701 through 2,715 (of 3,702 total)
  • Author
    Posts
  • in reply to: Disable functionality of WYSIWYG editor #6244
    Anh TranAnh Tran
    Keymaster

    Hi,

    I think the easier way to change the wysiwyg is using options parameter. Using filter is the last method you should think about. Of course this will work. I'll demonstrate both methods here:

    If you want to disable "Add Media" button, use this code:

    array(
        'type'    => 'wysiwyg',
        'name'    => 'Editor',
        'id'      => 'test_editor',
        'options' => array(
            'media_buttons' => false,
        ),
    ),

    If you want to disable the text mode), use this code:

    array(
        'type'    => 'wysiwyg',
        'name'    => 'Editor',
        'id'      => 'test_editor',
        'options' => array(
            'media_buttons' => false,
            'quicktags'     => false,
        ),
    ),

    If you want to disable visual mode, use this code:

    array(
        'type'    => 'wysiwyg',
        'name'    => 'Editor',
        'id'      => 'test_editor',
        'options' => array(
            'media_buttons' => false,
            'tinymce'       => false,
        ),
    ),

    Using filter is similar:

    add_filter( 'rwmb_wysiwyg_settings', function ( $settings ) {
        $settings['media_buttons'] = false;
        // $settings['tinymce']       = false;
        $settings['quicktags']     = false;
    
        return $settings;
    } );

    Note that using filter affects all wysiwyg fields. That's why it's more preferable to use field settings instead.

    in reply to: Google Map custom styles #6229
    Anh TranAnh Tran
    Keymaster

    FYI, the new version 4.12 of Meta Box fixed this. Please update.

    in reply to: Get an image url out of array #6222
    Anh TranAnh Tran
    Keymaster

    Hi,

    rwmb_meta( 'image_field_id' ) returns an array of image info. To get the URL of the image, simply use the code like this:

    $image_info = rwmb_meta( 'image_field_id', 'size=thumbnail' );
    echo $image_info['url']; // Thumbnail size URL
    echo $image_info['full_url']; // Full size URL
    in reply to: User role issue #6216
    Anh TranAnh Tran
    Keymaster

    Can you please try download again? I think I uploaded the wrong file.

    in reply to: User role issue #6211
    Anh TranAnh Tran
    Keymaster

    Hi,

    We probably haven't supported it yet. The user_role actually is the role for being edited users. It's not for the current user, who is editing. We'll update the extension to add more condition for the current user.

    in reply to: User role issue #6191
    Anh TranAnh Tran
    Keymaster

    Hi,

    Just realized that you asked about a field, not a meta box. The include / exclude extension works for meta boxes only, not for fields.

    So, in this situation, you probably need to use PHP code to check and register a field for a meta box. Something like:

    $fields = array(); // Define all your fields here
    if ( current_user_can( 'manage_options' ) ) {
        $fields[] = array(
            'type' => 'text',
            'name' => 'Custom field for admin only',
            'id'   => 'admin_only',
        );
    }
    
    // Register meta box
    $meta_boxes[] = array(
        'type'   => 'user',
        'title'  => 'Profile fields',
        'fields' => $fields,
    );
    in reply to: User role issue #6158
    Anh TranAnh Tran
    Keymaster

    The user_role is the role of the being edited users, not the current users. In this case, if you want to edit editor users, you need to set 'user_role' => 'editor'.

    in reply to: Cloned group with file_advanced field type #6157
    Anh TranAnh Tran
    Keymaster

    You can get file info with the helper function RWMB_File_Field::file_info( $file ), like this:

    $group = rwmb_meta('media');
    foreach($group as $data){
        $files = rwmb_meta($data['mb_file']);
        foreach($files as $file) {
            $file_data = RWMB_File_Field::file_info( $file );
            var_dump( $file_data );
        }
    }
    in reply to: Add to Select Box with PHP Loop #6144
    Anh TranAnh Tran
    Keymaster

    Hello,

    Do you want to get list of custom post types or list of posts of some custom post types?

    In 1st case, you can use the function get_post_types() to get all the post types:

    $options = array();
    $post_types = get_post_types( array(
        'public'   => true,
        '_builtin' => false
    ), 'objects' );
    foreach ( $post_types as $post_type ) {
        $options[$post_type->slug] = $post_type->name;
    }

    And in the select, just set 'options' => $options.

    In the 2nd case, you can use the field type post and set 'post_type' => 'your_post_type', and all the posts will be populated in the select option. For more info, please check this guide.

    Anh TranAnh Tran
    Keymaster

    Just updated the plugin with the fix you provided :).

    Thanks for your contribution.

    in reply to: Problem with clonable group? #6081
    Anh TranAnh Tran
    Keymaster

    Hi Hazmi, new versions for MB Settings Page is available. Please update. Let us know if you see any problem.

    Thanks

    in reply to: Problem with Featured Image Field #6071
    Anh TranAnh Tran
    Keymaster

    Hmm, does that work if you remove the field and use WordPress featured image instead?

    in reply to: Problem with clonable group? #6070
    Anh TranAnh Tran
    Keymaster

    Hi Hazmi,

    Please give us some hours to fix. Today or latest tomorrow we'll update the extension.

    Just a small question: while testing with your code, we see the remove clone button works. Can you post your full code here to test?

    in reply to: Image selection does not refresh/reset #6064
    Anh TranAnh Tran
    Keymaster

    Hi Phil,

    Thanks for your comment. We'll fix this bug soon.

    in reply to: Secure file upload #6063
    Anh TranAnh Tran
    Keymaster

    Unfortunately, the plugin uses WordPress media API and upload folder to store files. We have put this feature request in the plan and will work on that later.

Viewing 15 posts - 2,701 through 2,715 (of 3,702 total)