Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

updateGroupList bug; not called after group deletion

10 years 4 months ago
Licenses:
JomSocial Active iSEO Expired Socialize Expired

I noticed a problem with the _groups information returned when running the CFactory::getUser() call in certain scenarios

There is a function in the file: components/com_community/libraries/user.php called update updateGroupList. This function updates the group row in the users record in #_community_users. I imagine for performance, when one wants to fetch the members a group is in we can simply do CFactory::getUser()->_groups to get a listing of the group members. This way we don’t need to do all the LEFT joins.

The problem I am running into is that the groups row in the users record is not always in sync. It becomes out of sync when I delete a group from the jomsocial backend

How to recreate:
1) Join a jomSocial Group called ‘Basket Weaving’. Lets pretend it has an ID of 5 from the #_community_groups table
2) In the JomSocial Admin (Joomla Backend) delete the ‘Basket Weaving’ Group. Notice that the table #_community_groups_members is updated correctly. There are no longer any records referenceing the ‘Basket Weaving’ groupid with 5
3) Now find your user record in the #_community_users table and look at the row group. Notice that it is a coma delimited list and it still has the basket weaving group of 5. Ex: 1,2,5 will still be there.

The reason that you still appear as a member in the step 3 (above) is because even though the function updateGroupList is called, the forceupdate value is not set to true. The only time the groups are forced to update is when a user manually joins or leaves a group. In reality, an admin may delete a group; and therefore a user’s group row will not be updated until they manually decided to join or leave another group.

This probably isn’t a huge issue but figure I should point it out. To correct this issue I propose:
- Run the updateGroupList function could be called everytime a user signs in to JomSocial.
- Alternatively, if this creates to much overhead: manually update each members record in #_community_users table when a group is deleted. Ex: I click delete basket weaving group. Behind the scenes when I click this there needs to be a function that: 1 – gets all current group members. 2 – remove the id 5 (basket weaving) group from their record in community_users. 3 – then delete the group from the #_groups table and the #_groups_members table (which is already being done anyways).

10 years 4 months ago
  • Dimas Tekad Santosa's Avatar
  • Dimas Tekad Santosa
  • Visitor
  • Thank you received: 0
Licenses:

Hi John,

Make sense, I need consult with the developer for this issue.

thank you

Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW