strangerstudios / pmpro-addon-packages

Charge for access to specific pages or other post types in WordPress. Requires the Paid Memberships Pro plugin.
https://www.paidmembershipspro.com/add-ons/pmpro-purchase-access-to-a-single-page/
25 stars 29 forks source link

Checkout Confirmation not showing link to purchased post #1

Closed nocanvas closed 10 years ago

nocanvas commented 11 years ago

The section of the plugin that deals with showing purchased pages/posts does not seem to be working, both on the checkout page, and on the membership account page.

Is there a way to manually call this function somewhere else in my template, or does anyone else have this issue?

Also using stripe lite plugin, could the return url not get passed to that?

Code lines 386-420 of pmpro-addon-packages.php seem to be dealing with this, but do not work.

/*
Update the confirmation page to have a link to the purchased page.
*/
function pmproap_pmpro_confirmation_message($message)
{
    if(!empty($_REQUEST['ap']))
    {
        $ap = $_REQUEST['ap'];
        $ap_post = get_post($ap);

        $message .= "<p class=\"pmproap_confirmation\">Continue on to <a href=\"" . get_permalink($ap_post->ID) . "\">" . $ap_post->post_title . "</a>.</p>";
    }
    return $message;
}
add_filter("pmpro_confirmation_message", "pmproap_pmpro_confirmation_message");    
/*
    Show purchased posts on the account page
*/
function pmproap_pmpro_member_links_top()
{
    global $current_user;
    $post_ids = get_user_meta($current_user->ID, "_pmproap_posts", true);
    if(is_array($post_ids))
    {
        foreach($post_ids as $post_id)
        {
            $apost = get_post($post_id);
        ?>
            <li><a href="<?php echo get_permalink($post_id); ?>"><?php echo $apost->post_title; ?></a></li>
        <?php
        }
    }
}
add_action("pmpro_member_links_top", "pmproap_pmpro_member_links_top");
strangerstudios commented 10 years ago

I think we have this working now. Closing this. Please open again siting the current version if there are still issues.