• Resolved jeffwithag

    (@jeffwithag)


    We have a bidirectional relationship setup between users and a custom post. Posts has a pod with a list of subscribed users. Users has a pod with a list of post subscriptions. Updating one, should update the other.

    If I query the postmeta table I see over 1300 users subscribed to this one post id. Some of these users, although in the db, are not reflected when I open the edit on that post and view the subscribed users field? They are in the db, but not shown in the field. Therefore, if administrator hits update on that post, since they are not shown in the field, they get removed. If I don’t hit update, and goto the user, I do see the post listed in the post subscriptions for that user.

    So problem 1 is the db has both the usermeta data and the postmeta data, but the dashboard isn’t reflecting all the postmeta values.

    Trying to get a grasp on it, I queried the usermeta. Here I see over 1400 users subscribed to that same post. I would have thought this count should have been the same count as the postmeta query, but it’s 77 more subscribers. That said, none of those 77 users appear to have the product listed for subcription when viewing the user edit. (which maybe makes sense since if they are removed because the corresponding postmeta data isn’t there.).

    Could this difference in quantity also be a reason for problem 1 above? I am not sure why it would, but maybe I got some broken data (much of this data was imported via csv and it did time out a few times, requiring a new import minus already imported data). Do I need to address those 77 extra subscribers in the usermeta data in order for the postmeta to reflect correctly in the editable field? (By address I mean determine if they are subscribers or not and either add corresponding entries to the postmeta or delete existing entries from the usermeta.)

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @jeffwithag
    I think this might be a max_input_vars restriction on your server (1400 values is a lot).
    Can you verify?
    Cheers, Jory

    Thread Starter jeffwithag

    (@jeffwithag)

    Thanks, I’ll look into it. Although, I believe I encountered a similar issue on same field on different post with only 20 or so subscribers. In that case though, it was a specific users who just would not show up in that field. That were in the db correctly, but would not display in that pod field. I will be revisiting that issue once I address this issue. Was hoping they were similar cause, but maybe not.

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @jeffwithag
    That could also be possible. For example, users belonging to a specific role (depending on how you’ve setup your field).
    Let me know!
    Cheers, Jory

    Thread Starter jeffwithag

    (@jeffwithag)

    I don’t believe it’s a max_input_vars restriction as I found a post with a smaller subscription size. It has 29 postmeta entries & 64 usermeta entries (see question below regarding possible explanation of this difference in quality). Yet only 23 users listed as subscribers in the post subscribers field. I would expect 29. The last 6 alphabetically are not showing in the field. (Note: In the prior example, with the 1300+ records, it was the last 8 alphabetically that wee not showing). It could very well be that the users were added alphabetically, so it may be less to do with alphabetical and last users subscribed.

    • This reply was modified 5 years, 2 months ago by jeffwithag.
    Thread Starter jeffwithag

    (@jeffwithag)

    Quick question, maybe unrelated, but just curious. (Maybe I should post this under a different topic? To avoid complicating this current topic? Let me know and I’ll delete it from here.) So I have a post and I add a subscriber to the post. If I go check that user, I also see they now have that product as one of their subscriptions. I check the usermeta and postmeta, they have an entry for both. Everything is good.

    Now, let’s say I want to remove that subscription. If I goto the post and remove it, the user no longer shows in post edit as a subscriber, nor does the product show in the user edit as a subscription. Everything appears good.

    However, if I query the metadata, there is still an entry in the usermeta. Is that working as designed or should it also be deleted? I noticed it’s the same way in reverse too. If I deleted the subscription from the user instead, than there is still an entry in the postmeta.

    It seems like this would leave a lot of orphaned data over time. Unless I’m missing something? I only inquire as I”m noticing a lot of this orphaned data and was wondering if it was somehow impacting the initial issue.

    • This reply was modified 5 years, 2 months ago by jeffwithag.
    Thread Starter jeffwithag

    (@jeffwithag)

    As stated above, the subscribed users field on the post only showed 23 users, even though querying the db showed 29. It so happens it’s the last six alphabetically. If I try manually re-adding one of those users by typing them into the field, they autocomplete as I type them in and they show in the field when I select it. But then I hit save, the screen refreshes. Now they are not shown in the field. And if I query the db, we now have only a count of 24. (the 23 shown and the one I just manually added. the other 5 of the original 6 are removed since they were not in the field when I saved it.) I had to manually add all 6 at the same time by typing in each name in the field and selecting the user to add. Once all 6 were shown in the field, then save. Now we are back to 23 shown and 29 in the db. I can add other users and they will show fine in the field. But these last 6, will not reflect in the field. It’s a problem cause if not shown and that post is edited, then they get removed from subscribers. (Note: it isn’t role specific.)

    • This reply was modified 5 years, 2 months ago by jeffwithag.
    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @jeffwithag
    Could you setup a development environment for me to check?
    It is hard to replicate a case like this.
    Let me know!
    Cheers, Jory

    Thread Starter jeffwithag

    (@jeffwithag)

    I appreciate your help and time Jory, but I think I am going to revisit how I am handling subscriptions. This is problematic even without this particular issue since a user could potentially subscribe from the frontend while an admin is editing a post. At which time that subscription would be lost upon admin saving their changes. I think I’ll switch over to utilizing a pivot table so editing a post has no potential of overriding subscriptions.

    Thanks again. Take care.

    • This reply was modified 5 years, 2 months ago by jeffwithag.
    • This reply was modified 5 years, 2 months ago by jeffwithag.
    • This reply was modified 5 years, 2 months ago by jeffwithag.
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Pod field not reflecting all db entries’ is closed to new replies.