This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Am_Di::getInstance()->hook->add(Am_Event::GENERATE_LOGIN, function (Am_Event $e) { | |
$user = $e->getUser(); | |
if ($_ = preg_replace('/[^0-9a-zA-Z]/', '', "{$user->name_f}{$user->name_l}")) { | |
$i = 1; | |
$l = $_; | |
while (!$e->getDi()->userTable->checkUniqLogin($l)) { | |
$l = $_ . $i++; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('after_setup_theme', function() { | |
if (!current_user_can('administrator') && !is_admin()) { | |
show_admin_bar(false); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function(){ | |
var tolerance = 80; | |
var initialStep = 30; | |
var speed = 0.35; | |
var step = initialStep; | |
var w; | |
jQuery('.am-tabs-wrapper').css({ | |
overflow: 'hidden' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function _get_my_number($record) | |
{ | |
$prefix = $record instanceof InvoicePayment ? 'INV' : 'RFD'; | |
$year = date('Y', amstrtotime($record->dattm)); | |
$table = $record instanceof InvoicePayment ? '?_invoice_payment' : '?_invoice_refund'; | |
$num = Am_Di::getInstance()->db->selectCell(<<<CUT | |
SELECT COUNT(*) + 1 FROM {$table} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Allow to switch payment system on resume subscription | |
*/ | |
Am_Di::getInstance()->hook->add(Am_Event::INVOICE_BEFORE_PAYMENT, function(Am_Event $e) { | |
$invoice = $e->getInvoice(); | |
if ($invoice->data()->get(Invoice::ORIG_ID) && !$invoice->data()->get('skip-me')) { | |
$invoice->data()->set('skip-me', 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add new item to aMember CP -> Utilities -> Delete Old Records | |
*/ | |
Am_Di::getInstance()->hook->add(Am_Event::CLEAR_ITEMS, function(Am_Event $e) { | |
$di = $e->getDi(); | |
$e->addReturn([ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change access period based on purchased quantity | |
*/ | |
Am_Di::getInstance()->hook->add(Am_Event::ACCESS_BEFORE_INSERT, function(Am_Event $e) { | |
$access = $e->getAccess(); | |
if ($access->invoice_item_id && $access->expire_date != Am_Period::MAX_SQL_DATE) { | |
$item = $e->getDi()->invoiceItemTable->load($access->invoice_item_id); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Am_Di::getInstance()->hook->add(Am_Event::INVOICE_CALCULATE, function(Am_Event $e) { | |
if (@$GLOBALS['add_fraction']++) return; | |
$invoice = $e->getInvoice(); | |
$item = $invoice->getItem(0); | |
$id = $invoice->pk() ?: $e->getDi()->db->selectCell("SELECT MAX(invoice_id)+1 FROM ?_invoice;"); | |
if ($item && $item->first_price > 0 && !$item->data()->get('add_fraction')) { | |
$item->data()->set('add_fraction', 1); | |
$item->data()->set('orig_first_price', $item->data()->get('orig_first_price') + ($id % 1000)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This feature uses shopping cart module and its product images (cart view size) | |
*/ | |
$di = Am_Di::getInstance(); | |
if ($di->auth->getUser() && ($pids = $di->user->getActiveProductIds())) { | |
$di->view->headStyle() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@file application/configs/site.js | |
setTimeout(function(){ | |
jQuery(function($){ | |
$('.am-product-qty', '.am-signup-form').each(function(){ | |
var s = $('<select class="am-product-qty">\ | |
<option value="1">1</option>\ | |
<option value="2">2</option>\ | |
<option value="3">3</option>\ | |
<option value="4">4</option>\ |