• Resolved Philippe Roussel

    (@ph59)


    Hi,

    How can I add “Cancel” next to the other links on the Membership account page? Contrary to what the image shows (link), I would like to see a separator and “Cancel” pointing to the Cancel page next to “Log Out.”

    Thanks for your help,

    Philippe

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Jarryd Long

    (@jarryd-long)

    Hi Philippe, thank you for reaching out to Paid Memberships Pro.

    We have an example code recipe here (https://gist.github.com/ipokkel/178d7fde684666b6462235cac21f32ad#file-my-pmpro-account-profile-action-links-php) that you can use to add links to that section of the links on the page.

    Please give this a try and let me know if it helps.

    Kind Regards,
    Jarryd
    Support Manager at Paid Memberships Pro

    Thread Starter Philippe Roussel

    (@ph59)

    Hi Jarryd,

    I have added the following line to the code you gave in reference, save the whole thing in Code Snippets, emptied the CDN and website’s caches, created a fake user. No change. I guess this was not what I had to do. Which instructions should I follow?

    Here the code I added:

    if ( ! empty( $my_cancel_url ) ) {
    $pmpro_profile_action_links[‘cancel’] = sprintf( ‘%s‘, esc_url( $my_cancel_url ), esc_html__( ‘Cancel’, ‘paid-memberships-pro’ ) );
    }

    Plugin Support Jarryd Long

    (@jarryd-long)

    You would need to include the full recipe in your code snippets – you can remove lines 13 – 30 and just include the following line (be sure to replace the curly quotes when copying it from below) which will add the cancel URL to that row of links.

    $pmpro_profile_action_links['cancel'] = sprintf( ‘%s‘, esc_url( $my_cancel_url ), esc_html__( ‘Cancel’, ‘paid-memberships-pro’ ) );

    Kind Regards,
    Jarryd
    Support Manager at Paid Memberships Pro

    Thread Starter Philippe Roussel

    (@ph59)

    Hi Jarryd,

    Like this?

    function my_pmpro_account_profile_action_links( $pmpro_profile_action_links ) {

    $pmpro_profile_action_links[cancel] = sprintf( %s, esc_url( $my_cancel_url ), esc_html__( Cancel, paid-memberships-pro ) );

    return $pmpro_profile_action_links;

    }
    add_filter( pmpro_account_profile_action_links, my_pmpro_account_profile_action_links );

    Thread Starter Philippe Roussel

    (@ph59)

    It appears that the properly written code would be the following, but it does not change anything. Still no Cancel link on the Account page.

    function my_pmpro_account_profile_action_links( $pmpro_profile_action_links ) {

    $pmpro_profile_action_links[cancel] = sprintf( esc_url( $my_cancel_url ), esc_html__( Cancel, paid-memberships-pro ) );

    return $pmpro_profile_action_links;

    }
    add_filter( pmpro_account_profile_action_links, my_pmpro_account_profile_action_links );
    if ( ! empty( $my_cancel_url ) ) {
    $pmpro_profile_action_links[‘cancel’] = sprintf( ‘%s‘, esc_url( $my_cancel_url ), esc_html__( ‘Cancel’, ‘paid-memberships-pro’ ) );
    }

    return $pmpro_profile_action_links;

    add_filter( ‘pmpro_account_profile_action_links’, ‘my_pmpro_account_profile_action_links’ );

    Plugin Support Jarryd Long

    (@jarryd-long)

    I’ve adjusted this for you. You will need to change the THE_CANCEL_URL_YOU_USED_IN_YOUR_ORIGINAL_LINK wording in the link below to the cancel URL you are using in the current link you have.

    function my_pmpro_account_profile_action_links( $pmpro_profile_action_links ) {
    	
    	$pmpro_profile_action_links['cancel'] = sprintf( '<a id="pmpro_actionlink-cancel" href="%s">%s</a>', esc_url( 'THE_CANCEL_URL_YOU_USED_IN_YOUR_ORIGINAL_LINK' ), esc_html__( 'Cancel', 'paid-memberships-pro' ) );
    	
    	return $pmpro_profile_action_links;
    	
    }
    add_filter( 'pmpro_account_profile_action_links', 'my_pmpro_account_profile_action_links' );

    Thread Starter Philippe Roussel

    (@ph59)

    Hi Jarryd,

    The link is there now, but instead of pointing to the Cancel page another one appears that says: “This site can’t be reached. cancel’s DNS address could not be found. Diagnosing the problem.”

    Thread Starter Philippe Roussel

    (@ph59)

    Hi Jarryd,

    The Memberships widget contains the Cancel link. I settled for that.

    Plugin Support Jarryd Long

    (@jarryd-long)

    Thanks for your feedback, Philippe. Feel free to reach out if there’s anything else we can assist with.

    Kind Regards,
    Jarryd
    Support Manager at Paid Memberships Pro

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Adding a link to Membership Account page’ is closed to new replies.