Welcome to Geeklog, Anonymous Monday, November 25 2024 @ 04:20 am EST

Geeklog Forums

pruning


FreakWorld

Anonymous
I know this was talked about in the past.
But did anyone ever make some kind of hack.plug that can prune members that have not logged in for a long time or at all? praying it will work

I hate going through a 1000+ members every month to drop people that has not logged in for a long time. Giving it a try
 Quote

Status: offline

zipstart

Forum User
Chatty
Registered: 09/13/04
Posts: 60
You can do it easily enough with phpMyAdmin. Make sure the user to be deleted hasn't ever posted any stories, posts, comments, Gallery pics etc.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by zipstart: You can do it easily enough with phpMyAdmin.

I have to advise against that.

Even if the user hasn't posted anything (and worse if s/he did), that would leave orphaned records in the group_assignment table and possibly in plugins.

Since Geeklog 1.3.9, there's a handy USER_deleteAccount function that takes care of everything. It shouldn't be too hard to write a script (doesn't have to be a plugin) that deletes users based on certain criteria.

bye, Dirk
 Quote

FreakWorld

Anonymous
Ya I read in a past post were you said that Dirk.
But I am PHP stupid Doh! - that was a mistake and fear the damage I well do to my site by playing with it. Can someone help me
 Quote

tokyoahead

Anonymous
I wrote a static page for that. it links to the members page where you can delete it.

Put this into a "execute PHP" type static page:

Text Formatted Code

$iaup_action=$_POST['iaup_action'];

if ($iaup_action=="delete")
    {iaup_delete();}
else {iaup_index();}

function iaup_index()
{
global $_TABLES;
global $_CONF;
$sql="SELECT username, {$_TABLES['users']}.regdate, {$_TABLES['users']}.uid FROM {$_TABLES['users']} ";
$sql.="LEFT JOIN {$_TABLES['userinfo']} ON {$_TABLES['users']}.uid={$_TABLES['userinfo']}.uid ";
$sql.="WHERE ({$_TABLES['userinfo']}.lastlogin=0 OR {$_TABLES['userinfo']}.lastlogin IS NULL) AND {$_TABLES['users']}.uid>1 ";
$sql.="ORDER BY {$_TABLES['users']}.regdate";

$result = DB_query($sql);
$nrows = DB_numRows($result);

$display.=COM_startBlock("Users that never logged in: ($nrows Users found)");
$display.="<Table>";
$display.="<TR><TD><B>No</B></TD><TD><B>Name</B></TD><TD><B>Reg. Date</B></TD></TR>";
for ($i=0;$i<$nrows;$i++)
    {
    $j=$i+1;
    $user = DB_fetchArray($result);
    $display.="<TR><TD>$j:</TD><TD><A HREF=\"";
    $display.=$_CONF['site_admin_url']."/user.php?mode=edit&uid={$user['uid']}\">";
    $display.=$user['username']."</A></TD>";
    $display.="<TD>".$user['regdate']."</TD></TR>";
    }
$display.="</Table>";

$display.=COM_endBlock();

$sql="SELECT username, {$_TABLES['userinfo']}.lastlogin, {$_TABLES['users']}.uid FROM {$_TABLES['users']} ";
$sql.="LEFT JOIN {$_TABLES['userinfo']} ON {$_TABLES['users']}.uid={$_TABLES['userinfo']}.uid ";
$sql.="WHERE {$_TABLES['users']}.uid>1 AND {$_TABLES['userinfo']}.lastlogin>0 ";
$sql.="ORDER BY {$_TABLES['userinfo']}.lastlogin LIMIT 20";

$result = DB_query($sql);
$nrows = DB_numRows($result);

$display.=COM_startBlock("Users that did not login for a long time: (Top 20)");
$display.="<Table>";
$display.="<TR><TD><B>No</B></TD><TD><B>Name</B></TD><TD><B>Last Login</B></TD></TR>";
for ($i=0;$i<$nrows;$i++)
    {
    $j=$i+1;
    $user = DB_fetchArray($result);
    $display.="<TR><TD>$j:</TD><TD><A HREF=\"";
    $display.=$_CONF['site_admin_url']."/user.php?mode=edit&uid={$user['uid']}\">";
    $display.=$user['username']."</A></TD>";
    $lastlogin=date("Y.m.d H:i:s",$user['lastlogin']);
    $display.="<TD>$lastlogin</TD></TR>";
    }
$display.="</Table>";
$display.=COM_endBlock();

echo $display;
}

 
 Quote

Status: offline

zipstart

Forum User
Chatty
Registered: 09/13/04
Posts: 60
Quote by Dirk:
Quote by zipstart: You can do it easily enough with phpMyAdmin.
Even if the user hasn't posted anything (and worse if s/he did), that would leave orphaned records in the group_assignment table and possibly in plugins.


Excellent point!
 Quote

FreakWorld

Anonymous
Thanks tokyoahead!
That made life a lot easier Big Celebration
 Quote

All times are EST. The time is now 04:20 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content