Skip to content

Add / remove html blocks in member s area

There is free Widget plugin that allow you to add new widgets from aMember admin interface: https://www.amember.com/amember/product/widget

After plugin installation you can add new widgets at: aMember CP -> Protect Content -> Widgets

Also you can add new widgets from code/plugins.
Add this code to site.php file:

//add new block at target/position member/main/left
Am_Di::getInstance()->blocks->add('member/main/left', new Am_Block_Base('', 'my-block-id', null, function (Am_View $v) {
return <<<CUT
<p>You can put some html code here</p>
CUT;
}));
//Remove Active Subscriptions block
Am_Di::getInstance()->blocks->remove('member-main-subscriptions');
//Remove Active Resources block
Am_Di::getInstance()->blocks->remove('member-main-resources');
//Remove Useful Links block
Am_Di::getInstance()->blocks->remove('member-main-links');
// Remove Newsletter Subscriptions block:
Am_Di::getInstance()->blocks->remove('member-main-newsletter');
//Remove Unsubscribe from all email messages block
Am_Di::getInstance()->blocks->remove('member-main-unsubscribe');
//Change order of Useful Links block
Am_Di::getInstance()->blocks->setOrder('member-main-links', Am_Blocks::BOTTOM);
//Change target/position of Useful Links block from right column to left
$_ = Am_Di::getInstance()->blocks->getBlock('member-main-links');
Am_Di::getInstance()->blocks->remove('member-main-links');
Am_Di::getInstance()->blocks->add('member/main/left', $_);
//Change target/position of Newsletter Subscriptions block from left column to right
$_ = Am_Di::getInstance()->blocks->getBlock('member-main-newsletter');
Am_Di::getInstance()->blocks->remove('member-main-newsletter');
Am_Di::getInstance()->blocks->add('member/main/right', $_);
  • member-main-subscriptions - Active Subscriptions
  • member-main-resources - Active Resources
  • member-main-unsubscribe - E-Mail Preferences (Unsubscribe block)
  • member-main-newsletter - Newsletter Subscriptions
  • member-main-links - Useful Links

List of available targets/positions on a dashboard:

Section titled “List of available targets/positions on a dashboard:”
  • member/main/top - Above Dashboard (No Envelope)
  • member/main/left/top - Above Left Column (No Envelope)
  • member/main/left - Left Column
  • member/main/left/bottom - Below Left Column (No Envelope)
  • member/main/right/top - Above Right Column (No Envelope)
  • member/main/right - Right Column
  • member/main/right/bottom - Below Right Column (No Envelope)
  • member/main/bottom - Below Dashboard (No Envelope)
  • Am_Block::TOP - 100
  • Am_Block::MIDDLE - 500
  • Am_Block::BOTTOM - 900

You can use any integer for block sort order.