black friday sale

Custom Fields
Re-Envisioned
Support MB Relationships Some posts coming disconnected from users

  • Creator
    Topic
  • #22665
    Resolved Jonathan Schroeder
    Participant

    So, I’m having a kind of strange issue where it seems that posts are coming disconnected from users.

    I have the following connections:
    – Programs to users
    – Programs to updates

    We use this information to show individual users the updates that are connected to the programs they’re connected to. The issue is that as the end users are seeing that they’re no longer connected to programs they should be connected to. I also see a lot of this on the backend:

    https://ibb.co/gTfTpj9

    where it looks like users have been deleted. However, I know that as they’re administering the site they aren’t deleting users.

    Anything that you can think of that’s likely happening here? I should note that this site is about 2.5 years old and hasn’t had significant changes made that would seem to account for this suddenly not working the way it used to.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #22666
    Jonathan Schroeder
    Participant

    UPDATE: I don’t think this probably solves the underlying problem of users coming disconnected from posts, but I did add this, which makes the invisible users visible on the edit screen for Projects (the CPT they’re connected to):

    ‘field’ => [
    ‘query_args’ => [
    ‘number’ => -1 // This
    ]
    ]

    <?php
    add_action( 'mb_relationships_init', function () {
    MB_Relationships_API::register( array(
    'id' => 'programs_to_updates',
    'to' => 'projects',
    'from' => 'updates',
    ) );
    MB_Relationships_API::register( array(
    'id' => 'users_to_posts',
    'to' => array(
    'object_type' => 'user',
    'meta_box' => array(
    'title' => 'Program access',
    'field_title' => 'Select projects',
    ),
    'field' => [
    'query_args' => [
    'number' => –1 // This
    ]
    ]
    ),
    'from' => array(
    'object_type' => 'post',
    'post_type' => 'projects',
    'meta_box' => array(
    'title' => 'Clients with access',
    'context' => 'side',
    'empty_message' => 'No users',
    ),
    ),
    ) );
    } );

    view raw
    connections.php
    hosted with ❤ by GitHub

    #22667
    Long Nguyen
    Moderator
    #22676
    Jonathan Schroeder
    Participant

    Thanks! I’ll wait to hear back from the end user as to whether this has actually addressed the core problem!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.