Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 1,816 through 1,830 (of 3,708 total)
  • Author
    Posts
  • in reply to: Delete options field MB Settings Page #11210
    Anh TranAnh Tran
    Keymaster

    Hi,

    The old field is an element in the option array. To delete it, simply unset it:

    $option = get_option( 'settings' );
    $option['new-text'] = $option['Text-old'];
    
    // THIS
    unset( $option['Text-old'] );
    update_option( 'settings', $option );
    in reply to: Events to Venues #11209
    Anh TranAnh Tran
    Keymaster

    Hi Neil,

    The title parameter should be wrapped inside a meta_box parameter, like this:

    add_action( 'mb_relationships_init', function() {
        MB_Relationships_API::register( array(
            'id'   => 'posts_to_pages',
            'from' => array(
                'object_type'  => 'post',
                'post_type'    => 'session-sponsor',
                'admin_column' => true,
                'meta_box'     => array(
                    'title' => 'Sponsor',
                ),
            ),
            'to'   => array(
                'object_type'  => 'post',
                'post_type'    => 'session',
                'admin_column' => 'after title',
                'meta_box'     => array(
                    'title' => 'Sponsor',
                ),
            ),
        ) );
            MB_Relationships_API::register( array(
            'from' => array(
                'object_type'  => 'post',
                'post_type'    => 'speaker',
                'admin_column' => true,
                'meta_box'     => array(
                    'title' => 'Sponsor',
                ),
            ),
            'to'   => array(
                'object_type'  => 'post',
                'post_type'    => 'session',
                'admin_column' => 'after title',
                'meta_box'     => array(
                    'title' => 'Speaker',
                ),
            ),
        ) );
    } );
    in reply to: One to many & many to many post relationships #11208
    Anh TranAnh Tran
    Keymaster

    Hi Neil,

    I fixed the snippet in the KB. In this case, I think it can be done with this code:

    add_action( 'mb_relationships_init', function() {
        MB_Relationships_API::register( array(
            'id'   => 'sessions_to_speakers',
            'from' => 'session',
            'to'   => 'speaker',
        ) );
        MB_Relationships_API::register( array(
            'id'   => 'sessions_to_sponsors',
            'from' => 'session',
            'to'   => 'sponsor',
        ) );
    } );

    To show the related information (speakers, sponsors) when displaying sessions, please try this code:

    // Display speakers
    $speaker_query = new WP_Query( array(
        'relationship' => array(
            'id'   => 'sessions_to_speakers',
            'from' => get_the_ID(),
        ),
        'nopaging'     => true,
    ) );
    while ( $speaker_query->have_posts() ) : $speaker_query->the_post();
        ?>
        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
        <?php
    endwhile;
    wp_reset_postdata();
    
    // Display sponsors
    $sponsor_query = new WP_Query( array(
        'relationship' => array(
            'id'   => 'sessions_to_sponsors',
            'from' => get_the_ID(),
        ),
        'nopaging'     => true,
    ) );
    while ( $sponsor_query->have_posts() ) : $sponsor_query->the_post();
        ?>
        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
        <?php
    endwhile;
    wp_reset_postdata();
    in reply to: Add fields to Genesis Custom Post Type Archive Metabox #11207
    Anh TranAnh Tran
    Keymaster

    Hello Juanita,

    I think it's possible. CMB2 and Meta Box is quite similar. However, I don't have Genesis and I can't give you the exact code that works.

    in reply to: Populate Relationships from frontend #11206
    Anh TranAnh Tran
    Keymaster

    Hi Giovanni,

    Unfortunately, it's not possible. The plugin works only in the backend.

    in reply to: Using shortcode as hyperlink #11205
    Anh TranAnh Tran
    Keymaster

    Hi Neil,

    Can you try changing it to:

    <a href="[rwmb_meta meta_key='event_register']">Register</a>

    I think it's the problem of using double quotes inside double quotes.

    in reply to: MetaBox extension installed via composer #11204
    Anh TranAnh Tran
    Keymaster

    Hi Bezzo,

    Thanks for your idea. I think it's ok to remove autoload from Composer and leave it for developers. I've just made the change. Please try again.

    in reply to: Display fields with confirmation notice #11203
    Anh TranAnh Tran
    Keymaster

    Hi Joseph,

    We've just updated the MB User Profile plugin to version 1.1.1 with support for this feature. Please update.

    in reply to: Font end image upload input not showing #11202
    Anh TranAnh Tran
    Keymaster

    Hi Harrison,

    Sorry for the delay.

    The HTML output looks correct. The upload button is rendered by JavaScript. In your code, looks like the JavaScript doesn't run.

    Would you mind sending me the admin account to check it? Please send in the contact form.

    in reply to: Metabox 4.15.4 (switch) #11201
    Anh TranAnh Tran
    Keymaster

    Hi Hazmi,

    I've tried your code and it's working correctly. There is no '0' saved in the DB. Please see my video:

    http://recordit.co/z87n4n1I5i

    in reply to: Metabox 4.15.4 (switch) #11191
    Anh TranAnh Tran
    Keymaster

    I'm sorry for the "re-save". You can write a script to help you doing this.

    Regarding the datetime field, if you set 'std' => ' ', then when saving the post without specifying the datetime, it will save exactly as ' ' in the database. Actually, the plugin treats datetime field like a text field, unless you set 'timestamp' => true, which converts datetime into integer. And then in that case, the value is kind of unexpected, cause ' ' is converted to incorrect value.

    in reply to: Metabox 4.15.4 (switch) #11189
    Anh TranAnh Tran
    Keymaster

    I've just fixed it on Github. Can you please try it?

    Thanks
    Anh

    in reply to: Metabox 4.15.4 (switch) #11188
    Anh TranAnh Tran
    Keymaster

    Hi Hazmi,

    Sorry for the late reply. In the previous topic, I marked it as "resolved" when I pushed the commit that I thought it fixed the bug.

    Let me check it again and will reply you soon.

    in reply to: Error after asign category to custom post type #11187
    Anh TranAnh Tran
    Keymaster

    Hi Dan,

    We have resolved this issue on Meta Box Users group on Facebook. Let me quote here in case anyone needed:

    The CPT you created had some un-rendered labels. So I guess when you created the new CPT and you hit the Save button too fast (probably by press Enter), which makes the JS code hasn't finished rendering all the labels and settings. Thus data saved is incorrect and makes WP doesn't understand.

    I tried to find that post ID (using the export tool of WP), and run a wp_delete_post( ID ) to remove it. Everything goes back.

    in reply to: Code Snippet Error in KB? #11149
    Anh TranAnh Tran
    Keymaster

    Thanks a lot! I've just fixed it. It should be:

    MB_Relationships_API::register( array(
        'id'   => 'posts_to_pages',
        'from' => array(
            'object_type'  => 'post',
            'admin_column' => 'true',  // THIS!
        ),
        'to'   => array(
            'object_type'  => 'post',
            'post_type'    => 'page',
            'admin_column' => 'after title', // THIS!
        ),
    ) );
Viewing 15 posts - 1,816 through 1,830 (of 3,708 total)