_e('Date Created', 'mgm'); ?> </b> </div> <div class="cell theadDivCell width25 textalignleft"> <b><?php _e('Action', 'mgm'); ?> </b> </div> </div> <?php if ($data['postpacks']) { foreach ($data['postpacks'] as $i => $postpack) { // count $posts_count = mgm_get_postpack_posts($postpack->id, true); $sformat = mgm_get_date_format('date_format_short'); ?> <div class="row <?php echo $alt = $alt == '' ? 'alternate' : ''; ?> brBottom" id="postpack_row_<?php echo $postpack->id; ?> "> <div class="cell width5 textalignleft"> <?php echo $postpack->id; ?>
/** * parse and output postpack buy button * * @since 2.0 * * @param int $postpack_id * @return string $html */ function mgm_parse_postpack_template($postpack_id) { global $post; // logged in if (is_user_logged_in()) { // return return mgm_get_postpack_template($postpack_id); } // guest token - issue #1396 if (isset($_GET['guest_token'])) { $pack_purchased = false; // list of posts if ($postpack_posts = mgm_get_postpack_posts($postpack_id)) { // init string $post_string = '<ul>'; // loop foreach ($postpack_posts as $i => $pack_post) { // check if user has purchased $access = mgm_user_has_purchased_post($pack_post->post_id, NULL, strip_tags($_GET['guest_token'])); // set if ($access) { // get post $post = get_post($pack_post->post_id); $post_url = get_permalink($post->ID) . '?guest_token=' . strip_tags($_GET['guest_token']); // append $post_string .= sprintf('<li><a href="%s">%s</a></li>', $post_url, $post->post_title); $pack_purchased = true; } } // end $post_string .= '</ul>'; } if ($pack_purchased) { return $post_string; } } // show links // login url $login_url = $post->ID > 0 ? mgm_get_custom_url('login', false, array('redirect_to' => get_permalink($post->ID))) : ''; // template $template = mgm_get_template('private_text_template', array(), 'templates'); // message $message = mgm_get_template('private_text_purchasable_pack_login', array(), 'messages'); //issue #863 $message = str_replace('[purchase_options]', '', $message); $message = __($message, 'mgm'); $message .= '[purchase_options]'; // message - issue #1396 $message = mgm_get_content_purchase_options($message, $login_url, $post->ID, $postpack_id); // message $message = str_replace('[message]', $message, $template); // return return sprintf('<div class="mgm_private_no_access">%s</div>', $message); }
/** * get postpack post in csv string * */ function mgm_get_postpack_posts_csv($pack_id) { $array = array(); if ($posts = mgm_get_postpack_posts($pack_id)) { foreach ($posts as $i => $post) { $array[] = $post->post_id; } } // implode return implode(',', $array); }