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.

User Groups Permissions Changing Randomly

9 years 4 months ago
  • Jim's Avatar
    Topic Author
  • Jim
  • Offline
  • Fresh Boarder
  • Posts: 41
  • Thank you received: 0
Licenses:
JomSocial Active

Users are signing up on the front-end of the site, then an email is sent to the admin to verify the request for access and then the admin gives access via the Users Manager. The signup is all done through JomSocial. Users are randomly being reassigned to "Registered" without any changes being made by the Super User and being given lower level access. Looks like someone else has this issue at www.jomsocial.com/forum/technical-issues...ps-randomly-changing but this was over 2 months ago, and seeming to have an unsure outcome.

This has become an urgent issue, please assist.

Thank you!

9 years 4 months ago
Licenses:

Hi Jim,

please try this solution:
1. open /components/com_community/libraries/user.php
2. at line 1002 you can see this code

if(isset($jUser->groups)) unset($jUser->groups);
changing it to
$jUser->groups = null;

let me know the result.
any reasons you not using jomsocial latest version? 3.2.1.5, it would be great if you can try newest version.

Regards,
Albert

9 years 4 months ago
  • Jim's Avatar
    Topic Author
  • Jim
  • Offline
  • Fresh Boarder
  • Posts: 41
  • Thank you received: 0
Licenses:
JomSocial Active

Hi Albertus,

We are currently hosting the site on a server that does not support the PHP version required to run Joomla 3.3. Will the latest version of JomSocial (3.2.1.5) run correctly on a 3.2.4 site? Also, will the fix that you suggested affect future updates?

Thank you

9 years 4 months ago
Licenses:

Hi Jim,

Jomsocial can running at Joomla 3.2.4
documentation.jomsocial.com/wiki/Joomla_Versions_Compatibility

here the Jomsocial reuirements:
documentation.jomsocial.com/wiki/System_Requirements

We not put the fix at future updates, because that changes have some problems with 3rd party extensions.

May I know about the result for that fix? is that works?

Regards,
Albert

9 years 4 months ago
  • Jim's Avatar
    Topic Author
  • Jim
  • Offline
  • Fresh Boarder
  • Posts: 41
  • Thank you received: 0
Licenses:
JomSocial Active

Albert,

This is a live site with many users, we will not install a "fix" that causes issues with 3rd party extensions and that will possibly break the site. Another confirmed fix is needed that has been tested and does not affect other extensions ASAP. That is simply not a valid resolution.

Thanks

9 years 4 months ago
  • Paul's Avatar
  • Paul
  • Visitor
  • Thank you received: 0
Licenses:

Hi Jim,

We are looking into this now and i will get back to you ASAP

9 years 4 months ago
  • Paul's Avatar
  • Paul
  • Visitor
  • Thank you received: 0
Licenses:

HI Jim,

I am replying to this post to let you know that we have looked further into this issue and late yesterday we discovered that this is, in fact a bug in Joomla and not Jomsocial. To help our own customers we have written a temporary fix. This fix is Joomla code and not Jomsocial. We have also submitted the fix to joomla.org and I would recommend that you vote on this submission. Without votes for the fix, Joomla may not implement the code before their next release. What they do is beyond our control as the bug is not in our product as many users are suggesting.

Below is the code that we have changed which we have tested only on joomla 3.3.3 and joomla 3.3.6
This is the link to the joomla bug submission issues.joomla.org/tracker/joomla-cms/5138

The fix below should be applied only after backing up your entire site. The initial fix you may have been given will also work in some circumstances, but please note that we will not be adding the first fix into our release as it can cause issues with some 3rd party plugins.

The file to modify is siteroot/libraries/joomla/table/user.php

* @link    http://docs.joomla.org/JTable/store
	 * @since   11.1
	 */
	public function store($updateNulls = false)
	{
		// Get the table key and key value.
		$k = $this->_tbl_key;
		$key = $this->$k;

		// TODO: This is a dumb way to handle the groups.
		// Store groups locally so as to not update directly.
		$groups = $this->groups;
		unset($this->groups);

		// Insert or update the object based on presence of a key value.
		if ($key)
		{
			// Already have a table key, update the row.
			$this->_db->updateObject($this->_tbl, $this, $this->_tbl_key, $updateNulls);
		}
		else
		{
			// Don't have a table key, insert the row.
			$this->_db->insertObject($this->_tbl, $this, $this->_tbl_key);
		}

		// Reset groups to the local object.
		$this->groups = $groups;
		unset($groups);

		$query = $this->_db->getQuery(true);

		// Store the group data if the user data was saved.
		if (is_array($this->groups) && count($this->groups))
		{
			// Delete the old user group maps.
			$query->delete($this->_db->quoteName('#__user_usergroup_map'))
				->where($this->_db->quoteName('user_id') . ' = ' . (int) $this->id);
			$this->_db->setQuery($query);
			$this->_db->execute();

			// Set the new user group maps.
			$query->clear()
				->insert($this->_db->quoteName('#__user_usergroup_map'))
				->columns(array($this->_db->quoteName('user_id'), $this->_db->quoteName('group_id')));

			// Have to break this up into individual queries for cross-database support.
			foreach ($this->groups as $group)
			{
				$query->clear('values')
					->values($this->id . ', ' . $group);
				$this->_db->setQuery($query);
				$this->_db->execute();
			}
		}

		// If a user is blocked, delete the cookie login rows
		if ($this->block == (int) 1)
		{
			$query->clear()
				->delete($this->_db->quoteName('#__user_keys'))
				->where($this->_db->quoteName('user_id') . ' = ' . $this->_db->quote($this->username));
			$this->_db->setQuery($query);
			$this->_db->execute();
		}

		return true;
	}

	/**
	 * Method to delete a user, user groups, and any other necessary data from the database.
	 *

and change to this
public function store($updateNulls = false)
	{
		// Get the table key and key value.
		$k = $this->_tbl_key;
		$key = $this->$k;

		// TODO: This is a dumb way to handle the groups.
		// Store groups locally so as to not update directly.
		$groups = $this->groups;
		unset($this->groups);

		// Insert or update the object based on presence of a key value.
		if ($key)
		{
			// Already have a table key, update the row.
			$this->_db->updateObject($this->_tbl, $this, $this->_tbl_key, $updateNulls);
		}
		else
		{
			// Don't have a table key, insert the row.
			$this->_db->insertObject($this->_tbl, $this, $this->_tbl_key);
		}

		// Reset groups to the local object.
		$this->groups = $groups;
		unset($groups);

		$query = $this->_db->getQuery(true);

		// Update the group data if the user data was saved.
		if (is_array($this->groups) && count($this->groups))
		{
            // Grab all usergroup entries for the user
            $query  -> clear()
                    -> select('*')
                    -> from($this->_db->quoteName('#__user_usergroup_map'))
                    -> where($this->_db->quoteName('user_id') . ' = ' . (int) $this->id);

            $this->_db->setQUery($query);
            $result = $this->_db->loadObjectList();

            // Loop through them and check if database contains something $this->groups does not
            if(sizeof($result)) {

                foreach($result as $map) {

                    if(array_key_exists($map->group_id, $this->groups)) {
                        // it already exists, no action required
                        unset($this->groups[$map->group_id]);
                    } else {
                        // it should be removed
                        $query  -> clear()
                                -> delete($this->_db->quoteName('#__user_usergroup_map'))
                                -> where($this->_db->quoteName('user_id') . ' = ' . (int) $this->id)
                                -> where($this->_db->quoteName('group_id') . ' = ' . (int) $map->group_id);

                        $this->_db->setQuery($query);
                        $this->_db->execute();
                    }
                }
            }

            // If there is anything left in this->groups it needs to be inserted
            if(sizeof($this->groups)) {

                // Set the new user group maps.
                $query->clear()
                    ->insert($this->_db->quoteName('#__user_usergroup_map'))
                    ->columns(array($this->_db->quoteName('user_id'), $this->_db->quoteName('group_id')));

                // Have to break this up into individual queries for cross-database support.
                foreach ($this->groups as $group) {
                    $query->clear('values')
                        ->values($this->id . ', ' . $group);
                    $this->_db->setQuery($query);
                    $this->_db->execute();
                }
            }
		}

		return true;
	}

	/**
	 * Method to delete a user, user groups, and any other necessary data from the database.
	 *

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