aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2009-07-24 11:13:32 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2009-07-24 11:13:32 +0000
commit4739c7ba3957dfe585973dafe7465cb9fd8c6d1f (patch)
treec54ede45cda36fd124bcc69ad95ab2d56a70ceaf /phpBB
parentc84d5074c1aef4a1705d4b17472689e8e4a15351 (diff)
downloadforums-4739c7ba3957dfe585973dafe7465cb9fd8c6d1f.tar
forums-4739c7ba3957dfe585973dafe7465cb9fd8c6d1f.tar.gz
forums-4739c7ba3957dfe585973dafe7465cb9fd8c6d1f.tar.bz2
forums-4739c7ba3957dfe585973dafe7465cb9fd8c6d1f.tar.xz
forums-4739c7ba3957dfe585973dafe7465cb9fd8c6d1f.zip
[Feature] Added new functionality to inactive users module:
- Ability to set users per page. - Ability to sort by posts/number of reminders/last reminded date. - Show number of posts and ability to search posts. - Show number of reminders sent to user. - Show date of last reminder sent to user. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9845 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/adm/style/acp_inactive.html51
-rw-r--r--phpBB/develop/create_schema_files.php2
-rw-r--r--phpBB/docs/CHANGELOG.html9
-rw-r--r--phpBB/includes/acp/acp_inactive.php73
-rw-r--r--phpBB/includes/functions_admin.php4
-rw-r--r--phpBB/install/database_update.php8
-rw-r--r--phpBB/language/en/acp/common.php2
-rw-r--r--phpBB/language/en/common.php1
-rw-r--r--phpBB/language/en/memberlist.php8
9 files changed, 110 insertions, 48 deletions
diff --git a/phpBB/adm/style/acp_inactive.html b/phpBB/adm/style/acp_inactive.html
index 240cec1643..ca65416421 100644
--- a/phpBB/adm/style/acp_inactive.html
+++ b/phpBB/adm/style/acp_inactive.html
@@ -12,7 +12,7 @@
<!-- IF PAGINATION -->
<div class="pagination">
- <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> &bull; <span>{PAGINATION}</span>
+ <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> &bull; <span>{PAGINATION}</span>
</div>
<!-- ENDIF -->
@@ -22,8 +22,8 @@
<th>{L_USERNAME}</th>
<th>{L_JOINED}</th>
<th>{L_INACTIVE_DATE}</th>
- <th>{L_INACTIVE_REASON}</th>
<th>{L_LAST_VISIT}</th>
+ <th>{L_INACTIVE_REASON}</th>
<th>{L_MARK}</th>
</tr>
</thead>
@@ -31,11 +31,16 @@
<!-- BEGIN inactive -->
<!-- IF inactive.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
- <td><a href="{inactive.U_USER_ADMIN}">{inactive.USERNAME}</a></td>
- <td>{inactive.JOINED}</td>
- <td>{inactive.INACTIVE_DATE}</td>
- <td>{inactive.REASON}</td>
- <td>{inactive.LAST_VISIT}</td>
+ <td style="vertical-align: top;">
+ {inactive.USERNAME_FULL}
+ <!-- IF inactive.POSTS --><br />{L_POSTS}: <strong>{inactive.POSTS}</strong> [<a href="{inactive.U_SEARCH_USER}">{L_SEARCH_USER_POSTS}</a>]<!-- ENDIF -->
+ </td>
+ <td style="vertical-align: top;">{inactive.JOINED}</td>
+ <td style="vertical-align: top;">{inactive.INACTIVE_DATE}</td>
+ <td style="vertical-align: top;">{inactive.LAST_VISIT}</td>
+ <td style="vertical-align: top;">
+ {inactive.REASON}
+ <!-- IF inactive.REMINDED --><br />{inactive.REMINDED_EXPLAIN}<!-- ENDIF -->
<td>&nbsp;<input type="checkbox" class="radio" name="mark[]" value="{inactive.USER_ID}" />&nbsp;</td>
</tr>
<!-- BEGINELSE -->
@@ -46,25 +51,25 @@
</tbody>
</table>
- <fieldset class="display-options">
- {L_DISPLAY_LOG}: &nbsp;{S_LIMIT_DAYS}&nbsp;{L_SORT_BY}: {S_SORT_KEY} {S_SORT_DIR}
- <input class="button2" type="submit" value="{L_GO}" name="sort" />
- </fieldset>
- <hr />
- <!-- IF PAGINATION -->
- <div class="pagination">
- <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> &bull; <span>{PAGINATION}</span>
- </div>
- <!-- ENDIF -->
+<fieldset class="display-options">
+ {L_DISPLAY_LOG}: &nbsp;{S_LIMIT_DAYS}&nbsp;{L_SORT_BY}: {S_SORT_KEY} {S_SORT_DIR}<!-- IF PAGINATION -->&nbsp;Users per page: <input class="inputbox autowidth" type="text" name="users_per_page" id="users_per_page" size="3" value="{USERS_PER_PAGE}" /><!-- ENDIF -->
+ <input class="button2" type="submit" value="{L_GO}" name="sort" />
+</fieldset>
- <fieldset class="quick">
- <select name="action">{S_INACTIVE_OPTIONS}</select>
- <input class="button2" type="submit" name="submit" value="{L_SUBMIT}" />
- <p class="small"><a href="#" onclick="marklist('inactive', 'mark', true); return false;">{L_MARK_ALL}</a> &bull; <a href="#" onclick="marklist('inactive', 'mark', false); return false;">{L_UNMARK_ALL}</a></p>
- {S_FORM_TOKEN}
- </fieldset>
+<hr />
+<!-- IF PAGINATION -->
+ <div class="pagination">
+ <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> &bull; <span>{PAGINATION}</span>
+ </div>
+<!-- ENDIF -->
+<fieldset class="quick">
+ <select name="action">{S_INACTIVE_OPTIONS}</select>
+ <input class="button2" type="submit" name="submit" value="{L_SUBMIT}" />
+ <p class="small"><a href="#" onclick="marklist('inactive', 'mark', true); return false;">{L_MARK_ALL}</a> &bull; <a href="#" onclick="marklist('inactive', 'mark', false); return false;">{L_UNMARK_ALL}</a></p>
+ {S_FORM_TOKEN}
+</fieldset>
</form>
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index ab021a15ec..09a42bc684 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -1860,6 +1860,8 @@ function get_schema_struct()
'user_newpasswd' => array('VCHAR_UNI:40', ''),
'user_form_salt' => array('VCHAR_UNI:32', ''),
'user_new' => array('BOOL', 1),
+ 'user_reminded' => array('TINT:4', 0),
+ 'user_reminded_time' => array('TIMESTAMP', 0),
),
'PRIMARY_KEY' => 'user_id',
'KEYS' => array(
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index cf1e7a24cc..3e7ae6e4e6 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -226,6 +226,15 @@
<li>[Feature] Users can report PMs to moderators which are then visible in a new MCP module</li>
<li>[Feature] Parse email text files with the template engine.</li>
<li>[Feature] Use email-style quoting when bbcodes are disabled.</li>
+ <li>[Feature] Added new functionality to inactive users module:
+ <ul>
+ <li>Ability to set users per page.</li>
+ <li>Ability to sort by posts/number of reminders/last reminded date.</li>
+ <li>Show number of posts and ability to search posts.</li>
+ <li>Show number of reminders sent to user.</li>
+ <li>Show date of last reminder sent to user.</li>
+ </ul>
+ </li>
</ul>
<a name="v304"></a><h3>1.ii. Changes since 3.0.4</h3>
diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php
index a38b47a704..e41e8f661d 100644
--- a/phpBB/includes/acp/acp_inactive.php
+++ b/phpBB/includes/acp/acp_inactive.php
@@ -51,6 +51,19 @@ class acp_inactive
$form_key = 'acp_inactive';
add_form_key($form_key);
+ // We build the sort key and per page settings here, because they may be needed later
+
+ // Number of entries to display
+ $per_page = request_var('users_per_page', (int) $config['topics_per_page']);
+
+ // Sorting
+ $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
+ $sort_by_text = array('i' => $user->lang['SORT_INACTIVE'], 'j' => $user->lang['SORT_REG_DATE'], 'l' => $user->lang['SORT_LAST_VISIT'], 'd' => $user->lang['SORT_LAST_REMINDER'], 'r' => $user->lang['SORT_REASON'], 'u' => $user->lang['SORT_USERNAME'], 'p' => $user->lang['SORT_POSTS'], 'e' => $user->lang['SORT_REMINDER']);
+ $sort_by_sql = array('i' => 'user_inactive_time', 'j' => 'user_regdate', 'l' => 'user_lastvisit', 'd' => 'user_reminded_time', 'r' => 'user_inactive_reason', 'u' => 'username_clean', 'p' => 'user_posts', 'e' => 'user_reminded');
+
+ $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
+ gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
+
if ($submit && sizeof($mark))
{
if ($action !== 'delete' && !check_form_key($form_key))
@@ -67,7 +80,7 @@ class acp_inactive
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_id', $mark);
$result = $db->sql_query($sql);
-
+
$user_affected = array();
while ($row = $db->sql_fetchrow($result))
{
@@ -122,6 +135,12 @@ class acp_inactive
$messenger->save_queue();
}
+
+ // For activate we really need to redirect, else a refresh can result in users being deactivated again
+ $u_action = $this->u_action . "&amp;$u_sort_param&amp;start=$start";
+ $u_action .= ($per_page != $config['topics_per_page']) ? "&amp;users_per_page=$per_page" : '';
+
+ redirect($u_action);
}
else if ($action == 'delete')
{
@@ -175,7 +194,7 @@ class acp_inactive
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
$messenger = new messenger();
- $usernames = array();
+ $usernames = $user_ids = array();
do
{
@@ -198,28 +217,34 @@ class acp_inactive
$messenger->send($row['user_notify_type']);
$usernames[] = $row['username'];
+ $user_ids[] = (int) $row['user_id'];
}
while ($row = $db->sql_fetchrow($result));
$messenger->save_queue();
+ // Add the remind state to the database
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_reminded = user_reminded + 1,
+ user_reminded_time = ' . time() . '
+ WHERE ' . $db->sql_in_set('user_id', $user_ids);
+ $db->sql_query($sql);
+
add_log('admin', 'LOG_INACTIVE_REMIND', implode(', ', $usernames));
unset($usernames);
}
$db->sql_freeresult($result);
-
+
+ // For remind we really need to redirect, else a refresh can result in more than one reminder
+ $u_action = $this->u_action . "&amp;$u_sort_param&amp;start=$start";
+ $u_action .= ($per_page != $config['topics_per_page']) ? "&amp;users_per_page=$per_page" : '';
+
+ redirect($u_action);
+
break;
}
}
- // Sorting
- $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
- $sort_by_text = array('i' => $user->lang['SORT_INACTIVE'], 'j' => $user->lang['SORT_REG_DATE'], 'l' => $user->lang['SORT_LAST_VISIT'], 'r' => $user->lang['SORT_REASON'], 'u' => $user->lang['SORT_USERNAME']);
- $sort_by_sql = array('i' => 'user_inactive_time', 'j' => 'user_regdate', 'l' => 'user_lastvisit', 'r' => 'user_inactive_reason', 'u' => 'username_clean');
-
- $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
- gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
-
// Define where and sort sql for use in displaying logs
$sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0;
$sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
@@ -227,19 +252,30 @@ class acp_inactive
$inactive = array();
$inactive_count = 0;
- $start = view_inactive_users($inactive, $inactive_count, $config['topics_per_page'], $start, $sql_where, $sql_sort);
+ $start = view_inactive_users($inactive, $inactive_count, $per_page, $start, $sql_where, $sql_sort);
foreach ($inactive as $row)
{
$template->assign_block_vars('inactive', array(
'INACTIVE_DATE' => $user->format_date($row['user_inactive_time']),
+ 'REMINDED_DATE' => $user->format_date($row['user_reminded_time']),
'JOINED' => $user->format_date($row['user_regdate']),
'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']),
+
'REASON' => $row['inactive_reason'],
'USER_ID' => $row['user_id'],
- 'USERNAME' => $row['username'],
- 'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&amp;mode=overview&amp;u={$row['user_id']}"))
- );
+ 'POSTS' => ($row['user_posts']) ? $row['user_posts'] : 0,
+ 'REMINDED' => $row['user_reminded'],
+
+ 'REMINDED_EXPLAIN' => $user->lang('USER_LAST_REMINDED', (int) $row['user_reminded'], $user->format_date($row['user_reminded_time'])),
+
+ 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], false, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&amp;mode=overview')),
+ 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
+ 'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
+
+ 'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&amp;mode=overview&amp;u={$row['user_id']}"),
+ 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id={$row['user_id']}&amp;sr=posts") : '',
+ ));
}
$option_ary = array('activate' => 'ACTIVATE', 'delete' => 'DELETE');
@@ -255,9 +291,10 @@ class acp_inactive
'S_LIMIT_DAYS' => $s_limit_days,
'S_SORT_KEY' => $s_sort_key,
'S_SORT_DIR' => $s_sort_dir,
- 'S_ON_PAGE' => on_page($inactive_count, $config['topics_per_page'], $start),
- 'PAGINATION' => generate_pagination($this->u_action . "&amp;$u_sort_param", $inactive_count, $config['topics_per_page'], $start, true),
-
+ 'S_ON_PAGE' => on_page($inactive_count, $per_page, $start),
+ 'PAGINATION' => generate_pagination($this->u_action . "&amp;$u_sort_param&amp;users_per_page=$per_page", $inactive_count, $per_page, $start, true),
+ 'USERS_PER_PAGE' => $per_page,
+
'U_ACTION' => $this->u_action . '&amp;start=' . $start,
));
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 457fac2458..aeb378953d 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2375,7 +2375,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
FROM " . LOG_TABLE . " l, " . USERS_TABLE . " u
WHERE l.log_type = $log_type
AND u.user_id = l.user_id
- " . (($limit_days) ? "AND l.log_time >= $limit_days" : '') .
+ " . (($limit_days) ? "AND l.log_time >= $limit_days" : '') .
(!empty($log_operation) ? "AND l.log_operation = '" . $db->sql_escape($log_operation) . "'" : '') . "
$sql_forum
ORDER BY $sort_by";
@@ -2685,7 +2685,7 @@ function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $li
$offset = ($offset - $limit < 0) ? 0 : $offset - $limit;
}
- $sql = 'SELECT user_id, username, user_regdate, user_lastvisit, user_inactive_time, user_inactive_reason
+ $sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE user_type = ' . USER_INACTIVE .
(($limit_days) ? " AND user_inactive_time >= $limit_days" : '') . "
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index c055449d5f..6d596a8a00 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -11,7 +11,7 @@
$updates_to_version = '3.0.6-dev';
// Enter any version to update from to test updates. The version within the db will not be updated.
-$debug_from_version = false;
+$debug_from_version = '3.0.5';
// Which oldest version does this updater supports?
$oldest_from_version = '3.0.0';
@@ -696,7 +696,9 @@ function database_update_info()
'attempts' => array('UINT', 0),
),
USERS_TABLE => array(
- 'user_new' => array('BOOL', 1),
+ 'user_new' => array('BOOL', 1),
+ 'user_reminded' => array('TINT:4', 0),
+ 'user_reminded_time'=> array('TIMESTAMP', 0),
),
GROUPS_TABLE => array(
'group_skip_auth' => array('BOOL', 0, 'after' => 'group_founder_manage'),
@@ -714,7 +716,7 @@ function database_update_info()
),
REPORTS_TABLE => array(
'post_id' => array('post_id'),
- 'pm_id' => array('pm_id'),
+ 'pm_id' => array('pm_id'),
),
),
),
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index 85380b2fd2..ca31dc90f8 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -399,6 +399,8 @@ $lang = array_merge($lang, array(
'SORT_LAST_VISIT' => 'Last visit',
'SORT_REASON' => 'Reason',
'SORT_REG_DATE' => 'Registration date',
+ 'SORT_LAST_REMINDER'=> 'Last reminded',
+ 'SORT_REMINDER' => 'Reminder sent',
'USER_IS_INACTIVE' => 'User is inactive',
));
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index a2b8eafd52..b97445f186 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -541,6 +541,7 @@ $lang = array_merge($lang, array(
'SORT_JOINED' => 'Joined date',
'SORT_LOCATION' => 'Location',
'SORT_RANK' => 'Rank',
+ 'SORT_POSTS' => 'Posts',
'SORT_TOPIC_TITLE' => 'Topic title',
'SORT_USERNAME' => 'Username',
'SPLIT_TOPIC' => 'Split topic',
diff --git a/phpBB/language/en/memberlist.php b/phpBB/language/en/memberlist.php
index b5b8434776..20f64044be 100644
--- a/phpBB/language/en/memberlist.php
+++ b/phpBB/language/en/memberlist.php
@@ -81,7 +81,7 @@ $lang = array_merge($lang, array(
'IM_MESSAGE' => 'Your message',
'IM_MSNM' => 'Please note that you need Windows Messenger installed to use this.',
'IM_MSNM_BROWSER' => 'Your browser does not support this.',
- 'IM_MSNM_CONNECT' => 'MSNM is not connected.\nYou have to connect to MSNM to continue.',
+ 'IM_MSNM_CONNECT' => 'MSNM is not connected.\nYou have to connect to MSNM to continue.',
'IM_NAME' => 'Your Name',
'IM_NO_DATA' => 'There is no suitable contact information for this user.',
'IM_NO_JABBER' => 'Sorry, direct messaging of Jabber users is not supported on this board. You will need a Jabber client installed on your system to contact the recipient above.',
@@ -90,7 +90,7 @@ $lang = array_merge($lang, array(
'IM_SEND_MESSAGE' => 'Send message',
'IM_SENT_JABBER' => 'Your message to %1$s has been sent successfully.',
'IM_USER' => 'Send an instant message',
-
+
'LAST_ACTIVE' => 'Last active',
'LESS_THAN' => 'Less than',
'LIST_USER' => '1 user',
@@ -134,6 +134,10 @@ $lang = array_merge($lang, array(
'USER_ADMIN' => 'Administrate user',
'USER_BAN' => 'Banning',
'USER_FORUM' => 'User statistics',
+ 'USER_LAST_REMINDED' => array(
+ 0 => 'No reminder sent yet',
+ 1 => '%1$d reminder sent<br />&raquo; %2$s',
+ ),
'USER_ONLINE' => 'Online',
'USER_PRESENCE' => 'Board presence',