Changeset 483668
- Timestamp:
- 01/02/2012 10:32:46 PM (14 years ago)
- File:
-
- 1 edited
-
advanced-post-privacy/trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
advanced-post-privacy/trunk/readme.txt
r483664 r483668 65 65 By default, Advanced Post Privacy (APP) has two types of exclusions, IP Address, and Role. It’s built in a mostly modular fashion, and is a configuration based plugin, meaning after adding your functionality, you need to explicitly tell the system about your new functionality, via the config.json file. 66 66 67 If you wanted to add a new type of exclusion, for example IP Address Range, you would have to do the following :67 If you wanted to add a new type of exclusion, for example IP Address Range, you would have to do the following - 68 68 * Create a new directory inside the code folder, naming doesn’t matter much here, it could be called “ip-range”. 69 69 * Create a file called exclusion.php, this will be a class which could be called “ipRangeExclusions”, this class must implement the “appExclusions” interface, and should (for posterity) extend the primary “advancedPostPrivacy” class. This will force the class to have 5 static methods, broken down as: … … 76 76 '_exclusion', $exclusionData['excluded_ip']);` 77 77 This will create a hook for when an exclusion of your type is created. This method should also ignore any entries that already exist, just for good practice. 78 79 78 * removeExclusion() - This takes two arguments, the exclusions unique identifier (in this case it would be the IP Range), and the post type slug (“post”, “page”, etc). This code should remove the exclusion, and create an identical hook to the one in setExclusion(), only with the term remove instead of add. 80 79 * getExcludedPostIds() - This is the function that makes your exclusion type work, you do whatever checking you would need to here, in this case it would be checking if the users IP address (constant “VIEWER_IP_ADDRESS”) falls within any of the ranges in the database. It should return an array of private post Ids, that can be obtained by using:
Note: See TracChangeset
for help on using the changeset viewer.