function wpfp_users_favorites_widget_control() { $options = wpfp_get_options(); if (isset($_POST["wpfp-uf-widget-submit"])) { $options['uf_widget_title'] = strip_tags(stripslashes($_POST['wpfp-uf-title'])); $options['uf_widget_limit'] = strip_tags(stripslashes($_POST['wpfp-uf-limit'])); update_option("wpfp_options", $options); } $uf_title = $options['uf_widget_title']; $uf_limit = $options['uf_widget_limit']; ?> <p> <label for="wpfp-uf-title"> <?php _e('Title:'); ?> <input type="text" value="<?php echo $uf_title; ?> " class="widefat" id="wpfp-uf-title" name="wpfp-uf-title" /> </label> </p> <p> <label for="wpfp-uf-limit"> <?php _e('Number of posts to show:'); ?> <input type="text" value="<?php echo $uf_limit; ?> " style="width: 28px; text-align:center;" id="wpfp-uf-limit" name="wpfp-uf-limit" /> </label> </p> <input type="hidden" name="wpfp-uf-widget-submit" value="1" /> <?php }
function tm_playlist_template() { $current_bb_user = get_userdata(bp_displayed_user_id()); $favorite_post_ids = wpfp_get_users_favorites($current_bb_user->user_login); _e('<h3>My playlist</h3>', 'cactusthemes'); echo "<div class='playlist user-" . bp_displayed_user_id() . "'>"; if ($favorite_post_ids) { $favorite_post_ids = array_reverse($favorite_post_ids); $qry = array('post__in' => $favorite_post_ids, 'posts_per_page' => -1, 'orderby' => 'post__in', 'paged' => $page, 'ignore_sticky_posts' => true); // custom post type support can easily be added with a line of code like below. // $qry['post_type'] = array('post','page'); query_posts($qry); while (have_posts()) { the_post(); ?> <div id="post-<?php the_ID(); ?> " <?php post_class('video-item' . (has_post_thumbnail() ? '' : ' no-thumbnail')); ?> > <div class="item-thumbnail"> <?php if (has_post_thumbnail()) { $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'thumb_139x89', true); ?> <a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "> <img src="<?php echo $thumbnail[0]; ?> " alt="<?php the_title_attribute(); ?> " title="<?php the_title_attribute(); ?> "> <div class="link-overlay fa fa-play"></div> </a> <?php } ?> </div> <div class="item-head"> <h3><a href="<?php the_permalink(); ?> " rel="<?php the_ID(); ?> " title="<?php the_title_attribute(); ?> "><?php the_title(); ?> </a></h3> <div class="item-meta"> <?php echo tm_html_video_meta(false, false, false, true); ?> </div> </div> <?php if (bp_displayed_user_id() == get_current_user_id()) { wpfp_remove_favorite_link(get_the_ID()); } ?> <div class="clearfix"></div> </div> <?php } wp_reset_query(); } else { $wpfp_options = wpfp_get_options(); echo "<li>"; echo $wpfp_options['favorites_empty']; echo "</li>"; } echo "</div>"; if (bp_displayed_user_id() == get_current_user_id()) { echo wpfp_clear_list_link(); } }
function wpfp_get_option($opt) { $wpfp_options = wpfp_get_options(); return htmlspecialchars_decode(stripslashes($wpfp_options[$opt])); }
echo "<li><a href='" . get_permalink() . "' title='" . get_the_title() . "'>" . get_the_title() . "</a> "; wpfp_remove_favorite_link(get_the_ID()); echo "</li>"; } echo "</ul>"; echo '<div class="navigation">'; if (function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?> <div class="alignleft"><?php next_posts_link(__('← Previous Entries', 'buddypress')); ?> </div> <div class="alignright"><?php previous_posts_link(__('Next Entries →', 'buddypress')); ?> </div> <?php } echo '</div>'; wp_reset_query(); } else { $wpfp_options = wpfp_get_options(); echo "<ul><li>"; echo $wpfp_options['favorites_empty']; echo "</li></ul>"; } echo '<p>' . wpfp_clear_list_link() . '</p>'; echo "</div>"; wpfp_cookie_warning();
function wpfp_get_option($opt) { $wpfp_options = wpfp_get_options(); if ($opt == 'added') { $link = "<span class='label label-success'>" . htmlspecialchars_decode(stripslashes($wpfp_options[$opt])) . "</span>"; return $link; } elseif ($opt == 'removed') { $link = "<span class='label label-danger'>" . htmlspecialchars_decode(stripslashes($wpfp_options[$opt])) . "</span>"; return $link; } else { return htmlspecialchars_decode(stripslashes($wpfp_options[$opt])); } }