Home arrow Forum
deleting user from smf doesn't delete him in mambo
  Welcome, Guest. Please login or register.
January 07, 2009, 09:23:47 PM
Home New Posts Search Calendar


Login with username, password and session length
Forum  |  MamboHacks.com  |  Mambo-SMF Forum 1.3.0 Support  |  Topic: deleting user from smf doesn't delete him in mambo « previous next »
Pages: [1] Go Down Print
Author Topic: deleting user from smf doesn't delete him in mambo  (Read 5862 times)
kronky
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 7


View Profile WWW
deleting user from smf doesn't delete him in mambo
« on: July 01, 2005, 08:13:11 AM »

Hello,

When a member want to delete his account, smf display this error message :
Quote
The user whose profile you are trying to view does not exist.

The user is nevertheless deleted in smf database but not in mambo one. If he login from mambo, his account is recreated in smf !

It is not a major issue (you can delete user from mambo admin) but in France, the LEN imposes websites to allow users to delete their account.
Logged
cowboy
Administrator
Hero Member
*****

Karma: +30/-0
Offline Offline

Posts: 663



View Profile WWW
Re: deleting user from smf doesn't delete him in mambo
« Reply #1 on: July 01, 2005, 10:43:34 AM »

I understand this. Maybe for now, you can ask your users to email you if they want their account completely removed.
Logged
Allie
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 5


View Profile
Re: deleting user from smf doesn't delete him in mambo
« Reply #2 on: August 11, 2005, 09:11:46 AM »

Phooey.  I just ran into this problem too.  Deleted about a hundred users for good reason (false users advertising porn sites, brought over from our insecure phpBB transition).

Since the mambo user search capabilities aren't as good, it will be hard for me to go dig them out of the mambo side. Sad


Is it slated to be fixed in the next release, or am I out of luck?


Thanks,

Allie
Logged
cowboy
Administrator
Hero Member
*****

Karma: +30/-0
Offline Offline

Posts: 663



View Profile WWW
Re: deleting user from smf doesn't delete him in mambo
« Reply #3 on: August 11, 2005, 11:59:30 AM »

It's slated on version 2.0, after the finaly release for 1.1. Maybe few weeks more.

If you want, you can manually delete those users in Mambo manually.

Something like this:

Code:
Delete from mos_users where username not in (select memberName from smf_members);

WARNING: This assumes that you're SMF and Mambo were in sync before you deleted the users in SMF. Please test this in one account (by adding LIMIT 1) or in your development server.

I think, there are 2 more tables that's needed to be cleared in mambo. But the SQL above will solve your issue.
Logged
pestilence
Newbie
*

Karma: +2/-0
Offline Offline

Posts: 14


View Profile
Re: deleting user from smf doesn't delete him in mambo
« Reply #4 on: August 25, 2005, 05:18:25 PM »

Hi all, i am currently heavily modifying com_comprofiler (Community builder) for integration with the Mambo-SMF bridge.
I suppose that in 2-3 days i will be ready, i will be posting tomorrow the Mambo hack to delete users from the SMF database as well (also remove the posts and everything).
Logged
pestilence
Newbie
*

Karma: +2/-0
Offline Offline

Posts: 14


View Profile
Re: deleting user from smf doesn't delete him in mambo
« Reply #5 on: August 25, 2005, 07:18:41 PM »

Ok here we go...this first post is my solution for those using Community Builder.
I will try later also to post a solution for those using the default mambo user component.
Open the file admin.comprofiler.php
Add the following code block to the end of the file:

Code:
function deleteSMF($userid) {
    global $database;
    $database->setQuery("UPDATE smf_messages SET ID_MEMBER = 0 WHERE ID_MEMBER = '$userid'");
    $database->query();
    $database->setQuery("DELETE FROM smf_members WHERE ID_MEMBER = '$userid'");
    $database->query();
    $database->setQuery("DELETE FROM smf_log_topics WHERE ID_MEMBER = '$userid'");
    $database->query();
    $database->setQuery("DELETE FROM smf_log_boards WHERE ID_MEMBER = '$userid'");
    $database->query();
    $database->setQuery("DELETE FROM smf_log_mark_read WHERE ID_MEMBER = '$userid'");
    $database->query();
    $database->setQuery("DELETE FROM smf_log_notify WHERE ID_MEMBER = '$userid'");
    $database->query();
    $database->setQuery("DELETE FROM smf_log_online WHERE ID_MEMBER = '$userid'");
    $database->query();
    $database->setQuery("DELETE FROM smf_collapsed_categories WHERE ID_MEMBER = '$userid'");
    $database->query();
    $database->setQuery("DELETE FROM smf_themes WHERE ID_MEMBER = '$userid'");
    $database->query();
    $database->setQuery("UPDATE smf_instant_messages SET ID_MEMBER_FROM = 0 WHERE ID_MEMBER_FROM '$userid'");
    $database->query();
    $database->setQuery("DELETE FROM smf_moderators WHERE ID_MEMBER = '$userid'");
    $database->query();
    //Now update the modSettings
    $database->setQuery("SELECT COUNT(ID_MEMBER) AS count, MAX(ID_MEMBER) AS max FROM smf_members");
    $results = $database->loadObjectList();
    $memberCount = $results[0]->count;
    $latestmember = $results[0]->max;
    $database->setQuery("SELECT IFNULL(realName, memberName) AS realName FROM smf_members WHERE ID_MEMBER = " . (int) $latestmember . " LIMIT 1");
    $latestRealName = $database->loadResult();
    $database->setQuery("REPLACE INTO smf_settings (variable,value) VALUES ('latestMember', '$latestmember'),('latestRealName', '$latestRealName'),('memberCount', '$memberCount')");
    $database->query();
    return;
}

The userid that is passed to the above function is the SMF ID_MEMBER (not the mambo userid), this function interacts with the removeusers function of community builder.
So find the removeusers function and edit:

Around line 996 you will find the following:

Code:
$obj->delete( $id );
$obj2->delete( $id );
$msg .= $obj->getError();
$msg .= $obj2->getError();

Add directly above it the following code (this is needed since SMF userid's and mambo id's are different, we need to find the username first and then check for the id).

Code:
$database->setQuery("SELECT name FROM #__users WHERE id='$id'");
$name = $database->loadResult();

so you should now have:
Code:
$database->setQuery("SELECT name FROM #__users WHERE id='$id'");
$name = $database->loadResult();
$obj->delete( $id );
$obj2->delete( $id );
$msg .= $obj->getError();
$msg .= $obj2->getError();

Now right under the above block add the following lines:

Code:
//SMF Hack
                //Check if SMF is actually installed
                $database->setQuery("SELECT COUNT(*) FROM #__components WHERE link = 'option=com_smf'");
                $active = $database->loadResult();
                if($active > 0)
                {
                    $database->setQuery("SELECT ID_MEMBER from smf_members WHERE memberName = '$name'");
                    $smfid = $database->loadResult();
                    deleteSMF($smfid);
                }
                // End SMF Hack

As you can see this is the place where the deleteSMF is called.
Now everytime you erase a user from the mambo administration tool of the community builder the user is also erased (with all of his stuff) from SMF as well.
This is a quick fix for the delete issue. I am working on a totaly modified community component which will integrade both SMF and gallery2 components.
Logged
Pages: [1] Go Up Print 
Forum  |  MamboHacks.com  |  Mambo-SMF Forum 1.3.0 Support  |  Topic: deleting user from smf doesn't delete him in mambo « previous next »
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Forum | Powered by SMF 1.0.5 & Mambo-SMF.
© 2001-2005, Lewis Media. All Rights Reserved.
Valid XHTML 1.0! Valid CSS!
None of the text or images in this public website may be copied without the expressed written consent of the authors.
Copyright 2005 by MamboHacks.com. Powered by Mambo. All rights reserved.
TERMS OF USE