Prune Users

Automatically delete user accounts based on their last activity
User avatar
kasimi
mChat developer
Posts: 729
Joined: 06 Oct 2016, 09:56
Location: Germany
Contact:

Re: Prune Users

#21

Post by kasimi » 27 Aug 2018, 08:12

I see where your problem is. To only prune users who have been active at least once, try this:
  • Open ext/kasimi/pruneusers/cron/prune_users.php
  • Find, around line 124:

    Code: Select all

    AND u.user_lastvisit < ' . (int) $lifetime;
    
  • On a new line above, add:

    Code: Select all

    AND u.user_lastvisit > 0
    

User avatar
jan_2017
Distinguished Donor
Posts: 120
Joined: 13 May 2017, 18:07

Re: Prune Users

#22

Post by jan_2017 » 27 Aug 2018, 08:15

Okay :D

I will test it , very thanks!

Bye Jan :wave:

User avatar
jan_2017
Distinguished Donor
Posts: 120
Joined: 13 May 2017, 18:07

Re: Prune Users

#23

Post by jan_2017 » 22 Sep 2018, 12:45

I have found an error in acp error log:
Ein allgemeiner Fehler ist aufgetreten: General Error
» SQL ERROR [ mysqli ]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND u.user_lastvisit < 1514029275' at line 6 [1064]

SQL

SELECT u.user_id, u.username
FROM phpbb_users u
WHERE u.user_type = 0
AND u.user_id <> 1
AND u.user_lastvisit > 0;
AND u.user_lastvisit < 1514029275

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 999
CALL: trigger_error()

FILE: [ROOT]/phpbb/db/driver/mysqli.php
LINE: 193
CALL: phpbb\db\driver\driver->sql_error()

FILE: [ROOT]/phpbb/db/driver/factory.php
LINE: 329
CALL: phpbb\db\driver\mysqli->sql_query()

FILE: [ROOT]/ext/kasimi/pruneusers/cron/prune_users.php
LINE: 126
CALL: phpbb\db\driver\factory->sql_query()

FILE: [ROOT]/ext/kasimi/pruneusers/cron/prune_users.php
LINE: 76
CALL: kasimi\pruneusers\cron\prune_users->get_expired_users()

FILE: (not given by php)
LINE: (not given by php)
CALL: kasimi\pruneusers\cron\prune_users->run()

FILE: [ROOT]/phpbb/cron/task/wrapper.php
LINE: 104
CALL: call_user_func_array()

FILE: [ROOT]/cron.php
LINE: 78
CALL: phpbb\cron\task\wrapper->__call()

User avatar
kasimi
mChat developer
Posts: 729
Joined: 06 Oct 2016, 09:56
Location: Germany
Contact:

Re: Prune Users

#24

Post by kasimi » 22 Sep 2018, 12:58

You added a semicolon that doesn't belong there:

Code: Select all

AND u.user_lastvisit > 0;
Remove it and you should be good to go. :+1:

User avatar
jan_2017
Distinguished Donor
Posts: 120
Joined: 13 May 2017, 18:07

Re: Prune Users

#25

Post by jan_2017 » 22 Sep 2018, 13:07

small mistake big effect

thanks , i have fixed it

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest