Support Forum » User Profile

Forum Replies Created

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • in reply to: Relationship field performance #16352
    eazyeazy
    Participant

    Hello, can you update the link?
    I got 404 for this: https://github.com/wpmetabox/meta-box/tree/ajax-post

    also when you will merge all this to master and realese the new version including all this improvements?

    in reply to: MB Relationships display only post name #14895
    eazyeazy
    Participant

    Thanks for the support, actually this works for now. Optimal choise would be ajax for both selects, inside "to" and "from" posts. But for now i'm ok with this solution.

    in reply to: MB Relationships display only post name #14807
    eazyeazy
    Participant

    Hi, any help on how i get this done?

    in reply to: MB Relationships display only post name #14786
    eazyeazy
    Participant

    Hello, so i tried but it's not working, here the code i put into functions.php:

    add_action('mb_relationships_init', function () {
    
        $currentPostId = 86323; //how do i get this?
        global $wpdb;
        $filteredIds = [];
        $results = $wpdb->get_results($wpdb->prepare('SELECT * FROM wp_mb_relationships WHERE wp_mb_relationships.to = %s', $currentPostId));
        foreach($results as $result){
            $filteredIds[] = $result->from;
        }
    
        MB_Relationships_API::register(array(
            'id' => 'episodes_to_series',
            'from' => array(
                'type' => 'post',
                'post_type' => 'episode',
                'admin_column' => true,
                'meta_box' => [
                    'context' => 'advanced',
                    'title' => 'Serie'
                ]
            ),
            'to' => array(
                'type' => 'post',
                'post_type' => 'serie',
                'meta_box' => [
                    'context' => 'advanced',
                    'title' => 'Episodes'
                ],
                'query_args' => [ 'post__in' => $filteredIds], //not working
            ),
        ));
    });

    how do i get $currentPostId ? i tried with $post but without success
    why $filteredIds is not working?

    I also tried with hard-coded array instead of filteredIds, but nothing

    Also, the bug i mentioned on #14776? Some fix is coming soon?

    in reply to: MB Relationships display only post name #14776
    eazyeazy
    Participant

    Hi,
    the first solution will cause a big problem, when you save the post, all relations will be lost when you save again the post.

    Then i found a bug, if you try to order the connected posts, when you reload a page, it will go back to its original order, in database all seems fine, but on frontend no.

    To replicate this issue, create some related posts

    Test1
    Test2
    Test3

    -> save -> reload page -> move Test3 to first position -> save -> reload page
    you will see the order is resetted

    in reply to: MB Relationships display only post name #14765
    eazyeazy
    Participant

    Hi,
    thanks for fast reply.

    Sadly i can't use the ID's because all 100k posts are related to each other and i can't limit the query.

    I need to set this limit to query that populates the select2, instead of showing all options, i need to show/render only the selected option, so the page will load fast because html output will be a lot less.

    in reply to: MB Relationships display only post name #14757
    eazyeazy
    Participant

    Thanks a lot, this helps the UI, but options rendering in html can be disabled?

    If we have, 100k posts, and have relations post to post, every select will have 100k options and page load speed will be slow, some browsers will crash, i want to disable other options rendering, and render only the "selected" option. So user can order only the related items.

    in reply to: MB Relationships display only post name #14739
    eazyeazy
    Participant

    Any help is appreciated

    in reply to: Select advanced load remote data #14478
    eazyeazy
    Participant

    Hello, is there any news about this feature?

    Can't you make some wrapper function (where you can pass and array of parameters) for ajax_callback that uses search feature of:

    wp-admin/edit.php?s=test&post_status=all&post_type=post&action=-1&m=0&cat=0&paged=1&action2=-1

    the get parameters of this search is the array i said before, the search will return an array of [post_id , post_title], if found any, and will be used as select option.
    You can also trigger the search when a minimum of words is typed, or just add some button.

    test_initial_callback can be just the load of the field, if any value is found on database, for sure this is way better than loading an select with all possible options and populating the html.

    I think you can do this and merge the feature on live (i think even something basic is appreciated by anyone)

    I'd like to help you, but xdebug on wordpress/windows is not working, also i work mainly on Magento, and neved did something complicated on wordpress.

    Personally I'd like to see this feature on post_relation plugin.

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