Permalink
Browse files

Initial version (beta?)

Basic plugin, just a filter function and the function call to apply it.

Not extensively tested, and it might not actually be working properly.
  • Loading branch information...
dgw committed Sep 19, 2011
0 parents commit 86089bb66a7a8bff5b975471351b8dacdba6d3c7
Showing with 31 additions and 0 deletions.
  1. +31 −0 plugin.php
@@ -0,0 +1,31 @@
<?php
/*
Plugin Name: Don't Track Admins
Plugin URI: http://technobabbl.es/yourls/dont-track-admins/
Description: Short-circuits the yourls_update_clicks() function if the user requesting the link is logged in to YOURLS.
Version: 0.1
Author: dgw
Author URI: http://technobabbl.es/
*/
/* Short out click tracker for logged-in users
*
* @uses filter shunt_update_clicks
*
* We're going to hook into this filter and modify this value.
*/
yourls_add_filter( 'shunt_update_clicks', 'dgw_dont_track_admins' );
/* This says: when filter 'shunt_update_clicks' is triggered, send its value to function 'dgw_dont_track_admins'
* and use what this function will return.
*/
function dgw_dont_track_admins( $pre = false ) {
if( yourls_is_valid_user() === true ) { // If user is logged in to yourls...
$pre = true; // ...we want to short-circuit the click updater.
} else {
$pre = false; // Just in case
}
return $pre; // true (if user is logged in) or false (if not)
}

0 comments on commit 86089bb

Please sign in to comment.