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(new Am_Block('member/main/left', 'My Block Title', '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', $_);
List of IDs for default blocks:
member-main-subscriptions
- Active Subscriptionsmember-main-resources
- Active Resourcesmember-main-unsubscribe
- E-Mail Preferences (Unsubscribe block)member-main-newsletter
- Newsletter Subscriptionsmember-main-links
- Useful Links
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 Columnmember/main/left/bottom
- Below Left Column (No Envelope)member/main/right/top
- Above Right Column (No Envelope)member/main/right
- Right Columnmember/main/right/bottom
- Below Right Column (No Envelope)member/main/bottom
- Below Dashboard (No Envelope)
List of predefined sort order:
Am_Block::TOP
- 100Am_Block::MIDDLE
- 500Am_Block::BOTTOM
- 900
You can use any integer for block sort order.