• Hi,

    Two of our user lists are suddenly generateing the following error on cache rebuild:

    Warning: Invalid argument supplied for foreach() in /wp-content/plugins/amr-users/includes/ameta-building.php on line 259

    The lists used to work just fine for the past year. The culprit seems to be the xxxx_capabilities-s2member_level1 and xxxx_capabilities-s2member_level3 metas we’re pulling. These are used to produce two distinct lists, one student blogroll list and one graduate blogroll list. As mentioned it used to work just fine (we’ve set each to exclude if blank) but not anymore.

    I tried to instead pull “first role” but the problem is thanks to s2member and over 1200 members I now have a massive list of meta keys that are a) impossible to filter through lest I spend hours and b) after a certain point down the list fields are no longer being pulled onto a list. What I mean with that is “first role” is about 500 rows down the list but when I try to activate it it just won’t pull on to the list, the change doesn’t stick. The same thing happens if I want to exclude a meta key that’s several hundred rows down, the tick box will until after saving and the meta keeps pulling.

    Thorsten

    https://www.ads-software.com/plugins/amr-users/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author anmari

    (@anmari)

    HI alternatewords (love the name)

    1) Re the meta – that’s why there is now an ‘excluded meta’ menu option – some plugins had timedata as array keys – that made things impossible as each ‘time’ became a field. Hop in there and exclude as many meta keys as you can.

    Then hop into the fields and exclude as many from the reports as you can (ie if an meta value explodes into multiple, you may not need all of them.) That should make the config screens more manageable.

    2) there were some changes in that area to cope with something that gravity forms was doing – nested arrays with always 1 element array only (so why bother.., but anyway…)
    I was worried it would break something else and in looking at the code maybe it wasn’t ideal. In the long run these oddly stored fields may have to be dealt with using add-ons rather than trying to have the code suit all fields all the time.

    Try this, if it works for you and doesn’t break your other fields, then I’ll add it (although I can still see a risk here for some kinds of data)
    Can you edit that file /ameta-building.php around line 254 and change the code as follows:

    /ameta-building.php on line 254

    if (is_array($temp) ) {
       if (count($temp) == 1) { // one record, single value returned - will fix that annoying gravity form emergency contact thing
       $temp = array_pop($temp);
       }
    }
    if (is_array($temp) ) {  // if it is still an array inside
    Thread Starter Alternatewords

    (@alternatewords)

    Hi anmari,

    Thanks so much for your speedy reply. I’ve implemented your suggestion and it fixed the error messages. Alas, my lists still don’t work properly. In the past pulling xxxx_capabilities-s2member_level3 on to my student blogroll and setting “Exclude if Blank” would produce a perfectly fine list of all s2member_level3 users, which are our students. No it just pulls one member, who is our forum moderator. So I pulled the field on the report and noticed that it comes up blank. I am assuming this is actually an issue with s2member resp. how this meta field is being pulled now, perhaps it should come up empty as it’s a capabilities indicator? If that’s the case now than I can’t use it any longer anyway.

    Which now leaves the issue of pulling “First Role” and not being able to use “Include:” properly. When I set “Include:” to “Student” no records pull up even though this is a valid entry. I actually have to set “Exclude if:” to “Graduate” to kind of generate a correct list (which then also includes Administrators).

    Yet another issue is that the Id field no longer queries properly either, at least for me. It a) no longer is visible on my report and b) if I exclude a single ID it actually excludes 100s of records instead of just a single one.

    Thread Starter Alternatewords

    (@alternatewords)

    Quick update: I confirmed that the issue lies with amr users. I just reverted back to a previous copy I had from a June 2014 backup and the xxxx_capabilities-s2member_level3 exclude if blank works perfectly fine. However, neither the Id nor the user ID meta seem to work in this copy either. I can work around that though. Also, setting a value for “Include”” using “First Role” produces a blank list even on the older version. Just as an FYI.

    I think for the time being I’ll continue using this older version and hold off on any updates until our class is over next week.

    Plugin Author anmari

    (@anmari)

    Hi – first on id – yes there is an oddity going on there and I’m waiting for time to do a rewrite of some areas and that will sort that out.

    On other, it might be a data dependent thing (the first role is lieterally just the first role – and in most cases there is only one)
    I have found that in some situations if users end up with multiple roles – the first one may not be consistent. So there are other ways to access roles too.

    If you have time can you email me a dump of your user-meta ? (I don’t need the user table and dont want any user details anyway) Hopefully it is not too large. Or if you have can extract a subset that shows the problem and email to [email protected]. Then I can recreate this end.

    Thread Starter Alternatewords

    (@alternatewords)

    Sorry for the delay, been rather busy. I’ll get a copy of the metas over once things have settled down. I am currently using AMR 3.8.5 and the s2member fields work fine in that version. May have to just stick with that going forward.

    Plugin Author anmari

    (@anmari)

    Hmm, puzzling the exclude if blank business…

    On roles: https://wpusersplugin.com/4799/roles-first-role-bbpress-forum-roles-s2member-levels/. On the roles field, the filtering is working fine.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘s2member field suddenly generates error message on report’ is closed to new replies.