Plugin Template for v4

Discussion in 'aMember Pro v.4' started by luisk, Feb 22, 2012.

  1. luisk

    luisk New Member

    Joined:
    Feb 10, 2012
    Messages:
    4
    Hello,

    I just bought amember pro, I'm trying to create some custom php with mysql db access in the backend and using the admin panel for the front-end.

    Is there any documentation or a plugin template for v4?

    Thanks?
  2. CrackBaby

    CrackBaby Member

    Joined:
    Aug 22, 2006
    Messages:
    154
  3. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    here you go

    application/default/plugins/misc/test.php

    PHP:
    <?php
    class Am_Plugin_Test extends Am_Plugin
    {
        function 
    init()
        {
              
    $this->getDi()->db->selectRow("SELECT * FROM ?_user LIMIT 1"); // look at DbSimple docs
         
    }
        function 
    onInvoiceStarted(Am_Event $event// catches Am_Event::INVOICE_STARTED
        
    {
             
    $invoice $event->getInvoice(); // Invoice object
             
    $user $event->getUser(); // User object
        
    }
    }
  4. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
  5. customcodegeek

    customcodegeek Member

    Joined:
    Feb 10, 2012
    Messages:
    40
  6. luisk

    luisk New Member

    Joined:
    Feb 10, 2012
    Messages:
    4
    Thanks for the responses! I feel dumb for not looking at the api samples before posting, sorry about that.

    That's a really good manual, thanks customcodegeek!

Share This Page