Support Forum ยป User Profile

Forum Replies Created

Viewing 15 posts - 3,121 through 3,135 (of 3,702 total)
  • Author
    Posts
  • 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'] );
    }
    in reply to: mb_settings_page_load?? #3699
    Anh TranAnh Tran
    Keymaster

    Sorry, that was a typo mistake. I've just updated the plugin with the fix. Please re-download it.

    Thanks
    Anh

    in reply to: โœ…Meta box for custom taxonomies not working #3698
    Anh TranAnh Tran
    Keymaster

    Hi @Unce,

    The custom fields for terms are displayed when you editing a term. Currently the plugin doesn't support show custom fields in the Add new page.

    in reply to: Activation Error #3688
    Anh TranAnh Tran
    Keymaster

    Just updated the extension with fix. Please download and try it.

    in reply to: Custom Taxonomy Content not Showing #3687
    Anh TranAnh Tran
    Keymaster

    Let me check that.

    in reply to: Activation Error #3685
    Anh TranAnh Tran
    Keymaster

    Are you using old version of the Meta Box plugin? This class is available since 4.8.0.

    in reply to: List all Meta Fields for current post #3684
    Anh TranAnh Tran
    Keymaster

    Just sent you an email ๐Ÿ™‚

Viewing 15 posts - 3,121 through 3,135 (of 3,702 total)