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.

JomSocial Update user each time

11 years 6 months ago
Licenses:
JomSocial Expired

ISSUE SUMMARY:
We have found very strange behavior of JomSocial.
Jomsocial updates users when a anybody opens jomsocial page. It updates those users whose data show in rendered page which triggers all Joomla UserType Plugin's "onUserAfterSave" and "onUserBeforeSave" events makes site too slow.

This issue is not JomSocial specific version issue. It is happening FROM all 2 years old TO latest jomsocial version.

Note: we don't have made site still live, so mentioning Development Site Information.

11 years 6 months ago
Licenses:

Hi, Mayur.

I assign developer to this thread.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
11 years 6 months ago
Licenses:
JomSocial Expired

Hi Michal,

Thanks for quick response.
I am looking forward to hear from you.

11 years 6 months ago
Licenses:
JomSocial Expired

Hello guys,

Any Feedback?

11 years 6 months ago
Licenses:
JomSocial Expired

Hello,

Here I have mentioned some more information which may help you to regenerate and debug the same issue at your end:

  • Issue: for-example, forntpage of jomsocial gets activity stream 10 users, for this it uses CFactory::getUser( userid ), which invokes init() function of 'components/com_community/libraries/user.php' file.
  • it calls below functions of same class file on each call made to CFactory::getUser()
    • updateFriendList
    • updateGroupList
    • updateEventList
    • save
  • However, there should be some certain conditions to restrict unwanted execution of above functions.
    • We found as below:
    • updateGroupList updates same '_groups' field in jomsocial user table, even if 'existing' and 'new group data ' are empty.
      • The function original was as below:
        	  						public function updateGroupList($forceUpdate = false) {
        						        $my = CFactory::getUser();
        
        						        if ($my->id == $this->id || $forceUpdate) {
        						            if (!class_exists('CommunityModelGroups')) {
        						                $groupModel = CFactory::getModel('groups');
        						            } else {
        						                $groupModel = new CommunityModelGroups();
        						            }
        
        						            $groupsIds = $groupModel->getGroupIds($this->id);
        
        						            if ($groupsIds) {
        						                $groupsIds = implode(',', $groupsIds);
        
        						                if ($this->_groups != $groupsIds) {
        						                    $this->_groups = $groupsIds;
        						                    $this->save();
        						                }
        						            } elseif (empty($groupsIds)) {
        						                $this->_groups = '';
        						                $this->save();
        						            }
        						        }
        						    }
      • We edited this function as below :
        	  						public function updateGroupList($forceUpdate = false) {
        						        if (JFactory::getUser()->get('id') == $this->id || $forceUpdate) {
        						            if (!class_exists('CommunityModelGroups')) {
        						                $groupModel = CFactory::getModel('groups');
        						            } else {
        						                $groupModel = new CommunityModelGroups();
        						            }
        
        						            $groupsIds      = $groupModel->getGroupIds($this->id);
        						            $groupsIds      = sort($groupsIds);
        
        						            $current_groups = explode(",",$this->_groups);
        						            $current_groups = sort($current_groups);
        
        						            $are_same       = ($current_groups == $groupsIds);
        						            if ($are_same != true) {
        						                $this->_groups = '';
        						                if ($groupsIds) {
        						                    $this->_groups = implode(',', $groupsIds);
        						                }
        						                $this->save();
        						            }
        						        }
        						    }
    • Same way we edited updateEventList and updateFriendList functions as below:
      	  			public function updateEventList($forceUpdate = false) {
      			        if (JFactory::getUser()->get('id') == $this->id || $forceUpdate) {
      			            $eventModel     = CFactory::getModel('events');
      			            $eventsIds      = $eventModel->getEventIds($this->id);
      
      			            $eventsIds      = sort($eventsIds);
      			            $current_events = explode(",",$this->_events);
      			            $current_events = sort($current_events);
      
      			            $are_same = ($current_events == $eventsIds);
      			            if ($are_same != true) {
      			                $this->_events = '';
      			                if ($eventsIds) {
      			                    $this->_events = implode(',', $eventsIds);
      			                }
      			                $this->save();
      			            }
      			        }
      				}
      	  			public function updateFriendList($forceUpdate = false) {
      			        if (JFactory::getUser()->get('id') == $this->id || $forceUpdate) {
      			            $friendModel     = CFactory::getModel('friends');
      			            $friendsIds      = $friendModel->getFriendIds($this->id);
      			            $friendsIds      = sort($friendsIds);
      
      			            $current_friends = explode(",",$this->_friends);
      			            $current_friends = sort($current_friends);
      
      			            $are_same        = ($current_friends == $friendsIds);
      			            if ($are_same != true) {
      			                $this->_friendcount = 0;
      			                $this->_friends     = '';
      			                if ($friendsIds) {
      			                    $this->_friendcount = count($friendsIds);
      			                    $this->_friends     = implode(',', $friendsIds);
      			                }
      			                $this->save();
      			            }
      			        }
      				}
  • We also commented the below call from init() function.
    		// $this->save();
  • After processing above updating in code, we found site running very fast and also nothing anonymous behavior in functionality. But, somehow we quite not sure with the our own edits, hope it makes the mentioned scenario very clear
  • To debug the mentioned behavior, you can use LOGMAN extension from JoomlaTools from LOGman from Joomlatools . It reports each user activity and we actual found the malfunctioning of JomSocial using this extension.

Can you please report us anything on same Or any progress made to handle the scenario?

11 years 6 months ago
  • Alex Hee's Avatar
  • Alex Hee
  • Visitor
  • Thank you received: 0
Licenses:

Hi Mayur,

I have updated the code on 26 March, I found out that the user parameter "update_cache_list" is not updated due to certain reason, and that caused the updateGroupList and updateEventList keep on updating every time a user is loaded. Also, it's should be only updated once for each user. I'm not sure if your are using our latest jomsocial 4 but I have provided a patch to override the user library. Can you please try it out and give me a feedback (it might be slow for the first time, try to refresh it and see if it still goes into the updatelist)? Make sure you back up the original file just in case.

Thank you so much for your help.

Attachment components.zip not found

This message has an attachment file.
Please log in or register to see it.

11 years 6 months ago
Licenses:
JomSocial Expired

Hello

I have used JomSocial 3.2.1.5.
and tested the mentioned below code placing it in save() function of User Library of JomSocial and removed my own custom edits:

//fix update cache list not updated
if($this->_params->get('update_cache_list') != $jUser->_params->get('update_cache_list')){
     $jUser->setParam('update_cache_list',1);
}
  • Now, generally it does not updates listed users every time. It updates them single time only.
  • But, it always & every time updates the first user shown in each list of search page.

11 years 6 months ago
  • Alex Hee's Avatar
  • Alex Hee
  • Visitor
  • Thank you received: 0
Licenses:

Hi Mayur,

Thank you for getting back to us with the results. I tried to search the users in my local community and it doesn't seem to trigger the updates in the search page. Can you provide me a screenshot or a quick steps how your replicate it?

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