Plugin Directory

Changeset 512964


Ignore:
Timestamp:
03/01/2012 02:36:51 PM (14 years ago)
Author:
maxemil
Message:
 
Location:
secret-content
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • secret-content/trunk/readme.txt

    r512773 r512964  
    6262
    63630.9
     64* First release in English only.
    6465
    65 * First release
     661.0
     67* In english, with Danish translation
    6668
     69
     70== Upgrade Notice ==
     71
     72= 1.0 =
     73From initial 0.9 to 1.0 - Only added translation to da_DK - this is a worry free upgrade!
  • secret-content/trunk/secret-content.php

    r512773 r512964  
    55Description: Adds metabox to posts/pages - Tick the checkbox to hide content from non logged in visitors.
    66Author: Emil Vang Arffmann
    7 Version: 0.9
     7Version: 1.0
    88Author URI: http://oneconsult.dk
    99*/
    1010
    11 // 0.9 initial release - mainly before "Generate POT file" from WP repository
    12 // ... and allowing room for comments / improvements
     11// 1.0 - In english, with Danish translation
    1312
    1413//  TODO and considerations:
    15 //  add localization .pot .mo file for others to translate - awaiting first WP repo submit / "Generate POT file"
    1614//  add overview/list of all secrified posts/pages, quick change to non secret
    1715//  add icon on post/page admin overview to indicate its for logged in members only.
     
    240238
    241239
    242 // modify content, if the post is being called directly..
    243 // fixed the_posts removes the need for this?!?
    244 // add_action('wp', 'secret_tinker_direct');
    245 // optionally, fill post_content with "You need to be logged in to see this content"
    246 
    247 function secret_tinker_direct()
    248 {
    249   if ( !is_admin() )
    250   {
    251     if ( !is_user_logged_in() ) // if NOT logged in :)
    252     {
    253       global $wp_query;
    254       global $wpdb;
    255       $secrefied = $wpdb->get_col("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_secret_new_field' AND meta_value = 'on' ");
    256 
    257       // someone is trying to watch a post they shouldent -> redirect to frontpage
    258       if ( is_singular() && in_array( $wp_query->query['p'], $secrefied ) )
    259       {
    260         wp_redirect( get_bloginfo('wpurl') ); exit;
    261       }
    262 
    263       if ( is_singular() && in_array( $wp_query->query['page_id'], $secrefied ) )
    264       {
    265         wp_redirect( get_bloginfo('wpurl') ); exit;
    266       }
    267     }
    268   }
    269 }
    270 
    271 
    272 
    273240/* links -----------------------------------------------------------------------
    274241
     
    299266   fun with wp repository
    300267   http://wpdevel.wordpress.com/2011/12/21/been-giving-a-lot-of-thought-to-how/
    301    http://www.turbosquid.com/3d-models/3d-cartoon-sub/512326
    302      
     268   http://wp.smashingmagazine.com/2011/11/23/improve-wordpress-plugins-readme-txt/
     269
    303270*/
    304271?>
Note: See TracChangeset for help on using the changeset viewer.