Changeset 832779
- Timestamp:
- 01/04/2014 12:14:07 PM (12 years ago)
- Location:
- wp-favorite-posts/trunk
- Files:
-
- 4 edited
-
readme.txt (modified) (2 diffs)
-
wp-favorite-posts.php (modified) (7 diffs)
-
wpfp-admin.php (modified) (1 diff)
-
wpfp-page-template.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-favorite-posts/trunk/readme.txt
r832534 r832779 6 6 Requires at least: 3.5 7 7 Tested up to: 3.8 8 Stable tag: 1.5.9 8 Stable tag: 1.5.9.1 9 9 10 10 Allows visitors to add favorite posts. This plugin use cookies for saving data so … … 53 53 == Changelog == 54 54 55 = 1.5.9.1 (2014-01-04) = 56 * fix php warnings 57 * do wpfp actions on wp_loaded instead of template_redirect 58 55 59 = 1.5.9 (2014-01-03) = 56 60 * Version bump -
wp-favorite-posts/trunk/wp-favorite-posts.php
r832534 r832779 4 4 Plugin URI: http://nxsn.com/my-projects/wp-favorite-posts-plugin/ 5 5 Description: Allows users to add favorite posts. This plugin use cookies for saving data so unregistered users can favorite a post. Put <code><?php wpfp_link(); ?></code> where ever you want on a single post. Then create a page which includes that text : <code>[wp-favorite-posts]</code> That's it! 6 Version: 1.5.9 6 Version: 1.5.9.1 7 7 Author: Huseyin Berberoglu 8 8 Author URI: http://nxsn.com … … 32 32 define('WPFP_USER_OPTION_KEY', "wpfp_useroptions"); 33 33 define('WPFP_COOKIE_KEY', "wp-favorite-posts"); 34 35 // manage default privacy of users favorite post lists by adding this constant to wp-config.php 36 if ( !defined( 'WPFP_DEFAULT_PRIVACY_SETTING' ) ) 37 define( 'WPFP_DEFAULT_PRIVACY_SETTING', false ); 34 38 35 39 $ajax_mode = 1; … … 49 53 endif; 50 54 } 51 add_action(' template_redirect', 'wp_favorite_posts');55 add_action('wp_loaded', 'wp_favorite_posts'); 52 56 53 57 function wpfp_add_favorite($post_id = "") { … … 179 183 180 184 function wpfp_list_favorite_posts( $args = array() ) { 181 $user = $_REQUEST['user'];185 $user = isset($_REQUEST['user']) ? $_REQUEST['user'] : ""; 182 186 extract($args); 183 187 global $favorite_post_ids; 184 if ( !empty($user)):185 if ( !wpfp_is_user_favlist_public($user)):188 if ( !empty($user) ) { 189 if ( wpfp_is_user_favlist_public($user) ) 186 190 $favorite_post_ids = wpfp_get_users_favorites($user); 187 endif; 188 else:191 192 } else { 189 193 $favorite_post_ids = wpfp_get_users_favorites(); 190 endif;194 } 191 195 192 196 if ( @file_exists(TEMPLATEPATH.'/wpfp-page-template.php') || @file_exists(STYLESHEETPATH.'/wpfp-page-template.php') ): … … 347 351 348 352 function wpfp_update_user_meta($arr) { 349 return update_user meta(wpfp_get_user_id(),WPFP_META_KEY,$arr);353 return update_user_meta(wpfp_get_user_id(),WPFP_META_KEY,$arr); 350 354 } 351 355 … … 365 369 366 370 function wpfp_get_cookie() { 371 if (!isset($_COOKIE[WPFP_COOKIE_KEY])) return; 367 372 return $_COOKIE[WPFP_COOKIE_KEY]; 368 373 } … … 401 406 function wpfp_is_user_favlist_public($user) { 402 407 $user_opts = wpfp_get_user_options($user); 403 if ($user_opts['list_is_public']) 408 if (empty($user_opts)) return WPFP_DEFAULT_PRIVACY_SETTING; 409 if ($user_opts["is_wpfp_list_public"]) 404 410 return true; 405 411 else -
wp-favorite-posts/trunk/wpfp-admin.php
r832531 r832779 27 27 update_option('wpfp_options', $wpfp_options); 28 28 } 29 $message = ""; 29 30 if ( isset($_GET['action'] ) ) { 30 31 if ($_GET['action'] == 'reset-statics') { -
wp-favorite-posts/trunk/wpfp-page-template.php
r832531 r832779 1 1 <?php 2 $wpfp_before = ""; 2 3 echo "<div class='wpfp-span'>"; 3 if (!empty($user)) :4 if ( !wpfp_is_user_favlist_public($user)):5 echo"$user's Favorite Posts.";6 else:7 echo"$user's list is not public.";8 endif;9 endif;4 if (!empty($user)) { 5 if (wpfp_is_user_favlist_public($user)) { 6 $wpfp_before = "$user's Favorite Posts."; 7 } else { 8 $wpfp_before = "$user's list is not public."; 9 } 10 } 10 11 11 12 if ($wpfp_before): 12 echo "<p>".$wpfp_before."</p>";13 echo '<div class="wpfp-page-before">'.$wpfp_before.'</div>'; 13 14 endif; 14 15 … … 18 19 $post_per_page = wpfp_get_option("post_per_page"); 19 20 $page = intval(get_query_var('paged')); 20 query_posts(array('post__in' => $favorite_post_ids, 'posts_per_page'=> $post_per_page, 'orderby' => 'post__in', 'paged' => $page)); 21 22 $qry = array('post__in' => $favorite_post_ids, 'posts_per_page'=> $post_per_page, 'orderby' => 'post__in', 'paged' => $page); 23 // custom post type support can easily be added with a line of code like below. 24 // $qry['post_type'] = array('post','page'); 25 query_posts($qry); 26 21 27 while ( have_posts() ) : the_post(); 22 28 echo "<li><a href='".get_permalink()."' title='". get_the_title() ."'>" . get_the_title() . "</a> ";
Note: See TracChangeset
for help on using the changeset viewer.