• Hi,

    I would like to insert a tab and have the subscriber profile details displayed.

    How can I output this?

    SO far, I created a function to get the get subscription link and I can see the URL
    [code]
    function wysija_get_subscriptions_edit_link(){
    // wysija classes ar enot loaded so we can't use that function
    if (!class_exists('WYSIJA')){
    return;
    }

    // let's get the current WordPress user ID
    $model_user = WYSIJA::get('user','model',false,'wysija-newsletters',false);
    $model_user ->getFormat=OBJECT;
    $wpuser_id = WYSIJA::wp_get_userdata('ID');

    // there is no logged in WordPress user
    if (empty($wpuser_id)){
    return;
    }

    // let's try to get the corresponding Wysija's subscriber to that WordPress' user ID
    $user_object = $model_user ->getOne(false,array('wpuser_id'=>$wpuser_id));
    if (empty($user_object)){
    return;
    }

    // we return the subscription link for that user
    return $model_user ->getConfirmLink($user_object,'subscriptions',false,true);

    }

    add_shortcode( 'mailpoet_subscription_link', 'wysija_get_subscriptions_edit_link' );
    [/code]
    I then Created a new endpoint
    [code]
    // create a custom end point in the My Accunt Page

    function custom_wc_end_point() {
    if(class_exists('WooCommerce')){
    add_rewrite_endpoint( 'help', EP_ROOT | EP_PAGES );
    }
    }
    add_action( 'init', 'custom_wc_end_point' );
    function custom_endpoint_query_vars( $vars ) {
    $vars[] = 'help';
    return $vars;
    }
    add_filter( 'query_vars', 'custom_endpoint_query_vars', 0 );

    function ac_custom_flush_rewrite_rules() {
    flush_rewrite_rules();
    }
    add_action( 'after_switch_theme', 'ac_custom_flush_rewrite_rules' );

    // add the custom endpoint in the my account nav items
    function custom_endpoint_acct_menu_item( $items ) {

    $logout = $items['customer-logout'];
    unset( $items['customer-logout'] );
    $items['help'] = __( 'Get Help', 'woocommerce' ); // replace videos with your endpoint name
    $items['customer-logout'] = $logout;
    return $items;
    }
    add_filter( 'woocommerce_account_menu_items', 'custom_endpoint_acct_menu_item' );

    // fetch content from your source page (in this case video page)
    function fetch_content_custom_endpoint() {
    //$fred = wysija_get_subscriptions_edit_link();
    include 'woocommerce/myaccount/fred.php';

    }
    add_action( 'woocommerce_account_help_endpoint', 'fetch_content_custom_endpoint' );
    */
    [/code]
    This is where I struggle to get the ‘Get Help’ string to load the mailpoet url

    Could anybody help please?

Viewing 1 replies (of 1 total)
  • Hi,

    The shortcode [wysija_page] will grab some URL variables and render the page properly.
    Unfortunately we don’t support this feature yet.

Viewing 1 replies (of 1 total)
  • The topic ‘how to insert mailpoet to woocommerce account tab’ is closed to new replies.