Support Forum » User Profile

Forum Replies Created

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • in reply to: Problems with update from 4.8.7 to 4.9.6 #4404
    MikeTrebilcockMikeTrebilcock
    Participant

    Sorry for the slow reply.

    Just made the changes you suggested and it seems to have done the trick.
    Many thanks for you help with this one.

    Cheers

    in reply to: Map not displaying in the front end #3529
    MikeTrebilcockMikeTrebilcock
    Participant

    Dont worry it seems to be fixed!

    in reply to: Script errors when upgrading from metabox 4.5 > 4.8 #3520
    MikeTrebilcockMikeTrebilcock
    Participant

    All sorted, thanks so much for your help.

    in reply to: Script errors when upgrading from metabox 4.5 > 4.8 #3502
    MikeTrebilcockMikeTrebilcock
    Participant

    Found the problem, or worked round it at least.
    the problem was around JS validation, so once I had commented out this section, it worked:

    
    // VALIDATION =================
    		'validation' => array(
    			'rules'    => array(
    				"{$prefix}ref_code" => array(
    					'required'  => true,
    				),
    				/*"{$prefix}cluster[]" => array(
    					'required'  => true,
    				),                
    				"{$prefix}level_taxonomy[]" => array(
    					'required'  => true,
    				),      
    				"{$prefix}campuses[]" => array(
    					'required'  => true,
    				),             
    				"{$prefix}brands[]" => array(
    					'required'  => true,
    				),           */         
    			),
    			// optional override of default jquery.validate messages
    			'messages' => array(
    				"{$prefix}master_code" => array(
    					'required'  => __( 'Course Master Code is required', 'master_code' ),
    				),
    				/*"{$prefix}cluster[]" => array(
    					'required'  => __( 'A Learning Area is required', 'cluster' ),
    				),                   
    				"{$prefix}level_taxonomy[]" => array(
    					'required'  => __( 'Course Level is required', 'level_taxonomy' ),
    				),             
    				"{$prefix}campuses[]" => array(
    					'required'  => __( 'A Campus is required' ),
    				),
    				"{$prefix}brands[]" => array(
    					'required'  => __( 'A brand is required' ),
    				),         */         
    			)
    		)           
            
    	);
    

    not sure if this is an issue with my code or the loop though the validation rules is it was fine with the first rule, but I should be able to work round it adding the 'required' => true, to the field itself.

    in reply to: Script errors when upgrading from metabox 4.5 > 4.8 #3457
    MikeTrebilcockMikeTrebilcock
    Participant

    Hi, Thanks for the reply.
    added those lines to the config and updated metabox and now get this(in the console) when in the post edit screen:

    
    JQMIGRATE: Migrate is installed with logging active, version 1.4.0
    jquery-migrate.js?ver=1.4.0:45 JQMIGRATE: jQuery.fn.live() is deprecated
    jquery-migrate.js?ver=1.4.0:47 console.trace()migrateWarn @ jquery-migrate.js?ver=1.4.0:47
    jquery.js?ver=1.12.3:2 
    Uncaught Error: Syntax error, unrecognized expression: #course_cluster[]
    

    Not sure if this helps, I thought the same thing regarding course_cluster[] I can't find it referenced anywhere.

    in reply to: Script errors when upgrading from metabox 4.5 > 4.8 #3449
    MikeTrebilcockMikeTrebilcock
    Participant

    Sorry this is going to be quite a chunk of code....

    
    <?php
    add_filter( 'rwmb_meta_boxes', 'course_register_meta_boxes' );
    
    function course_register_meta_boxes( $meta_boxes )
    {
        $prefix = 'course_';
        
        // Course types set by slug
        $he = get_term_by('slug', 'he', 'course_type');
        $he = $he->term_id;
        
        $fe16_18 = get_term_by('slug', 'fe16_18', 'course_type'); 
        $fe16_18 = $fe16_18->term_id;
        
        $fe19plus = get_term_by('slug', 'fe19plus', 'course_type');
        $fe19plus = $fe19plus->term_id;
        
        $b2b = get_term_by('slug', 'b2b', 'course_type');
        $b2b = $b2b->term_id;
        
        $apprentice = get_term_by('slug', 'apprentice', 'course_type');
        $apprentice = $apprentice->term_id;
        
        $alc = get_term_by('slug', 'alc', 'course_type');
        $alc = $alc->term_id;    
        
    	$meta_boxes[] = array(
    		'id'         => 'he_subtitle',
    		'title'      => __( 'Sub-Title'),
            'post_types' => 'courses', 
    		'priority'   => 'high',
    		'autosave'   => true,
            'context'    => 'side',
            'visible' => array('course_type_select', 'in', "{$he},{$fe19plus},{$fe16_18}"),
    		'fields'     => array(
    			// Course referance code
    			array(
    				'name'  => __( '' ),
    				'id'    => "{$prefix}he_subtitle",
    				'desc'  => __( 'HE sub-title (Year of entry) or Subsidiary title for FE Courses' ),
    				'type'  => 'text',
    			),
            ),
        );
        
        // course type
    	$meta_boxes[] = array(
    		'title'  => __( 'Course Type'),
            'post_types' => 'courses', 
            'context'    => 'side', 
            'post_types' => 'courses', 
    		'priority'   => 'high',
    		'autosave'   => true,        
    		'fields' => array(
    			// COURSE TYPE CHECKBOX LIST 
    			array(
    				'name'    => __( ''),
    				'id'      => "{$prefix}type_select",
    				'type'    => 'taxonomy',
                    'required'  => true,
    				'taxonomy' => 'course_type',
    				'field_type'  => 'select_advanced',
    				'js_options'  => array( 'multiple' => true, ),
    				'multiple'    => true,
                ),
    
                        
                        //KIS code
                        array(
                            'name'  => __( 'KIS CODE', 'kis_code' ),
                            'id'    => "{$prefix}kis_code",
                            'visible' => array('course_type_select', 'in', "{$he}"),
                            'type'  => 'number',
                        ),  
                        //KIS institution code
                        array(
                            'name'  => __( 'KIS institution CODE' ),
                            'id'    => "{$prefix}kis_institution_code",
                            'visible' => array('course_type_select', 'in', "{$he}"),   
                            'type'  => 'number',
                        ),     
                        //UCAS Course Code
                        array(
                            'name'  => __( 'UCAS Course CODE' ),
                            'id'    => "{$prefix}ucas_course_code",
                            'visible' => array('course_type_select', 'in', "{$he}"),                 
                            'type'  => 'text',
                            'attributes' => array(
                                'maxlength' => 4,
                            ),                        
                        ), 
                        //UCAS institution code
                        array(
                            'name'  => __( 'UCAS Institution CODE' ),
                            'id'    => "{$prefix}ucas_institution_code",
                            'type'  => 'select',
                            'visible' => array('course_type_select', 'in', "{$he}"),                
                            'placeholder' => __( 'Please select...' ),
                            'options'  => array(
                                'B18' => __( 'Bicton College (Plymouth)', '' ),
                                'CORN C78' => __( 'Cornwall College', '' ),
                                'DUCHY D55' => __( 'Duchy College', '' ),
                            ),
                        ), 
                        //HE Course FEES
                        array(
                            'name'  => __( 'Course Fee', 'he_course_fee' ),
                            'id'    => "{$prefix}he_course_fee",
    				        'type' => 'number',
                            'desc'  => __( '(per annum)' ),
                            'visible' => array('course_type_select', 'in', "{$he}"),  'attributes' => array(
                            ),                        
                        ),              
                    ),
               
           
        );          
        
    //Course structure in the sidebar    
    	$meta_boxes[] = array(
    		'id'         => 'course_structure',
    		'title'      => __( 'Course Structure', 'course_structure' ),
            'post_types' => 'courses', 
            'context'    => 'side',   
    		'priority'   => 'low',
    		'autosave'   => true,
    		'fields'     => array(
    			// Course referance code
    			array(
    				'name'  => __( 'Course Reference Code', 'ref_code' ),
    				// Field ID, i.e. the meta key(prefixed with course_)
    				'id'    => "{$prefix}ref_code",
    				'desc'  => __( 'Course reference code' ),
    				'type'  => 'text',
    			),
    			// learning area TAXONOMY
    			array(
    				'name'    => __( 'Learning Area:' ),			
    				'id'   => "{$prefix}cluster",
    				'type' => 'taxonomy',
    				'taxonomy'    => 'cluster',
    				'field_type'  => 'select_advanced',
    				'query_args'  => array(),
    				'js_options'  => array( 'multiple' => true, ),
    				'multiple'    => true,
    				'placeholder' => 'Select area...',
    			),			
    			           
    			// Level TAXONOMY
    			array(
    				'name'    => __( 'Course Level', 'level' ),
    				'id'      => "{$prefix}level_taxonomy",
    				'type'    => 'taxonomy',
                    'required'  => true,
    				'field_type' => 'select',
    				'taxonomy' => 'level',				
    				'query_args'  => array(),
    
    			),    
                //Campus TAXONOMY 
    			array(
    				'name'    => __( 'This course is avalible at:', 'campuses' ),
    				'id'      => "{$prefix}campuses",
    				'type'    => 'taxonomy',
    				'taxonomy' => 'campus',
    				'field_type'  => 'select_advanced',
    				'js_options'  => array( 'multiple' => true, ),
    				'multiple'    => true,				
    				'query_args'  => array(),
    			),
    			// brand TAXONOMY
    			array(
    				'name'    => __( 'Course Brand(s):', 'brands' ),
    				'id'      => "{$prefix}brands",
    				'type'    => 'taxonomy',
    				'taxonomy' => 'brand',
    				'field_type'  => 'select_advanced',
    				'js_options'  => array( 'multiple' => true, ),
    				'multiple'    => true,
    				'query_args'     => array(),
    		
    			), 
                array(
    				'name'    => __( ''),
    				'id'      => "{$prefix}trail_blazer",
    				'type'    => 'radio',
                    'visible' => array('course_type_select', 'in', "{$apprentice}"),
    				'options' => array(
                        'true' => 'Trail Blazer'
                    ),
                ),            
    		),
            
    // VALIDATION =========================================================================================================
    		'validation' => array(
    			'rules'    => array(
    				"{$prefix}ref_code" => array(
    					'required'  => true,
    				),
    				"{$prefix}cluster[]" => array(
    					'required'  => true,
    				),                   
    				"{$prefix}level_taxonomy[]" => array(
    					'required'  => true,
    				),      
    				"{$prefix}campuses[]" => array(
    					'required'  => true,
    				),             
    				"{$prefix}brands[]" => array(
    					'required'  => true,
    				),                 
    			),
    			// optional override of default jquery.validate messages
    			'messages' => array(
    				"{$prefix}master_code" => array(
    					'required'  => __( 'Course Master Code is required', 'master_code' ),
    				),
    				"{$prefix}cluster[]" => array(
    					'required'  => __( 'A Learning Area is required', 'cluster' ),
    				),                    
    				"{$prefix}level_taxonomy[]" => array(
    					'required'  => __( 'Course Level is required', 'level_taxonomy' ),
    				),             
    				"{$prefix}campuses[]" => array(
    					'required'  => __( 'A Campus is required' ),
    				),
    				"{$prefix}brands[]" => array(
    					'required'  => __( 'A brand is required' ),
    				),                 
    			)
    		)           
            
    	);
        
    	$meta_boxes[] = array(
    		'id'         => 'course_info_area',
    		'title'      => __( 'Course Information' ),
            'post_types' => 'courses', 
    		'priority'   => 'high',
    		'autosave'   => true,
            //'context'    => 'side',
            'hidden' => array('course_type_select', 'in', "{$he},{$alc}"),        
    		'fields' => array( 
                //Ideal if..
    			array(
    				'name'    => __( 'Ideal if', 'ideal_if' ),
    				'id'      => "{$prefix}ideal_if",
    				'type'    => 'wysiwyg',
                    'desc'  => 'Summary of what you get',
    				'hidden' => array('course_type_select', 'in', "{$apprentice}"),
    				'raw'     => false,
    				'options' => array(
    					'textarea_rows' => 4,
    					'teeny'         => true,
    					'media_buttons' => false,
    				),
    			),               
    			// will need...
    			array(
    				'name'    => __( 'Will Need', 'will_need' ),
    				'id'      => "{$prefix}will_need",
    				'type'    => 'wysiwyg',
                    'desc'  => 'Entry requirements', 
    				'raw'     => false,
    				'options' => array(
    					'textarea_rows' => 4,
    					'teeny'         => true,
    					'media_buttons' => false,
    				),
    			),  
    			// will learn...
    			array(
    				'name'    => __( 'Will Learn', 'will_learn' ),
    				'id'      => "{$prefix}will_learn",
    				'type'    => 'wysiwyg',
                    'desc'  => 'List of core topics and skills',                
    				'raw'     => false,
    				'options' => array(
    					'textarea_rows' => 4,
    					'teeny'         => true,
    					'media_buttons' => false,
    				),
    			),      
    			// expect...
    			array(
    				'name'    => __( 'Expect', 'expect' ),
    				'id'      => "{$prefix}expect",
    				'type'    => 'wysiwyg',
                    'desc'  => 'This is a chance to talk about the learning experience and structure',  
                    'hidden' => array('course_type_select', 'in', "{$apprentice}"),
    				'raw'     => false,
    				'options' => array(
    					'textarea_rows' => 4,
    					'teeny'         => true,
    					'media_buttons' => false,
    				),
    			),    
    			// will love...
    			array(
    				'name'    => __( 'Will Love', 'will_love' ),
    				'id'      => "{$prefix}will_love",
    				'type'    => 'wysiwyg',
                    'desc'  => 'Any course spercific selling points',  
                    'hidden' => array('course_type_select', 'in', "{$apprentice}"),
    				'raw'     => false,
    				'options' => array(
    					'textarea_rows' => 4,
    					'teeny'         => true,
    					'media_buttons' => false,
    				),
    			),
    			// go to...
    			array(
    				'name'    => __( 'Go On To', 'go_to' ),
    				'id'      => "{$prefix}go_to",
    				'type'    => 'wysiwyg',
                    'desc'  => 'Progression routes',                
    				'raw'     => false,
                        'options' => array(
                            'textarea_rows' => 4,
                            'teeny'         => true,
                            'media_buttons' => false,
                        ),
                    ),
                //go to (course progression select)
    			array(
    				'name'        => __( 'Progression Courses' ),
    				'id'          => "{$prefix}progression",
    				'type'        => 'post',
    				'post_type'   => 'courses',
    				// Field type, either 'select' or 'select_advanced' (default)
    				'field_type'  => 'select_advanced',
    				'placeholder' => __( 'Select a course' ),
    				// Query arguments (optional). No settings means get all published posts
    				'query_args'  => array(
    					'post_status'    => 'publish',
    					'posts_per_page' => - 1,
    			     ),
                    'clone' => true,
                ),       
                
            ),
        );
        
        
                //Similar courses to this one (course select)
        $meta_boxes[] = array(
    		'title'  => __( 'Similar courses to this one' ),
            'post_types' => 'courses', 
            'context'    => 'normal',   
            'priority'   => 'low',
    		'fields' => array(     
    			array(
    				'name'        => __( 'Select a similar course' ),
    				'id'          => "{$prefix}similar_courses",
    				'type'        => 'post',
    				'post_type'   => 'courses',
    				// Field type, either 'select' or 'select_advanced' (default)
    				'field_type'  => 'select_advanced',
    				'placeholder' => __( 'Select a course' ),
    				// Query arguments (optional). No settings means get all published posts
    				'query_args'  => array(
    					'post_status'    => 'publish',
    					'posts_per_page' => - 1,
    			     ),
                    'clone' => true,
                ),  
            ),
        );          
        
        
    // Course Video Gallery    
        $meta_boxes[] = array(
    		'title'  => __( 'Course Video Gallery' ),
            'post_types' => 'courses', 
            'context'    => 'normal',   
            'priority'   => 'low',
    		'fields' => array(    
     			// OEMBED
    			array(
    				'name' => __( 'oEmbed', 'your-prefix' ),
    				'id'   => "{$prefix}video_gallery",
    				'desc' => __( 'paste your embed code to link videos' ),
    				'type' => 'oembed',
                    'clone' => true, 
    			),
            ),
    	);              
    // Course image gallery upload
        
        // PLUPLOAD IMAGE UPLOAD (WP 3.3+)
        $meta_boxes[] = array(
    		'title'  => __( 'Course Gallery', 'gallery' ),
            'post_types' => 'courses', 
            'context'    => 'normal',   
            'priority'   => 'low',
    		'fields' => array(
                array(
    				'name'             => __( '', 'course-gallery' ),
    				'id'               => "{$prefix}plupload",
    				'type'             => 'plupload_image',
                    'desc'  => __( 'File Size 1mb MAX' ),
    				'max_file_uploads' => 10,
    			),
    		)
    	);        
     // Course start date and location group
         $meta_boxes[] = array(
    		'title'  => __( 'Course Offering Dates', 'course_offerings' ),
            'post_types' => 'courses', 
            'context'    => 'normal',   
            'priority'   => 'low',     
    		'fields' => array(
                    // Group
                    array(
                        //'name' => 'Start Dates', // Optional
                        'id' => 'course_offering',
                        'type' => 'group',
    				    'clone'  => true,
    				    'sort_clone' => true,                    
                        // List of sub-fields
                        'fields' => array(
                            //offering title
                            array(
                                'name'  => __( 'Offering Title', 'offering_title' ),
                                'id'    => "{$prefix}offering_title",
                                'type'  => 'text',
                            ),  
                            // Course offering code
                            array(
                                'name'  => __( 'Course Offering Code', 'offer_code' ),
                                // Field ID, i.e. the meta key(prefixed with course_)
                                'id'    => "{$prefix}offer_code",
                                'desc'  => __( 'Course offering code' ),
                                'type'  => 'text',
                                'required'  => true,
                            ), 
                            // Long course (September start with current year)
                            array(
                                'name' => esc_html__( 'Long Course with September Start' ),
                                'id'   => "{$prefix}long_course",
                                'type' => 'checkbox',
                                'desc'  => __( 'Tick this if this offer has a Septmber start every Year (this will remove start and end date options)' ),
                                // Value can be 0 or 1
                                'std'  => 0,
                            ),                        
                                                    
                            //offering start date
                            array(
                                'name'       => __( 'Course Start Date', 'course_start_date' ),
                                'id'         => "{$prefix}date",
                                'type'       => 'date',
                                'required'  => true,
                                'visible' => array("{$prefix}long_course", false),
                                // jQuery date picker options. See here http://api.jqueryui.com/datepicker
                                'js_options' => array(
                                    'appendText'      => __( '(dd-mm-yyyy)' ),
                                    'dateFormat'      => __( 'dd-mm-yy' ),
                                    'changeMonth'     => true,
                                    'changeYear'      => true,
                                    'showButtonPanel' => true,
                                ),
                            ),      
                            //offering campus location
                            array(
                                'name'    => __( 'This course is avalible at:', 'offering_campuses' ),
                                'id'      => "{$prefix}offering_campus",
                                'required'  => true,
                                'type'    => 'taxonomy',
                                'options' => array(
                                    // Taxonomy name
                                    'taxonomy' => 'campus',
                                    // How to show taxonomy: 'checkbox_list' (default) or 'checkbox_tree', 'select_tree', select_advanced or 'select'. Optional
                                    'type'     => 'select',
                                    'id'      => "offering_campus",
                                    // Additional arguments for get_terms() function. Optional
                                    'args'     => array()
                                ),                        
                            ),
    
                            //course duration
                            array(
                                'name'  => __( 'Duration', 'your-prefix' ),
                                'id'    => "{$prefix}duration",
                                // Field description (optional)
                                'desc'  => __( 'e.g. 3 day course', 'duration' ),
                                'type'  => 'text',
                                'required'  => true,
                                // Default value (optional)
                                //'std'   => __( 'Default text value', 'duration' ),
                                // CLONES: Add to make the field cloneable (i.e. have multiple value)
                            ), 
                            // off site?
                            array(
                                'name'    => __( 'This course is off site?', 'off_site_check' ),
                                'id'      => "{$prefix}off_site_check",
                                'type'    => 'checkbox',
                                'std'  => 0,
                            ),
                            // days of the week !*--FE, ALC ONLY--*!
                            array(
                                'name'    => __( 'Day(s) of the week', 'course_days_of_week' ),
                                'id'      => "course_days_of_week",
                                'visible' => array('course_type_select', 'in', "{$fe19plus},{$alc}"),       
                                'type'    => 'checkbox_list',
                                'std'  => 0,
                                // Options of checkboxes, in format 'value' => 'Label'
                                    'options' => array(
                                        'mon' => __( 'Monday'),
                                        'tue' => __( 'Tuesday'),
                                        'wed' => __( 'Wednesday'),
                                        'thu' => __( 'Thursday'),
                                        'fri' => __( 'Friday'),
                                        'sat' => __( 'Saturday'),
                                    ),
                            ),   
                            // Course Start TIME !*--FE, ALC ONLY--*!
                            array(
                                'name'       => __( 'Course Start Time' ),
                                'id'         => $prefix . 'start_time',
                                'visible' => array('course_type_select', 'in', "{$fe19plus},{$alc}"),      
                                'type'       => 'time',
                                // jQuery datetime picker options.
                                // For date options, see here http://api.jqueryui.com/datepicker
                                // For time options, see here http://trentrichardson.com/examples/timepicker/
                                'js_options' => array(
                                    'stepMinute' => 5,
                                    'showSecond' => true,
                                    'stepSecond' => 10,
                                ),
                            ),
                            // Course End TIME !*--FE ONLY--*!
                            array(
                                'name'       => __( 'Course End Time' ),
                                'id'         => $prefix . 'end_time',
                                'visible' => array('course_type_select', 'in', "{$fe19plus},{$alc}"), 
                                'type'       => 'time',
                                // jQuery datetime picker options.
                                // For date options, see here http://api.jqueryui.com/datepicker
                                // For time options, see here http://trentrichardson.com/examples/timepicker/
                                'js_options' => array(
                                    'stepMinute' => 5,
                                    'showSecond' => true,
                                    'stepSecond' => 10,
                                ),
                            ),  
                            // DIVIDER
                            array(
                                'type' => 'divider',
                                'id'   => 'fake_divider_id', // Not used, but needed
                            ),        
    						// Additional Information
    						array(
    							'name' => __( 'Additional Information' ),
    							'desc' => __( 'Extra course information about this offering' ),
    							'id'   => "{$prefix}add-offer-info",
    							'type' => 'textarea',
    							'cols' => 20,
    							'rows' => 4,
    						),		
    										
                            // DIVIDER
                            array(
                                'type' => 'divider',
                                'id'   => 'fake_divider_id', // Not used, but needed
                            ), 			
    						                  
                            //course cost for ALC
                            array(
                                'name' => __( 'Course Cost' ),
                                'id'   => "{$prefix}offer_cost",
                                'type' => 'number',
                                'desc'  => __( 'enter a course cost in pounds (30.50)you DO NOT PREPEND with £', 'duration' ),                            
                                'visible' => array('course_type_select', 'in', "{$alc}"),                             
                                'min'  => 0,
                                'step' => 5,
                            ),                        
                            // Map requires at least one address field (with type = text)
                            array(
                                'id'   => 'address',
                                'name' => __( 'Address', 'your-prefix' ),
                                'type' => 'text',
                                'std'  => __( 'Trevenson Rd, Pool, Redruth, Cornwall TR15 3PG, UK', 'map' ),
                                'visible' => array("off_site_check", true)
    
                            ),
                            array(
                                'id'            => 'map',
                                'name'          => __( 'Location'),
                                'type'          => 'map',
                                // Default location: 'latitude,longitude[,zoom]' (zoom is optional)
                                //'std'           => '-6.233406,-35.049906,15',
                                // Name of text field where address is entered. Can be list of text fields, separated by commas (for ex. city, state)
                                'address_field' => 'address',
                                'visible' => array("off_site_check", true)
                            ),
    
                            
                    ),            
                ),
            )
        );
        
    /* HE COURSE Module information WYSIWYG */
    	$meta_boxes[] = array(
    		'id'         => 'he_area',
    		'title'      => __( 'HE Course Information', 'he_area' ),
            'post_types' => 'courses', 
    		'priority'   => 'low',
    		'autosave'   => true,
            //'context'    => 'side',
            'visible' => array('course_type_select', 'in', "{$he}"),       
    		'fields' => array( 
    			// HE Module Information
                array(
                    'name'    => __( 'HE Entry Requirements' ),
                    'id'      => "{$prefix}he_entry_requirements",
                    'type'    => 'wysiwyg',
                    //'desc'  => 'List of modules',                            
                    // Set the 'raw' parameter to TRUE to prevent data being passed through wpautop() on save
                    'raw'     => false,
                    // Editor settings, see wp_editor() function: look4wp.com/wp_editor
                    'options' => array(
                        'textarea_rows' => 10,
                        'media_buttons' => false,
                    ),
                ),  
    			// DIVIDER
    			array(
    				'type' => 'divider',
    				'id'   => 'fake_divider_id', // Not used, but needed
    			),              
                    // Group
                    array(
                        'name' => 'Module Information',
                        'id' => 'module_information',
                        'type' => 'group',
    				    'clone'  => true,
    				    'sort_clone' => true,                    
                        // List of sub-fields
                        'fields' => array( 
                            array(
                                'name'  => 'Module Group Title',
                                'desc'  => 'Year/Options etc.',
                                'id'    => $prefix . 'module_group_title',
                                'type'  => 'text',
                            ),                        
                            array(
                                'name'    => __( 'Module Details' ),
                                'id'      => "{$prefix}he_module_detail",
                                'type'    => 'wysiwyg',
                                'desc'  => 'List of modules',                            
                                // Set the 'raw' parameter to TRUE to prevent data being passed through wpautop() on save
                                'raw'     => false,
                                // Editor settings, see wp_editor() function: look4wp.com/wp_editor
                                'options' => array(
                                    'textarea_rows' => 6,
                                    'media_buttons' => false,
                                ),
                            ),
                        ),
                    ),
    			// DIVIDER
    			array(
    				'type' => 'divider',
    				'id'   => 'fake_divider_id', // Not used, but needed
    			),            
                // HE Progression Courses
    			array(
    				'name'        => __( 'Progression Courses' ),
    				'id'          => "{$prefix}he_progression",
                    'visible' => array('course_type_select', 'in', "{$he}"),                
    				'type'        => 'post',
    				// Post type
    				'post_type'   => 'courses',
    				// Field type, either 'select' or 'select_advanced' (default)
    				'field_type'  => 'select_advanced',
    				'placeholder' => __( 'Select a course' ),
    				// Query arguments (optional). No settings means get all published posts
    				'query_args'  => array(
    					'post_status'    => 'publish',
    					'posts_per_page' => - 1,
    			     ),
                    'clone' => true,
                ),
    			// DIVIDER
    			array(
    				'type' => 'divider',
    				'id'   => 'fake_divider_id', // Not used, but needed
    			),            
                // Awarding University
                array(
                    'name'    => __( 'Awarding University', 'awarding_uni' ),
                    'id'      => "{$prefix}awarding_uni",
                    'type'    => 'taxonomy',
                    'options' => array(
                        // Taxonomy name
                        'taxonomy' => 'awarding_uni',
                        // How to show taxonomy: 'checkbox_list' (default) or 'checkbox_tree', 'select_tree', select_advanced or 'select'. Optional
                        'type'     => 'select',
                        'id'      => "awarding_uni",
                        // Additional arguments for get_terms() function. Optional
                        'args'     => array()
                    ),
                    'visible' => array('course_type_select', 'contains', "{$he}"), 
                ), 
    			// DIVIDER
    			array(
    				'type' => 'divider',
    				'id'   => 'fake_divider_id', // Not used, but needed
    			),
    			// COURSE DOCS FILE UPLOAD
    			array(
    				'name' => __( 'HE Course Documents' ),
    				'id'   => "{$prefix}he_file",
    				'type' => 'file',
    			),   
    			// DIVIDER
    			array(
    				'type' => 'divider',
    				'id'   => 'fake_divider_id', // Not used, but needed
    			),            
                //Research Docs Group 
                    array(
                        'name' => 'Research Documents',
                        'id' => "{$prefix}research_documents",
                        'type' => 'group',
    				    'clone'  => true,
    				    'sort_clone' => true,                    
                        // List of sub-fields
                        'fields' => array( 
                            array(
                                'name'    => __( 'Research Introduction' ),
                                'id'      => "{$prefix}research_intro",
                                'type'    => 'wysiwyg',
                                // Set the 'raw' parameter to TRUE to prevent data being passed through wpautop() on save
                                'raw'     => false,
                                // Editor settings, see wp_editor() function: look4wp.com/wp_editor
                                'options' => array(
                                    'textarea_rows' => 6,
                                    'media_buttons' => false,
                                ),
                            ),                        
                            // Research DOCS FILE UPLOAD
                            array(
                                'name' => __( 'Research File Upload' ),
                                'id'   => "{$prefix}research_file",
                                'type' => 'file_advanced',
                            ),                          
                        ),
                    ),
    		)
    	);      
    // Staff/student/alumni Profile
        $meta_boxes[] = array(
    		'title'  => __( 'Staff/Student/Alumni Profile', 'course_profile' ),
            'post_types' => 'courses', 
            'context'    => 'normal',   
            'priority'   => 'low',
    		'fields' => array(    
    			// POST
    			array(
    				'name'        => __( 'Select Profile' ),
    				'id'          => "{$prefix}profile_post",
    				'type'        => 'post',
    				// Post type
    				'post_type'   => 'profiles',
                    'clone'  => true,
    				// Field type, either 'select' or 'select_advanced' (default)
    				'field_type'  => 'select_advanced',
    				'placeholder' => __( 'Select a Profile' ),
                    'desc'        => 'Select a staff or student profile from the list to attach it to this course',
                    
    				// Query arguments (optional). No settings means get all published posts
    				'query_args'  => array(
    					'post_status'    => 'publish',
    					'posts_per_page' => - 1,
    				)
    			),
            )
        );       
    //Student/employer quote (clone)
        $meta_boxes[] = array(
    		'title'  => __( 'Student/Employer Quote', 'course_quote' ),
            'post_types' => 'courses', 
            'context'    => 'normal',   
            'priority'   => 'low',   
    		'fields' => array(    
    			array(
    				'name' => __( 'Quote text', 'quote' ),
    				'desc' => __( 'Student/employer quote', 'quote' ),
    				'id'   => "{$prefix}quote",
    				'type' => 'textarea',
    				'cols' => 20,
    				'rows' => 3,
    		        'clone'  => true,        
                    
    			),
            )
        );         
        
        
     // All done now, output the meta   
        return $meta_boxes;
    }
    
    in reply to: UPDATES to conditional-logic.js to fix 'in' array logic #2426
    MikeTrebilcockMikeTrebilcock
    Participant

    Hi we are using:
    `$meta_boxes[] = array(
    'id' => 'he_subtitle',
    'title' => __( 'HE Sub-Title'),
    'post_types' => 'courses',
    'priority' => 'low',
    'context' => 'side',
    'visible' => array('course_type_select', 'in', array(32,35)),
    'fields' => array(
    // Course reference code
    array(
    'name' => __( '' ),
    'id' => "{$prefix}he_subtitle",
    'desc' => __( 'HE sub-title (Year of entry)' ),
    'type' => 'text',
    ),
    ),
    );`

    The updated code allows the 32 or 35, or both 32 and 35 to be selected to display the field, rather than having to have both(32 and 35) only selected to display which is what we were finding.

    in reply to: Taxonomy not displaying since update to latest version #2377
    MikeTrebilcockMikeTrebilcock
    Participant

    I have been switching between the old working version(4.7.2) and the new(4.8.1) trying to figure out the issue with the custom taxonomy not displaying.
    In the old version i have been using print_r(rwmb_meta( '' )); to print out all the custom meta fields but when I move over to the new version the array vanishes and i am left with the following warnings:

    Warning: call_user_func() expects parameter 1 to be a valid callback, class 'RWMB_Group_Field' not found in /home/site1/public_html/open-for-business.cornwall.ac.uk/wp-content/plugins/meta-box/inc/meta-box.php on line 353

    Warning: call_user_func() expects parameter 1 to be a valid callback, class 'RWMB_Group_Field' not found in /home/site1/public_html/open-for-business.cornwall.ac.uk/wp-content/plugins/meta-box/inc/meta-box.php on line 353 Warning: call_user_func() expects parameter 1 to be a valid callback, class 'RWMB_Group_Field' not found in /home/site1/public_html/open-for-business.cornwall.ac.uk/wp-content/plugins/meta-box/inc/meta-box.php on line 353

    Is this just a red herring? what's the new way to output all meta fields?

Viewing 8 posts - 1 through 8 (of 8 total)