Hi everybody I read and used the following customization instructions: https://www.amember.com/docs/How_to_add_custom_page_in_member_area Instead of having a constant content, I want to load the Access Logs of the user from DB and show them in my new tab. Are there anybody to show me the right way?
In your controlled you can use this code to get access logs for user: PHP: $logs = Am_Di::getInstance()->db->selectPage($total, "select * from ?_access_log where user_id =?", Am_Di::getInstance()->auth->getUserId());foreach($logs as $record){// create table with records. }
Thank you alexander for your reply. But where to place this code?? When I add for example PHP: $logs['time']; in front of PHP: $this->view->content= the page doesn't load. Thanks for your attention.
Hi alexander I use the following code: PHP: <?phpAm_Di::getInstance()->hook->add(Am_Event::USER_MENU, 'myAddMenuItem');//$logs = Am_Di::getInstance()->db->selectPage($total, "select * from ?_access_log where user_id =?", Am_Di::getInstance()->auth->getUserId());function myAddMenuItem(Am_Event $event){ $menu = $event->getMenu(); $menu->addPage( array( 'id' => 'usage-history', 'controller' => 'my-page', 'module' => 'default', 'label' => "Usage History", 'order' => 500, 'uri' => 'usage-history', ));}class MyPageController extends Am_Controller // a Zend_Controller_Action successor{ function indexAction() { $user = $this->getDi()->user; //currently authenticated customer or throws exception if no auth $this->view->title = "Usage History"; $this->view->content = "contens"; $this->view->display('layout.phtml'); }}$am = Am_Di::getInstance();$am->blocks->add(new Am_Block('member/usage-history/left', 'Block Title', '13123', null, 'usage-history.phtml', 9999)); But this code only add the tab "Usage-History" and title "Usage History" and content "contents". I also want to change "my-page" in controller to "usage-history" because this appears in URL. I think I must use .phtml files in folder /application/default/views/member, But I have no idea about the contents of that file. Thanks for your help
You can change my-page to usage-history. Also you need to rename controller MyPageController to UsageHistoryController in this case. Controller show content that you supplied eg. "contens". You can put anything here. Please check code of existing controllers to get idea how it works. To display tables I recommend to use aMember grids http://www.amember.com/docs/API/Grid