Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 76 through 90 (of 244 total)
  • Author
    Posts
  • in reply to: Button classes #43565
    YasmineYasmine
    Participant

    Can close.

    Worked out that the class goes in attributes, different to the other fields!

    in reply to: ℹ️Feature request - edit the php in the builder #43313
    YasmineYasmine
    Participant

    Ok, thanks Peter. I will use the php.

    However, I now have two questions:

    1. For my radio fields it generates like 'options' => [__( 'One{/translate}', '{translate}Multiple', 'your-text-domain' )], - without my values. But my conditional logic is based on the values not the labels. Is this an error and do I need to edit the php to be something like: 'options' => [
    '0' => __( 'One', 'your-text-domain' ),
    '1' => __( 'Multiple', 'your-text-domain' )
    ],

    2. Are the fields still serialized when I do it this way?

    Thanks,
    Yasmine

    in reply to: When post type REST API set to TRUE it limits authors #43233
    YasmineYasmine
    Participant

    Yeah ok its not metabox, because when I deleted everything - the issue was still there. Sorry for that

    in reply to: Frontend forms with nav #42919
    YasmineYasmine
    Participant

    I am aware of that. My question was whether you had documentation / advice on the best way to do so.

    in reply to: Critical error caused by frontend form #42901
    YasmineYasmine
    Participant

    Thank you so much! It was on in one field and now it populates!

    However, still getting this error: [11-Aug-2023 18:11:15 UTC] PHP Notice: Array to string conversion in /home/customer/www/domain/public_html/wp-content/plugins/elementor/includes/utils.php on line 506

    However, I am in the process of migrating away from elementor to Bricks, and so it's not an issue for me. just letting you know!

    in reply to: Critical error caused by frontend form #42892
    YasmineYasmine
    Participant

    I had some rogue custom settings and tabs when I looked into my fields, which Ive now stripped all of. So now no obvious 'critical error'. But still the form is not showing, not even with [mb_frontend_form id='research-summary' post_fields='title'] and I am still getting the following errors:

    [11-Aug-2023 10:49:46 UTC] PHP Fatal error: Uncaught Error: Call to undefined function get_current_screen() in /public_html/wp-admin/includes/template.php:1481

     * @param string                 $id      Meta box ID (used in the 'id' attribute for the meta box).
     * @param string|array|WP_Screen $screen  The screen or screens on which the meta box is shown (such as a
     *                                        post type, 'link', or 'comment'). Accepts a single screen ID,
     *                                        WP_Screen object, or array of screen IDs.
     * @param string                 $context The context within the screen where the box is set to display.
     *                                        Contexts vary from screen to screen. Post edit screen contexts
     *                                        include 'normal', 'side', and 'advanced'. Comments screen contexts
     *                                        include 'normal' and 'side'. Menus meta boxes (accordion sections)
     *                                        all use the 'side' context.
     */
    function remove_meta_box( $id, $screen, $context ) {
    	global $wp_meta_boxes;
    
    	if ( empty( $screen ) ) {
    		$screen = get_current_screen(); // This is line 1481
    	} elseif ( is_string( $screen ) ) {
    		$screen = convert_to_screen( $screen );
    	} elseif ( is_array( $screen ) ) {
    		foreach ( $screen as $single_screen ) {
    			remove_meta_box( $id, $single_screen, $context );
    		}
    	}
    
    	if ( ! isset( $screen->id ) ) {
    		return;
    	}
    
    	$page = $screen->id;
    
    	if ( ! isset( $wp_meta_boxes ) ) {
    		$wp_meta_boxes = array();
    	}
    	if ( ! isset( $wp_meta_boxes[ $page ] ) ) {
    		$wp_meta_boxes[ $page ] = array();
    	}
    	if ( ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
    		$wp_meta_boxes[ $page ][ $context ] = array();
    	}
    
    	foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
    		$wp_meta_boxes[ $page ][ $context ][ $priority ][ $id ] = false;
    	}
    }
    

    Stack trace:
    #0 /public_html/wp-content/plugins/meta-box/inc/fields/taxonomy.php(310): remove_meta_box('tagsdiv-type-of...', NULL, 'side')
    #1 /public_html/wp-content/plugins/meta-box/inc/fields/taxonomy.php(301): RWMB_Taxonomy_Field::remove_default_meta_box(Array)
    #2 /public_html/wp-content/plugins/meta-box/inc/field.php(535): RWMB_Taxonomy_Field::admin_enqueue_scripts(Array)
    #3 /public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/meta-box-group/group-field.php(52): RWMB_Field::call(Array, 'admin_enqueue_s...')
    #4 /public_html/wp-content/plugins/meta-box/inc/field.php(535): RWMB_Group_Field::admin_enqueue_scripts(Array)
    #5 /public_html/wp-admin/includes/template.php on line 1481

    in reply to: Multiple frontend & nested values #42855
    YasmineYasmine
    Participant

    You can close this - there was a space after the id nested.

    I changed the option_2 ID but not the group - until now..

    Think it would be useful if IDs were trimmed of white space upon save though!

    in reply to: Multiple frontend & nested values #42854
    YasmineYasmine
    Participant

    And just incase it matters - option_1 value shows

    in reply to: Migrating to group fields #42577
    YasmineYasmine
    Participant

    Hi Peter,

    Thank you for that! I was able to migrate all text, links etc.

    However, I am really strugling with taxonomies.

    I noticed that when I pulled them into the group, the post was disassociated with the term. I fixed it by reuploading the data into another field outside the group. But I want to pull that data into the group.

    I think I can get the terms, but then it does not work the same way as the text fields. I cannot insert and save.

    Help would be hugely appreciated. Just the functions I can use to do this successfully.

    And in case anyone comes across this thread - this is how I did the text fields:

    add_action('init', 'migratethefields', 99);
    
    function migratethefields() {
        
        $fields = array('year','peer-review', 'doi', 'co_authorYN', 'citation');
        $prefix = 'academic';
        $fieldgroup = 'reference_group';
        $group_field_ID = $prefix . $fieldgroup;
    
        foreach ($fields as $field) {
            $new = 'justtostoptheinit';
            $field_ID = $prefix . $field;
    
            if (get_option($new . $field_ID)) {
                continue;
            }
    
            $args = array(
                'post_type' => 'research',
                'posts_per_page' => -1,
            );
            $query = new WP_Query($args);
    
            if ($query->have_posts()) {
                while ($query->have_posts()) {
                    $query->the_post();
                    $post_ID = get_the_ID();
    
                    $valuestotransfer = null;
                    $valuestotransfer = rwmb_meta($field_ID, '', $post_ID);
    
                    if (empty($valuestotransfer)) {
                            $valuestotransfer =   rwmb_get_value ($field_ID, '', $post_ID);
                    }
    				if (is_array($valuestotransfer) && isset($valuestotransfer[0]) && is_object($valuestotransfer[0])) {
        $valuestotransfer = array_map(function($term) {
            return $term->term_id;
        }, $valuestotransfer);
    }
                    $group_field = rwmb_meta($group_field_ID, '', $post_ID);
    
                       if (!empty($valuestotransfer) && is_array($group_field) && isset($group_field[0])) {
                            $group_field[0][$field_ID] = $valuestotransfer;
                        }
                      
                        $updated = update_post_meta($post_ID, $group_field_ID, $group_field);
        }
    }
    
    in reply to: Migrating to group fields #42549
    YasmineYasmine
    Participant

    And just so you can see where I got up to (might be easier to explain where its going wrong):

    add_action('init', function() {
        $args = array(
            'post_type' => 'research',
            'order' => 'DESC',
            'nopaging' => true,
        );
        $query = new WP_Query($args);
    
        if ($query->have_posts()) {
            while ($query->have_posts()) {
                $query->the_post();
                $valueToCopy = rwmb_meta('academicyear', '', $post->ID); // $IDofTheOriginalFieldIWantToMoveTheValueFrom
    $year_groups = rwmb_meta('academicreference_group', '', $post->ID) ?? ''; // $GroupFieldID
      
    foreach ($year_groups as $year_group) {
    $year = $year_group['academicyear'] ?? ''; // $FieldIDInsideTheGroup 
    }
    rwmb_set_meta($post->ID, $year, $valueToCopy);
    ;
    		}}}, 99);
    in reply to: Only getting the last value from a group field #41834
    YasmineYasmine
    Participant

    Thanks, I was trying to output elsewhere for this one, and found that I needed to do:

    $groups = rwmb_meta( 'academicrecommendation_multiple', '', $post->ID ) ?? '';
    	$recommendations = [];
    foreach ( $groups as $group ) {
    $recommendation = $group[ 'academicrecommendation' ] ?? '';
    	$recommendations[] = $recommendation;
    
    };
    	
    $all_recommendations = '<ul><li>' . implode('</li><li>', $recommendations) . '</li></ul>';

    To get what I needed. But this all works!

    in reply to: MB Group Skin Repeats First Value #41423
    YasmineYasmine
    Participant

    Hi I will email the screenshots and code, as there is no way to share the images on here. Thanks for your help.

    in reply to: PHP User Error Log #41127
    YasmineYasmine
    Participant

    Thanks Peter, I can wait 🙂

    in reply to: PHP User Error Log #41105
    YasmineYasmine
    Participant

    This group field is as follows:

    <?php
    $groups = rwmb_meta( 'resources_group' );
    foreach ( $groups as $group ) {

    // Field resource_or_database_type:
    echo $group[ 'resource_or_database_type' ] ?? '';

    // Field name_of_resource:
    echo $group[ 'name_of_resource' ] ?? '';

    // Field resource_details:
    echo $group[ 'resource_details' ] ?? '';

    // Field resource_link:
    echo $group[ 'resource_link' ] ?? '';

    }
    ?>

    Which is a select, text, textarea, URL

    In one case, the error showed when there were 3 group field values, that were filled as follows

    FIRST GROUP FIELD CONFIG
    1. Select: Value there, but not outputted
    2. Text: TRUE
    3. Text area: FALSE
    4. URL: TRUE

    SECOND GROUP FIELD CONFIG
    1. Select: Value there, but not outputted
    2. Text: TRUE
    3. Text area: FALSE
    4. URL: TRUE

    THIRD GROUP FIELD CONFIG
    1. Select: Value there, but not outputted
    2. Text: TRUE
    3. Text area: TRUE
    4. URL: TRUE

    The error showed beneath the first two fields, which had no value in the text area. When I added a space as the value in the text area for the first two, the error still showed. When the text area field was taken out of the MB Group Skin template, no error showed.

    I think the error is due to there being no value in a field.

    in reply to: PHP User Error Log #41104
    YasmineYasmine
    Participant

    Hi I found when the issue was outputting..
    I use the meta box group skin for a group of 4 custom fields. When one of the values is not filled in, rather than showing blank. It shows this error directly on my webiste, I would really appreciate the fix in the next update:

    Warning: array_column() expects parameter 1 to be array, null given in ../public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-elementor-integrator/src/GroupField.php on line 285

    Warning: array_combine() expects parameter 2 to be array, null given in ../public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-elementor-integrator/src/GroupField.php on line 285

    Many thanks,
    Yasmine

Viewing 15 posts - 76 through 90 (of 244 total)