$_LW->read, New Custom Profiles Fields

I have the following $_LW->read in use:

$data_type = 'profiles';
  $args = [
    'type' => 'Major & Minor Requirements',
    'filter' => ['profiles_315|equals|Major', 'profiles_315|equals|Minor', 'profiles_315|equals|Program'],
    'filter_mode' => 'any',
    'paginate' => 999
  ];
  $results = $_LW->read($data_type, $args);

Which gives me data like this:

id → "7686"
gid → "27"
tid → "68"
name → "Biology Major"
firstname → ""
middlename → ""
lastname → ""
title → "Biology Major"
url → "https://www.beloit.edu/academics/majors-minors/ba-bs-biology/"
profiles_315 → "Major"
profiles_316 → "11.5"
profiles_317 → "4794"
profiles_318 → "7354"
profiles_319 → "7794"
profiles_320 → ""
profiles_387 → "Undergraduate"
profiles_388 → "Bachelor of Arts (B.A.) or Bachelor of Science (B.S.)"
profiles_389 → "Major"
profiles_390 → ""
profiles_391 → "In-person"
profiles_392 → "7682"
profiles_393 → "7688"
profiles_394 → "7685"
profiles_395 → "8538"
profiles_396 → "8119"
profiles_397 → ""
profiles_398 → ""

I recently added a new custom field, profiles_437, but it isn’t appearing in the $_LW->read calls for me to use here. As far as I can tell, I didn’t have to define anything to get the fields above. I have heavy caching on this specific use case, but even with it all disabled, it doesn’t seem to want to update.

Any insight on how this works? Does the CMS need some time to recognize that the new field exists or that at least some entities have content?

Hi Nick,

Hmm, not sure how recently you mean by “recently added.” It looks like you can expect $_LW->read() in some context to have a cache that rotates every ~15min. Just in case, would you check and see if your new profiles_437 is being returned now that that will have definitely passed?

Thanks,
Karl

To be more specific, added yesterday afternoon, and tested again this morning.

But I figured it out just now. I could filter on the field in a widget, but it wouldn’t display the value in the format. I then remembered setting the field to, never display rather than unassigned. I must have been working quick and thinking “never display in details UI” given the association with body and sidebar. (I think I remember seeing a 3.0 of this that might be clearer?)

chrome_2RKVMepYuq

:upside_down_face: One of those weeks, I guess. I knew it was an abnormal situation, but couldn’t figure out how.

Thanks for the prompt to think and test it one more time.

1 Like

Ahhh yes “never display” includes that read() response, that makes sense (but also I didn’t think of it either!). Good catch!