- 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
Prune Users
-
- mChat developer
- Posts: 1173
- Joined: 06 Oct 2016, 09:56
- Location: Germany
Re: Prune Users
I see where your problem is. To only prune users who have been active at least once, try this:
-
- Distinguished Donor
- Posts: 166
- Joined: 13 May 2017, 18:07
Re: Prune Users
Okay
I will test it , very thanks!
Bye Jan

I will test it , very thanks!
Bye Jan

-
- Distinguished Donor
- Posts: 166
- Joined: 13 May 2017, 18:07
Re: Prune Users
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()
-
- mChat developer
- Posts: 1173
- Joined: 06 Oct 2016, 09:56
- Location: Germany
Re: Prune Users
You added a semicolon that doesn't belong there:
Remove it and you should be good to go. 
Code: Select all
AND u.user_lastvisit > 0;

-
- Distinguished Donor
- Posts: 166
- Joined: 13 May 2017, 18:07
Re: Prune Users
small mistake big effect
thanks , i have fixed it
thanks , i have fixed it
-
- Distinguished Donor
- Posts: 28
- Joined: 01 Jan 2019, 12:41
Re: Prune Users
I'm not sure if u are still working on this ext, but it would be great, as we all love your mChat, to make it possible like for mchat rooms, to enter a user ID that posts into the chat that the user has to make at least 1 post or his account will be pruned after the set time.
Maybe let the admin set the exact text to be posted into the chat.
I saw this already at terry2's board, but as it is ur extension i better ask u if you can do this
thanks
Maybe let the admin set the exact text to be posted into the chat.
I saw this already at terry2's board, but as it is ur extension i better ask u if you can do this

thanks

-
- mChat developer
- Posts: 1173
- Joined: 06 Oct 2016, 09:56
- Location: Germany
Re: Prune Users
I probably won't add that feature to this extension, but editing the code so that these users are deleted too should be easy:
- Open
ext/kasimi/pruneusers/cron/prune_users.php
- Find the SQL query on lines 120-124:
Code: Select all
$sql = 'SELECT u.user_id, u.username FROM ' . USERS_TABLE . ' u WHERE u.user_type = ' . USER_NORMAL . ' AND u.user_id <> ' . ANONYMOUS . ' AND u.user_lastvisit < ' . (int) $lifetime;
- Replace with:
Code: Select all
global $table_prefix; $sql = 'SELECT u.user_id, u.username FROM ' . USERS_TABLE . ' u LEFT JOIN ( SELECT mt.user_id, MAX(mt.message_time) AS latest_message_time FROM ' . $table_prefix . 'mchat mt GROUP BY mt.user_id ) AS m ON u.user_id = m.user_id WHERE u.user_type = ' . USER_NORMAL . ' AND u.user_id <> ' . ANONYMOUS . ' AND (u.user_lastvisit < ' . (int) $lifetime . ' OR m.latest_message_time < ' . (int) $lifetime . ')';
-
- Posts: 26
- Joined: 01 May 2017, 01:06
Re: Prune Users
Hi any chance members with 0 post count could be added for pruning also?
Thanks
Thanks
-
- mChat developer
- Posts: 1173
- Joined: 06 Oct 2016, 09:56
- Location: Germany
Re: Prune Users
Sure:
- Open
ext/kasimi/pruneusers/cron/prune_users.php
- In the SQL query on lines 120-124, find:
Code: Select all
AND u.user_id <> ' . ANONYMOUS . '
- On a new line below, add:
Code: Select all
AND user_posts = 0
Who is online
Users browsing this forum: Ahrefs [Bot], CCBot [Bot] and 0 guests