By wout on Tuesday, 05 February 2019
Posted in General Issues
Replies 2
Likes 0
Views 581
Votes 0
Dear,

we created an intranet using the easysocial module and we wanted to display a general field in the listing page.
So we added a custom field (COM_EASYSOCIAL_FIELDS_PROFILE_DEFAULT_GENERAL) and we have overwritten the \templates\ja_intranet\html\com_easysocial\helpers\listing\user.php file and added the following code snippet.

<?php $generalinfo = null;

foreach($user->getCustomFields() as $struct) {
if ($struct->title==="COM_EASYSOCIAL_FIELDS_PROFILE_DEFAULT_GENERAL") { echo trim($struct->data);break;}}
?>

This at first seemed to work nicely, and the custom info is displayed. But now it seems to be unstable. For some users it appears. For some users it does not. Even for one user when saving the user data the extra field appears, after saving the user again (without changing anything, the extra fields dissappears). So I guess there is some cache which prevents the loading properly.

As an extra info and also weird thing, when I we go to the listings page (by following the link in the main menu) the field is not retrieved. But when searching for the user in the search box the user is found with the extra information displayed....
(See screenshots empty general info / with general info)

Can you check what is wrong here?

W
I narrowed it down to the administrator\components\com_easysocial\tables\field.php.

Here on line 1044 I changed the key value for the cache as a temporary workaround.

I changed

$key = $uid . $type;

to

$key = $uid .'-'. $type;


Please advice on how to fix it properly ;-)
·
Tuesday, 05 February 2019 05:05
·
0 Likes
·
0 Votes
·
0 Comments
·
This isn't really a fix as the changes that you did has the same effect just like the initial code where it only executes once to prevent queries being queried multiple times.

I do not really understand what you are trying to achieve here but I believe you are trying to get every field data about the user, is that right?

You should take a look at the existing codes in /components/com_easysocial/views/profile/view.html.php under the method @about as that view is rendering all information about the user too.
·
Thursday, 07 February 2019 11:41
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post