Problem analysis: in file administrator/components/com_smf/admin.smf.class.php $data is used as an object while at this point it is an array
Fix:
Code:
--- administrator/components/com_smf/admin.smf.class.php.orig 2007-04-05 21:22:37.000000000 +0200
+++ administrator/components/com_smf/admin.smf.class.php 2007-04-05 21:15:00.000000000 +0200
@@ -1342,7 +1342,7 @@
case 'realName':
if ($jsmfConfig->sync_uname) {
- $val = $data->username;
+ $val = $data['username'];
}
break;
case 'gender':
====================================================================+++ administrator/components/com_smf/admin.smf.class.php 2007-04-05 21:15:00.000000000 +0200
@@ -1342,7 +1342,7 @@
case 'realName':
if ($jsmfConfig->sync_uname) {
- $val = $data->username;
+ $val = $data['username'];
}
break;
case 'gender':
Issue: I do not get smf_id in my CB profile.
Analysis: from what I can see from the code, the only place where the smf_id is added to CB is in integrateChangeMemberData, which is called when something changes in SMF (at least that's my understanding, but I can be wrong with that)
Since in my setup, registration and profile maintenance is only done in Joomla!/CB, I never get the smf_id in my joomla! profile...
Proposed solution: my knowledge of the bridge is limitted, but the following hack seems to work: when a user is registered in CB and inserted in SMF, we retrieve the smf_id and update CB
Code:
--- components/com_smf/smf.class.php.orig 2007-04-05 23:17:44.000000000 +0200
+++ components/com_smf/smf.class.php 2007-04-05 23:16:31.000000000 +0200
@@ -990,6 +990,32 @@
$data->password = $password;
if (!$this->createSMFUser($data)) {
return false;
+ } else {
+ // PVanhaes
+ // We can update CB with SMFID....
+ // We could be more efficient, but this should work...
+ if ($this->isComInstalled('Community Builder%')) {
+ $jid = $this->getJid(null, $data->username);
+ if (empty($jid)) {
+ mosErrorAlert($jsmf->err);
+ return false;
+ }
+ $sid = $this->getSMFid(null, $data->username);
+ if (empty($sid)) {
+ mosErrorAlert($jsmf->err);
+ return false;
+ }
+ $query =
+ "UPDATE #__comprofiler " .
+ "SET cb_jsmfid = '$sid' " .
+ "WHERE id = '$jid' " .
+ "LIMIT 1";
+ $database->setQuery($query);
+ if (!$database->query()) {
+ mosErrorAlert($database->getErrorMsg().' ~~~ FROM::'.__FILE__.' || '.__FUNCTION__.' || '.__LINE__);
+ return false;
+ }
+ }
}
}
return true;
+++ components/com_smf/smf.class.php 2007-04-05 23:16:31.000000000 +0200
@@ -990,6 +990,32 @@
$data->password = $password;
if (!$this->createSMFUser($data)) {
return false;
+ } else {
+ // PVanhaes
+ // We can update CB with SMFID....
+ // We could be more efficient, but this should work...
+ if ($this->isComInstalled('Community Builder%')) {
+ $jid = $this->getJid(null, $data->username);
+ if (empty($jid)) {
+ mosErrorAlert($jsmf->err);
+ return false;
+ }
+ $sid = $this->getSMFid(null, $data->username);
+ if (empty($sid)) {
+ mosErrorAlert($jsmf->err);
+ return false;
+ }
+ $query =
+ "UPDATE #__comprofiler " .
+ "SET cb_jsmfid = '$sid' " .
+ "WHERE id = '$jid' " .
+ "LIMIT 1";
+ $database->setQuery($query);
+ if (!$database->query()) {
+ mosErrorAlert($database->getErrorMsg().' ~~~ FROM::'.__FILE__.' || '.__FUNCTION__.' || '.__LINE__);
+ return false;
+ }
+ }
}
}
return true;
===================================================================
Issue: cannot change username in CB (Error: Username (MyNewName) does not exist in SMF or not able to retrieve userid )
Analysis: in administrator/components/com_smf/admin.smf.class.php, function updateMember we have:
Code:
//check if we already have the user's smf id from CB
if (empty($extras->cb_jsmfid)) {
$uid = $this->getSMFid($data->id, $data->username);
if (!$uid || empty($uid)) {
//might be updating their username
if ($jsmfConfig->cache_user_array && $jsmfConfig->caching) {
$user_array = $jsmfCache->get('user_array');
if (empty($user_array)) {
jsmfFrontend::_buildUserArray();
$user_array = $jsmfCache->get('user_array');
}
$uid = array_search($data->id, $user_array);
}
if (empty($uid)) {
//user doesn't exist, no good
$this->err = 'Username ('.$data->username.') does not exist in SMF or not able to retrieve userid ~~~ FROM::'.__FILE__.' || '.__FUNCTION__.' || '.__LINE__;
return false;
}
}
if (empty($extras->cb_jsmfid)) {
$uid = $this->getSMFid($data->id, $data->username);
if (!$uid || empty($uid)) {
//might be updating their username
if ($jsmfConfig->cache_user_array && $jsmfConfig->caching) {
$user_array = $jsmfCache->get('user_array');
if (empty($user_array)) {
jsmfFrontend::_buildUserArray();
$user_array = $jsmfCache->get('user_array');
}
$uid = array_search($data->id, $user_array);
}
if (empty($uid)) {
//user doesn't exist, no good
$this->err = 'Username ('.$data->username.') does not exist in SMF or not able to retrieve userid ~~~ FROM::'.__FILE__.' || '.__FUNCTION__.' || '.__LINE__;
return false;
}
}
Now,
- getSMFid fails since we are changing username (normal behaviour)
- the cache lookup fail as well, since I have user cache disabled (normal behaviour as well)
- but what is strange is that cb_jsmfid is not in $extras, while I do have the smf_id in CB!
Looking at the CB code, it appears that CB will only exposes in $extras the fields that are published and not readonly. The issue here is that jsmf create the field readonly...
I have switched that readonly flag, and now it works.
This is not very nice since the field appears in the profile with no value (hidden).
Again this may not be the proper fix here, just wanted to highlight the issue and a possible workaround...
Modarator Note: please edit your post.In stat of posting a new one
We merged all post to one.Contributor Note: This is your decision, but I was reporting 3 separate issues that in my view deserves 3 different posts -- Now if somebody want to comment on one of these issues, they are all mixed.
Are you on a post-saving quest?
Groetjes
Philippe
Forum 



)




