Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 3,121 through 3,135 (of 3,708 total)
  • Author
    Posts
  • Anh TranAnh Tran
    Keymaster

    Can you just try [rwmb_meta meta_key=“YOUR META KEY” taxonomy=“presenter”]? I see you missed meta_key.

    Anh TranAnh Tran
    Keymaster

    Hi,

    You can use custom_html field. It allows you add custom HTML code for a field via the std param. So you can enter the embeded code of the video for the field. It can’t be edited.

    in reply to: Google Maps API error: MissingKeyMapError #3762
    Anh TranAnh Tran
    Keymaster

    Hi Nick,

    The development version on Github has a fix for this. It adds a new param for map field api_key where you should enter your Google Maps API key. It actually doesn’t relate with the Group extension, so the error must be somewhere else. Can you please post the error here?

    Thanks
    Anh

    in reply to: Multi-Site Usage... #3751
    Anh TranAnh Tran
    Keymaster

    Thanks, I will check it.

    in reply to: Multi-Site Usage... #3747
    Anh TranAnh Tran
    Keymaster

    Hi,

    Do you see any error in the MB Builder screen?

    in reply to: How to retreive subfield value #3737
    Anh TranAnh Tran
    Keymaster

    Hi @Ivo,

    The 'Supplementary Information' is a child field of the parent group, so you have to access to its value through the parent value, like this:

    $group = rwmb_meta( 'saq_id' );
    $supplementary = isset( $group['supplementary'] ) ? $group['supplementary'] : array();
    foreach ( $supplementary as $single_supplementary ) {
        $value = isset( $single_supplementary['sub_text'] ) ? $single_supplementary['sub_text'] : '';
        echo $value;
    }

    Just think about group and sub-group as a hierarchy, everything will be clear 🙂

    in reply to: Custom columns #3735
    Anh TranAnh Tran
    Keymaster

    Yes, but that requires some custom code. Here is what I tried:

    - In your plugin file or theme's functions.php add this code:

    add_action( 'admin_init', 'prefix_custom_post_column', 20 );
    function prefix_custom_post_column() {
    	require_once 'custom.php';
    	new Test_Admin_Columns( 'post', array() );
    }

    - Create a new file custom.php and enter the following code:

    class Test_Admin_Columns extends MB_Admin_Columns_Post {
    	public function columns( $columns ) {
    		$columns = parent::columns( $columns );
    
    		/**
    		 * Add more column in a specific position
    		 *
    		 * @param string $position New column position. Empty to not specify the position. Could be 'before', 'after' or 'replace'
    		 * @param string $target The target column. Used with combination with $position
    		 */
    		$position = '';
    		$target   = '';
    		$this->add( $columns, 'column_id', 'Column Title', $position, $target );
    
    		// Add more if you want
    
    		return $columns;
    	}
    
    	public function show( $column, $post_id ) {
    		switch ( $column ) {
    			case 'column_id':
    				echo 'Column content';
    				break;
    			// More columns
    		}
    	}
    }

    Note that the call new Test_Admin_Columns( 'post', array() ); is specific for post. You can change it to any custom post type if you want.

    in reply to: Meta box for custom taxonomies not working #3722
    Anh TranAnh Tran
    Keymaster

    Yes, I do. Will release it as soon as I find a solution for ajax handling 🙂

    in reply to: Cannot manage to work with a Select field in group #3721
    Anh TranAnh Tran
    Keymaster

    Did you set value for $var_options? Here is my test:

    <?php
    add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
    function your_prefix_register_meta_boxes( $meta_boxes ) {
        $prefix       = 'mbox_';
        $var_options  = array(
            'a' => 'First option',
            'b' => 'Second option',
        );
        $meta_boxes[] = array(
            'title' => esc_html__( 'Standard Fields', 'your-prefix' ),
    
            'fields' => array(
                array(
                    'name'       => esc_html__( 'Depends of', 'pbc' ),
                    'id'         => "{$prefix}depends",
                    'type'       => 'group',
                    'clone'      => true,
                    'sort_clone' => true,
                    'fields'     => array(
                        // SELECT BOX VARIATIONS
                        array(
                            'name'        => __( 'Variation', 'pbc' ),
                            'id'          => "{$prefix}depvar",
                            'type'        => 'select',
                            'options'     => $var_options,
                            'multiple'    => false,
                            'std'         => '',
                            'placeholder' => __( 'Select a Variation', 'pbc' ),
                        ),
                    ),
                ), //array
            ),
        );
    
        return $meta_boxes;
    }

    And here is the result:

    http://prntscr.com/bvycei

    in reply to: Invalid argument foreach() #3720
    Anh TranAnh Tran
    Keymaster

    Hi Cristian,

    I've just tested with your code and it works for me: http://prntscr.com/bvyab5

    Looks like the saved value doesn't have a correct format. Did you have value for the group before? Something like you set up the group, entered a value, and then changed the group settings. That probably makes the old saved data not compatible with the new settings.

    in reply to: clone.js Code Issue #3719
    Anh TranAnh Tran
    Keymaster

    Hi @jpomranky,

    Can you please check the version of the Group extension you're using? I think I fixed this bug in the extension and keep the clone.js file untouched.

    in reply to: Check witch field has been updated #3718
    Anh TranAnh Tran
    Keymaster

    Hi Nicolas,

    You can store the changed fields and then process the log when the post is saved. Here is what I suggest:

    class MB_Log {
        protected $fields = array();
    
        public function __construct() {
            add_filter( 'rwmb_value', array( $this, 'check_field_change' ), 20, 3 );
            add_action( 'rwmb_after_save_post', array( $this, 'log' ) );
        }
    
        public function check_field_change( $new, $field, $old ) {
            if ( $new !== $old ) {
                $this->fields[] = $field;
            }
    
            return $new; // Do not change the value
        }
    
        public function log() {
            foreach ( $this->fields as $field ) {
                // Log
            }
        }
    }
    in reply to: Check witch field has been updated #3711
    Anh TranAnh Tran
    Keymaster

    Hi Nicolas,

    I think you can hook to rwmb_value like this:

    add_filter( 'rwmb_value', 'prefix_check_field_change', 20, 3 );
    function prefix_check_field_change( $new, $field, $old ) {
        if ( $new !== $old ) {
            // Log
        }
        return $new; // Do not change the value
    }
    in reply to: Max clone does not work if I have subgroup #3710
    Anh TranAnh Tran
    Keymaster

    Thanks for reporting. I will check it.

    in reply to: How to display clone fields subgroup #3709
    Anh TranAnh Tran
    Keymaster

    The $contact['phone'] is an array, so you need to loop for it:

    // Echo name, email
    if ( ! empty( $contact['phone'] ) ) {
        echo '<p><label>', __( 'Phone numbers:', 'textdomain' ), '<label> ';
        foreach ( $contact['phone'] as $k => $phone ) {
            echo $k ? ', ' : '', $phone;
        }
        // Or faster
        echo implode( ', ', $contact['phone'] );
    }
Viewing 15 posts - 3,121 through 3,135 (of 3,708 total)