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

Mambo bridge (both versions) - adding/changing users issues

Started by jelv, October 30, 2009, 04:08:39 PM

Previous topic - Next topic

jelv

The addition of SMF users to Mambo does not set up the Mambo usertype correctly.

Changing the user's SMF Primary Membergroup does not update the Mambo usertype.

See http://www.simplemachines.org/community/index.php?topic=344306.0 which includes a suggested fix.

Edit: Updated description
jelv

jelv

Further testing has revealed more places where `usertype` isn't populated - I'm working through fixes for these and will post back soon.
jelv

jelv

Proposed fix:

All changes are in the Mambo SMF bridge module components\com_smf\smf.php

function integrate_change_member_data (changing users SMF Primary Membergroup)

      foreach ($memberNames as $memberName){

         $mos_sync_groups = mysql_query("
               SELECT `name`
               FROM " . $configuration->get('mosConfig_dbprefix') . "core_acl_aro_groups
               WHERE `group_id` = " . $group
               );
         list ($group_name) = mysql_fetch_row($mos_sync_groups);

         mysql_query ("UPDATE " . $configuration->get('mosConfig_dbprefix') . "users
                  SET `gid` = '$group', `usertype` = '$group_name'
                  WHERE username = '$memberName'
                  ");


function integrate_login (adding an existing SMF user to Mambo)

      //Just in case....
      if (!isset($group) || $group == '' || $group == 0 )
         $group = '18';
   
      $mos_sync_groups = mysql_query("
            SELECT `name`
            FROM " . $configuration->get('mosConfig_dbprefix') . "core_acl_aro_groups
            WHERE `group_id` = " . $group
            );
      list ($group_name) = mysql_fetch_row($mos_sync_groups);

      $mos_write = mysql_query("
         INSERT INTO " . $configuration->get('mosConfig_dbprefix') . "users
            (name,username,email,password,gid,usertype)
         VALUES ('$username', '$username', '$user_settings[emailAddress]', '$passwd', '$group', '$group_name')");


function integrate_register (registering a new user through SMF to also be added to Mambo)

//Just in case....
   if (!isset($group) || $group == '' || $group == 0 )
      $group = '18';
      
   $mos_sync_groups = mysql_query("
         SELECT `name`
         FROM " . $configuration->get('mosConfig_dbprefix') . "core_acl_aro_groups
         WHERE `group_id` = " . $group
         );
   list ($group_name) = mysql_fetch_row($mos_sync_groups);


   //registration will be considered now
   $r_date = date("Y-m-d H:i:s");
      
   //What if the realName field isn't being used?
   if (!isset($Options['register_vars']['realName']) || $Options['register_vars']['realName']=='')
      $Options['register_vars']['realName'] = $Options['register_vars']['memberName'];
            
   mysql_query("
      INSERT INTO " . $configuration->get('mosConfig_dbprefix') . "users
         (name, username, email, password, registerDate, gid, usertype)
      VALUES (" . $Options['register_vars']['realName'] . ", " . $Options['register_vars']['memberName'] . ", " . $Options['register_vars']['emailAddress'] . ", '" . md5($Options['password']) . "', '$r_date', '$group', '$group_name')");
jelv

Advertisement: