• Welcome to Simple Machines Community Forum. Please login or sign up.

Groups don't work properly on new users (with suggested fix)

Started by jelv, October 24, 2009, 07:41:04 PM

Previous topic - Next topic


SMF 1.1.10
Mambo 4.6.5
Bridge 1.1.2

Symptoms: I'm using SMF registration - the forums have been converted from phpBB so I have loads of users in SMF which do not exist in Mambo. I have mapped the groups in the SMF bridge - including some groups which map to author. When you log in a user is created in Mambo. What I was finding was that the user was not created with the correct rights - a menu item with access level Special was not displayed to a user in Mambo group Author, even though when displaying the list of users in Mambo his group appeared correct.

Cause: I found that in the Mambo users table when a SMF user was added to Mambo the column usertype was not populated - populating this field and the permissions worked correctly - users belonging to group Author could now see the items with access level special.

Proposed solution: I'm a novice php programmer but this code change seems to have done the trick.

Module components\com_smf\smf.php

660:         //Just in case....
661:         if (!isset($group) || $group == '' || $group == 0 )
662:            $group = '18';
664:         $mos_sync_groups = mysql_query("
665:               SELECT `name`
666:               FROM " . $configuration->get('mosConfig_dbprefix') . "core_acl_aro_groups
667:               WHERE `group_id` = " . $group
668:               );
669:         list ($group_name) = mysql_fetch_row($mos_sync_groups);
664:         $mos_write = mysql_query("
665:            INSERT INTO " . $configuration->get('mosConfig_dbprefix') . "users
666:               (name,username,email,password,gid,usertype)
667:            VALUES ('$username', '$username', '$user_settings[emailAddress]', '$passwd', '$group', '$group_name')");

Edit: Looking at the code in the 2.0 bridge the same problem exists in that version




Interesting, and good work.

I think this is rooted in a bug in Mambo 4.6.5, actually.  The usertype field in the mos_users table is a left-over from Mambo 4.5.0.  By 4.6.x, the ACL tables should be used for all permissions, not the users table.


Quote from: Orstio on November 01, 2009, 08:04:03 PM
Interesting, and good work.


It was a ****** to track down! I found it after editing the user in Mambo and saving it without making any changes - that made it work. So I then had to identify what the difference was in the database.