We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11979
    • 8 Posts
    hello,
    i noticed when a Web User gets deleted the SMFConnector deleted the user fine in mode 3 but the stats dont get updated IE totalMembers count lastest member sign-up....i have edited the SMFConnector plugin to fix these problems....here is the code below you will find these sections near the bottom of the SMFConnector Plugin

    Original
    			else if($delMode==3) {
    
    				// to-do we also need to delete a few other things here.
    				// can someone add this?
    
    				$db->delete($tbl,"$binaryLookup memberName='".$modx->db->escape($username)."'");
    				$modx->logEvent(0,1,"SMF account '$username' has been deleted","SMF - Account delete");
    			}
    


    Modified
    			else if($delMode==3) {
    
    				// to-do we also need to delete a few other things here.
    				// can someone add this?
    
    				$db->delete($tbl,"$binaryLookup memberName='".$modx->db->escape($username)."'");
    				$modx->logEvent(0,1,"SMF account '$username' has been deleted","SMF - Account delete");
    
                                    // added by Brandon Hansen [RemoteHams.com]
                                    $tbl_sync = $smf->getFullTableName("settings");
    
    				// sync totalMembers
    	                                $tm_query = $modx->db->select("*", $tbl, "", "", "");
    	                                $tm_count = $modx->db->getRecordCount($tm_query);
    	                                // update table
    	                                $totalMembers = $modx->db->update("value='$tm_count'", $tbl_sync, "variable = 'totalMembers'", "", "");
    
    				// sync latestMember
    	                                $lm_query = $modx->db->select("ID_MEMBER,realName", $tbl, "", "ID_MEMBER DESC", "1");
    	                                $lm_value = $modx->db->getRow($lm_query);
    	                                // update table
    	                                $lm_update = $modx->db->update("value='".$lm_value['ID_MEMBER']."'", $tbl_sync, "variable = 'latestMember'", "", "");
    
    				// sync latestRealName
    	                                $lrn_query = $modx->db->select("ID_MEMBER,realName", $tbl, "", "ID_MEMBER DESC", "1");
    	                                $lrn_value = $modx->db->getRow($lrn_query);
    	                                // update table
    	                                $lrn_update = $modx->db->update("value='".$lrn_value['realName']."'", $tbl_sync, "variable = 'latestRealName'", "", "");
    
                                    // end added by Brandon Hansen [RemoteHams.com]
    			}
    


    hope this helps someone & 73’s
    Brandon [kg6ypi]
      • 8461
      • 205 Posts
      excellent, many thanks for the post