function saveRealTime() { global $wpdb; $realtime_tbl_name = $wpdb->prefix . 'realtime_medit'; ob_clean(); $wish_id = $_POST['postid']; $wisher_id = get_current_user_id(); $realpeople = get_real_meditators($wish_id); if (!is_current_medit($wish_id, $wisher_id)) { $wpdb->insert($realtime_tbl_name, array('intention_id' => $wish_id, 'meditater_id' => $wisher_id), array('%s', '%s')); $realpeople++; } /* See Who's meditating right now */ if ($realpeople > 0) { $realbutton = '<button id="my-first" onclick="openPopup1();">see who</button> <div id="first_to_pop_up"> <div class="close"></div> <div class="avatar-block">'; $meditIDs = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT(meditater_id) FROM {$realtime_tbl_name} WHERE intention_id = {$wish_id}")); foreach ($meditIDs as $userID) { $realbutton .= '<div class="item-avatar"> <a href="' . bp_core_get_user_domain($userID) . '" title="' . bp_core_get_user_displayname($userID) . '"> ' . bp_core_fetch_avatar(array('item_id' => $userID)) . ' ' . bp_core_get_user_displayname($userID) . '</a> </div>'; } $realbutton .= '</div></div>'; } else { $realbutton = ''; } ob_end_clean(); echo $realpeople . ' ' . $realbutton; die(1); }
?> class="two_column_left"<?php } ?> > <div class="padder"> <div class="page" id="blog-latest"> <?php if (have_posts()) { while (have_posts()) { the_post(); ?> <?php $real_star = get_real_meditators(get_the_ID()); $black_star = get_total_meditators(get_the_ID()); $green_star = get_total_seconds(get_the_ID()); $convert = secns_to_human($green_star); ?> <div class="post" id="post-<?php the_ID(); ?> "> <span class="for_wishes"> <span class="real_star"><?php echo $real_star; ?> people</span>
function widget($args, $instance) { $cache = wp_cache_get('widget_recent_intentions', 'widget'); if (!is_array($cache)) { $cache = array(); } if (!isset($args['widget_id'])) { $args['widget_id'] = $this->id; } if (isset($cache[$args['widget_id']])) { echo $cache[$args['widget_id']]; return; } ob_start(); extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Intentions') : $instance['title'], $instance, $this->id_base); if (empty($instance['number']) || !($number = absint($instance['number']))) { $number = 10; } echo $before_widget; wp_enqueue_script("sortintention", get_template_directory_uri() . '/_inc/js/sortintention.js'); wp_localize_script("sortintention", 'Recentobj', array('ajax_url' => admin_url())); ?> <?php if ($title) { echo $before_title . $title . $after_title; } ?> <form action="" method="post"> <div class="intention-sort-tabs"> <ul> <li id="intentions-orderby" class="last filter"> <label for="intentions-orderby"><?php _e('Order By:', 'buddypress'); ?> </label> <select id="intentions-orderby-select"> <option value="newest" selected>Newest Intentions</option> <option value="current">Current Mediators</option> <option value="past">Total Mediators</option> <option value="time">Total Collective Meditation Time</option> </select> </li> </ul> </div> </form> <div id="intentions-list"> <?php $r = new WP_Query(apply_filters('widget_posts_args', array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true))); if ($r->have_posts()) { ?> <ul class="wish_list"> <?php while ($r->have_posts()) { $r->the_post(); ?> <?php $real_star = get_real_meditators(get_the_ID()); $black_star = get_total_meditators(get_the_ID()); $green_star = get_total_seconds(get_the_ID()); $convert = secns_to_human($green_star); ?> <li> <span class="for_wishes"> <span class="real_star"><?php echo $real_star; ?> people</span> <span class="black_star"><?php echo $black_star; ?> people</span> <span class="green_star"><?php echo $convert; ?> </span> </span> <div class="wishes_info"> <a href="<?php the_permalink(); ?> " title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?> "><?php if (get_the_title()) { the_title(); } else { the_ID(); } ?> </a> <span><?php printf(__('set by %s', 'buddypress'), get_the_author_meta('display_name')); ?> </span> </div> </li> <?php } ?> </ul> <div class="stars_footer"> <ul> <li id="or2">Total people currently meditating</li> <li id="wh2" > Total people meditated</li> <li id="red2"> Total collective meditation time</li> </ul> </div> <?php // Reset the global $the_post as this query will have stomped on it wp_reset_postdata(); } ?> </div> <?php echo $after_widget; ?> <?php $cache[$args['widget_id']] = ob_get_flush(); wp_cache_set('widget_recent_intentions', $cache, 'widget'); }