Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 1,486 through 1,500 (of 3,958 total)
  • Author
    Posts
  • in reply to: rwmb_after_save_post #13085
    Anh TranAnh Tran
    Keymaster

    You're data is a plain array encoded in JSON, so $value[$i] is correct to iterate each of the value stored.

    I'm not sure how it's saved in the DB, though. But at least it works for now. Please post the code for the meta box/field here for me to see why it saves as json-array.

    in reply to: Custom tables NOT BEING CREATED #13084
    Anh TranAnh Tran
    Keymaster

    I got it. Let's try to fix the issue with the BB first.

    Please deactivate everything related to Pods, since we don't need it anymore.

    On the front end, if you keep your old modules / shortcodes, then the custom fields with Pods might be still outputted correctly. It's not a bug, it's just BB can still retrieve data from custom fields even when the plugin is deactivated. (Of course, the data is still in the database, so BB is able to retrieve it).

    Regarding fields that you created with Meta Box, can you check if you installed and activated the MB Beaver Builder Integration extension? This extension helps you to output the custom field easier. See the screenshot on the plugin page and let me know if there's anything unclear.

    in reply to: MB Relationships CANNOT ACTIVATE #13083
    Anh TranAnh Tran
    Keymaster

    Hi Sam,

    If you already activate MB Relationships network-wide, then please do not install or activate the plugin via Meta Box AIO. The AIO plugin is a wrapper of other extensions. When you install a plugin via AIO, it will install that plugin as an individual plugin, which can cause some issues.

    in reply to: Set default value to field if this value still not exist #13076
    Anh TranAnh Tran
    Keymaster

    Hi Jefferson,

    Yes, it works only for new posts, since std is used when the meta box has not been saved before. For old posts, obviously meta box is already saved. So you need to do some migration. Perhaps you should share with us here ;). I think many users like that.

    I'll fix the issue with My topics link now.

    in reply to: Checkbox Checked by Default #13075
    Anh TranAnh Tran
    Keymaster

    Hi Max,

    Does it work with new posts?

    The mechanism of std in Meta Box works only if the meta box has not been saved before. Here 'meta box' means all fields. So if there's any field that already has value, then std won't work for other fields, even new fields you've just added.

    in reply to: MB Relationships CANNOT ACTIVATE #13074
    Anh TranAnh Tran
    Keymaster

    Hi Sam,

    From the error, I think the MB Relationship is already activated on a sub-site before. Can you check that and make sure no sub-site activate the plugin before you activate it in the network?

    in reply to: Custom tables NOT BEING CREATED #13073
    Anh TranAnh Tran
    Keymaster

    Hi Sam,

    Did you create the custom table with code? The MB Custom Table doesn't create the table automatically. Instead, you need to put a small snippet into your theme's functions.php file to create a table manually. Here is the guide on doing that.

    If you already did that but no tables are created, please check if your database user has privileges to create new tables. Some hosts don't allow you to do that.

    Regarding issue with displaying fields on the front end, are the fields just normal custom fields or they're fields used with custom table? As there is still a problem with custom table, the custom fields don't work properly until we resolve it.

    I'll answer your question about MB Relationships in another topic of yours.

    in reply to: Short Codes in Beaver Themer variables #13072
    Anh TranAnh Tran
    Keymaster

    Hi Mark,

    The shortcode in BB is a wrapper version of rwmb_the_value() helper function. For terms, it returns a link to that term. And there's no extra arguments at the moment. We'll try to improve that later. It's might be a nice improvement for not only terms, but also posts, users, images.

    @Sam: I'll answer you in your topics.

    in reply to: Quick Links - My Topics link is broken #13070
    Anh TranAnh Tran
    Keymaster

    Hi Sam,

    Thanks for your feedback. I'll check and fix that.

    in reply to: rwmb_after_save_post #13055
    Anh TranAnh Tran
    Keymaster

    Both rwmb_* functions and WordPress's get_post_meta() don't use JSON at all. They use serialize for arrays. Maybe you need to check how data is saved in your case, just to make sure it's valid. Anyway, as the data is there, you can use json_decode function to decode it.

    in reply to: Set default value to field if this value still not exist #13053
    Anh TranAnh Tran
    Keymaster

    Hi Jefferson,

    You can use std attribute for a text field, like this:

    $post_id = isset( $_GET['post'] ) ? intval( $_GET['post'] ) : ( isset( $_POST['post_ID'] ) : intval( $_POST['post_ID'] ) : false );
    $meta_boxes[] = [
        'fields' => [
            [
                'type' => 'text',
                'id' => 'color',
                'std' => generate_my_own_code( $post_id ),
            ],
        ],
    ];
    in reply to: rwmb_after_save_post #13052
    Anh TranAnh Tran
    Keymaster

    Yes, I think so. Not sure where it comes from, since Meta Box doesn't use JSON at all.

    in reply to: Query to only show posts which are connected #13040
    Anh TranAnh Tran
    Keymaster

    Hi Max,

    Querying posts using relationship as a condition is not supported. You might want to query posts as usual, then perform an API call to get connected items for each post. Then you can use condition to decide whether to show them.

    MB_Relationships_API::each_connected( array(
        'id'   => 'posts_to_pages',
        'from' => $wp_query->posts, // 'from' or 'to'.
    ) );
    
    while ( have_posts() ) : the_post();
        // Skip if no connected posts.
        if ( empty( $post->connected ) ) {
            continue;
        }
    
        // Output here
    endwhile;
    in reply to: rwmb_after_save_post #13039
    Anh TranAnh Tran
    Keymaster

    Hi Max,

    I think the problem is there are multiple meta boxes and the hooks don't fire properly. They fire per meta box, so if there are 2 meta boxes, the hook rwmb_before_save_post might fire before one meta box saving action, but after another meta box saving action.

    As Meta Box uses hook save_post_{$post_type} with priority to save the data, please try the replacing the hooks with:

    add_action('save_post_{your_post_type}', 'api_get_old_fields', 0);
    add_action('save_post_{your_post_type}', 'api_set_new_fields', 20);
    in reply to: Refund Request #13030
    Anh TranAnh Tran
    Keymaster

    Hi Scott,

    It's so sad to see you go. Hopefully you'll come back later. I've issued the refund.

    Best regards

Viewing 15 posts - 1,486 through 1,500 (of 3,958 total)