1
0

event_karma: New option to disable visit tracking for logged in users.

This commit is contained in:
Grischa Brockhaus
2007-10-28 13:11:16 +00:00
parent 2122e36aeb
commit c7f792ef96
5 changed files with 40 additions and 5 deletions

View File

@ -0,0 +1,9 @@
# $Id: ChangeLog,v 1.27 2007/10/25 13:56:39 brockhaus Exp $
------------------------------------------------------------------------
Version 1.4 (brockhaus):
* New option to disable visit tracking for logged in users.
------------------------------------------------------------------------
Version 1.3 (garvinhickins):

View File

@ -41,3 +41,6 @@
@define('PLUGIN_KARMA_STATISTICS_VISITS_NO', 'Besuche');
@define('PLUGIN_KARMA_STATISTICS_VOTES_NO', 'Stimmen');
@define('PLUGIN_KARMA_STATISTICS_POINTS_NO', 'Punkte');
@define('PLUGIN_KARMA_VISITS_LOGGEDIN_USERS', 'Aufrufstatistik auch für eingeloggte Benutzer?');
@define('PLUGIN_KARMA_VISITS_LOGGEDIN_USERS_BLAHBLAH', 'Wenn diese Option eingeschaltet ist, dann werden auch die Besuche von eingeloggten Benutzern protokolliert.');

View File

@ -41,3 +41,7 @@
@define('PLUGIN_KARMA_STATISTICS_VISITS_NO', 'Besuche');
@define('PLUGIN_KARMA_STATISTICS_VOTES_NO', 'Stimmen');
@define('PLUGIN_KARMA_STATISTICS_POINTS_NO', 'Punkte');
@define('PLUGIN_KARMA_VISITS_LOGGEDIN_USERS', 'Aufrufstatistik auch f<>r eingeloggte Benutzer?');
@define('PLUGIN_KARMA_VISITS_LOGGEDIN_USERS_BLAHBLAH', 'Wenn diese Option eingeschaltet ist, dann werden auch die Besuche von eingeloggten Benutzern protokolliert.');

View File

@ -48,4 +48,6 @@
@define('PLUGIN_KARMA_STATISTICS_POINTS_NO', 'points');
@define('PLUGIN_KARMA_STARRATING', 'Enable individual rating on this entry?');
?>
@define('PLUGIN_KARMA_VISITS_LOGGEDIN_USERS', 'Track visits of logged in users?');
@define('PLUGIN_KARMA_VISITS_LOGGEDIN_USERS_BLAHBLAH', 'If this option is enabled, page visits of users who are logged in are tracked, too.');

View File

@ -13,7 +13,7 @@ if (file_exists($probelang)) {
include dirname(__FILE__) . '/lang_en.inc.php';
@define('PLUGIN_KARMA_VERSION', '1.3');
@define('PLUGIN_KARMA_VERSION', '1.4');
class serendipity_event_karma extends serendipity_event
{
@ -30,7 +30,7 @@ class serendipity_event_karma extends serendipity_event
$propbag->add('name', PLUGIN_KARMA_NAME);
$propbag->add('description', PLUGIN_KARMA_BLAHBLAH);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking');
$propbag->add('author', 'Garvin Hicking','Grischa Brockhaus');
$propbag->add('version', '1.9');
$propbag->add('requirements', array(
'serendipity' => '0.8',
@ -39,7 +39,7 @@ class serendipity_event_karma extends serendipity_event
));
$propbag->add('event_hooks', array('frontend_configure' => true, 'entry_display' => true, 'css' => true, 'event_additional_statistics' => true));
$propbag->add('groups', array('STATISTICS'));
$propbag->add('configuration', array('karma_active', 'visits_active', 'exits_active', 'max_entrytime', 'max_votetime', 'extended_only', 'max_karmatime', 'logging'));
$propbag->add('configuration', array('karma_active', 'visits_active', 'track_visits_of_loggedin_users', 'exits_active', 'max_entrytime', 'max_votetime', 'extended_only', 'max_karmatime', 'logging'));
}
function introspect_config_item($name, &$propbag)
@ -80,6 +80,13 @@ class serendipity_event_karma extends serendipity_event
$propbag->add('default', 'true');
break;
case 'track_visits_of_loggedin_users':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_KARMA_VISITS_LOGGEDIN_USERS);
$propbag->add('description', PLUGIN_KARMA_VISITS_LOGGEDIN_USERS_BLAHBLAH);
$propbag->add('default', 'true');
break;
case 'exits_active':
$propbag->add('type', 'boolean');
$propbag->add('name', SHOWS_TOP_EXIT);
@ -232,7 +239,7 @@ class serendipity_event_karma extends serendipity_event
}
if ($entryid && empty($serendipity['GET']['adminAction'])) {
$track_clicks = serendipity_db_bool($this->get_config('visits_active', true));
$track_clicks = serendipity_db_bool($this->get_config('visits_active', true)) && $this->track_clicks_allowed_by_user();
if ($track_clicks) {
$sql = serendipity_db_query('UPDATE ' . $serendipity['dbPrefix'] . 'karma SET visits = visits + 1 WHERE entryid = ' . $entryid, true);
if (serendipity_db_affected_rows() < 1) {
@ -615,6 +622,16 @@ class serendipity_event_karma extends serendipity_event
return false;
}
}
/**
* Check, if visit counting for the actual visitor should be done.
*/
function track_clicks_allowed_by_user(){
if (!$this->get_config('track_visits_of_loggedin_users',true) && serendipity_userLoggedIn()){
return false;
}
return true;
}
}
/* vim: set sts=4 ts=4 expandtab : */