Show Expired Products

Discussion in 'Templates customization' started by bennyuk1, Nov 24, 2016.

Thread Status:
Not open for further replies.
  1. bennyuk1

    bennyuk1 aMember Pro Customer

    Joined:
    Jan 12, 2012
    Messages:
    200
    I've just upgraded from 4.2.14 to 5.1.7

    In v4 I used to have a block on the dashboard to list all expired products.

    Id there a way to add this back into v5 but in an upgrade proof way

    the v4 way was adding
    $this->view->assign('member_products_expired', $this->getDi()->user->getExpiredProducs());

    to MemberController.php (but obviously this wasnt upgrade proof)
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    You can do it with the following code within site.php file
    http://www.amember.com/docs/Site.php_file
    PHP:
    Am_Di::getInstance()->blocks->add(
            new 
    Am_Block(
                    
    'member/main/left',
                    
    'Expired Subscriptions',
                    
    'expired-sub',
                    
    null,
                    function (
    Am_View $v) {
                        
    $out = array();
                        foreach (
    Am_Di::getInstance()->user->getExpiredProducs() as $p) {
                            
    $out[] = sprintf('<li>%s</li>'Am_Html::escape($p->title));
                        }
                        return 
    sprintf('<ul class="am-widget-list">%s</ul>'implode("\n"$out));
                    }));
    Here is useful link regarding dashboard blocks in user interface:
    http://www.amember.com/docs/How_to_add/remove_html_blocks_in_member's_area
  3. ccwjames

    ccwjames Member

    Joined:
    Sep 11, 2014
    Messages:
    430
    how would i add this to under active and above
    Active Resources
  4. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    You can use last parameter in Am_Block constructor. It is priority of this block
    PHP:
    Am_Block($targets$title$idAm_Pluggable_Base $plugin null$pathOrCallback null$order self::MIDDLE)
    Do you mind to contact us in helpdesk? I will help you to do it.

    Best Regards.
  5. bennyuk1

    bennyuk1 aMember Pro Customer

    Joined:
    Jan 12, 2012
    Messages:
    200
    Thanks worked perfectly
  6. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    @bennyuk1 I am glad to hear that! You are welcome!
Thread Status:
Not open for further replies.

Share This Page