Creating a RSS feed for several selected categories - osclass

If I do this http://www.website.com/index.php?page=search&sCategory=123&sFeed=rss
I can create a RSS feed for a particular category. But what if I want to create a RSS feed for several selected categories? is it possible? OSClass version is 3.3.2

I didnt find a short or integrated way to do it, so I coded it.
<?php
define('ABS_PATH', str_replace('\\', '/', dirname($_SERVER['SCRIPT_FILENAME']) . '/'));
if(PHP_SAPI==='cli') {
define('CLI', true);
}
require_once ABS_PATH . 'oc-load.php';
$mSearch = Search::newInstance();
$array_categorias = array("16","22","23","24","31","33","43","102","119","121","122","123","124");
$aItems = $mSearch->doCustomSearch($array_categorias);
View::newInstance()->_exportVariableToView('items', $aItems);
// FEED REQUESTED!
header('Content-type: text/xml; charset=utf-8');
$feed = new RSSFeed;
$feed->setTitle(__('Latest listings added') . ' - ' . osc_page_title());
$feed->setLink(osc_base_url());
$feed->setDescription(__('Latest listings added in') . ' ' . osc_page_title());
$contador_items = osc_count_items();
if(osc_count_items()>0) {
while(osc_has_items()) {
if(osc_count_item_resources() > 0){
osc_has_item_resources();
$feed->addItem(array(
'title' => osc_item_title(),
'link' => htmlentities( osc_item_url(), ENT_COMPAT, "UTF-8" ),
'description' => osc_item_description(),
'dt_pub_date' => osc_item_pub_date(),
'image' => array( 'url' => htmlentities(osc_resource_thumbnail_url(), ENT_COMPAT, "UTF-8"),
'title' => osc_item_title(),
'link' => htmlentities( osc_item_url() , ENT_COMPAT, "UTF-8") )
));
} else {
$feed->addItem(array(
'title' => osc_item_title(),
'link' => htmlentities( osc_item_url() , ENT_COMPAT, "UTF-8"),
'description' => osc_item_description(),
'dt_pub_date' => osc_item_pub_date()
));
}
}
}
$feed->dumpXML();
?>
I also had to add a couple of custom methods to the search model
public function _makeSQLCustomCategories($categories)
{
$cadena_select = DB_TABLE_PREFIX."t_item.*, ".DB_TABLE_PREFIX."t_item.s_contact_name as s_user_name,";
$cadena_select = $cadena_select . DB_TABLE_PREFIX. "t_item_description.s_title, ";
$cadena_select = $cadena_select . DB_TABLE_PREFIX. "t_item_description.s_description";
$this->dao->select($cadena_select);
$this->dao->from( DB_TABLE_PREFIX.'t_item' );
$this->dao->from( DB_TABLE_PREFIX. 't_item_description');
$this->dao->where(DB_TABLE_PREFIX. 't_item_description.fk_i_item_id = '. DB_TABLE_PREFIX. 't_item.pk_i_id');
//$this->dao->where(DB_TABLE_PREFIX. 't_item.b_premium = 1');
$this->dao->where(DB_TABLE_PREFIX. 't_item.b_enabled = 1');
$this->dao->where(DB_TABLE_PREFIX. 't_item.b_active = 1');
$this->dao->where(DB_TABLE_PREFIX. 't_item.b_spam = 0');
$where_categorias = "(";
$contador_categorias = 0;
$tamano_categories = sizeof($categories);
foreach ($categories as $categoria)
{
$contador = $contador + 1;
$where_categorias = $where_categorias. DB_TABLE_PREFIX. 't_item.fk_i_category_id = ' . $categoria ;
if ($contador == $tamano_categories)
break;
$where_categorias = $where_categorias . " OR ";
}
$where_categorias = $where_categorias . ")";
$this->dao->where($where_categorias );
$this->dao->groupBy(DB_TABLE_PREFIX.'t_item.pk_i_id');
$this->dao->orderBy(DB_TABLE_PREFIX. 't_item.pk_i_id', 'DESC');
$sql = $this->dao->_getSelect();
// reset dao attributes
$this->dao->_resetSelect();
return $sql;
}
public function doCustomSearch($categories, $extended = true, $count = true)
{
$sql = $this->_makeSQLCustomCategories($categories);
$result = $this->dao->query($sql);
if($count) {
$sql = $this->_makeSQLCustomCategories($categories);
$datatmp = $this->dao->query( $sql );
if( $datatmp == false ) {
$this->total_results = 0;
} else {
$this->total_results = $datatmp->numRows();
}
} else {
$this->total_results = 0;
}
if( $result == false ) {
return array();
}
if($result) {
$items = $result->result();
} else {
$items = array();
}
if($extended) {
return Item::newInstance()->extendData($items);
} else {
return $items;
}
}

Related

Fatal error occuring when created a module in presatshop

I am creating a back office(bo) module to view the dormant users in bo,
I created module and module is installing correctly and menu is been created and I am able to uninstall it properly , but when i click the menu 'Dormant users' I am getting error in functions.php, i haven't touched this page .
Fatal error: Call to undefined method DormantUsers::viewAccess() in D:\xampp\htdocs\raffleV1.1\oknr9hexztcseff5\functions.php on line 279
Here is the link to my module
https://www.dropbox.com/s/xlg6623jwyx4nnp/dormantusers.zip?dl=0
extract and try and please check why this eror occurs. I am trying to solve this for more than 3 hours now , could not find any hint ,
What i did is the following
I created dormantusers folder in modules folder and created dormantusers.php and below is the code in that page .
<?php
if (!defined('_PS_VERSION_')) exit;
class DormantUsers extends Module
{
public function __construct()
{
$this->name = 'dormantusers';
$this->tab = 'others';
$this->version = '1.0.0';
$this->author = 'KITS';
$this->need_instance = 0;
/**
* Set $this->bootstrap to true if your module is compliant with bootstrap (PrestaShop 1.6)
*/
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('DormantUsers');
$this->description = $this->l('Allow your Back Office to View Dormant Users ');
$this->confirmUninstall = $this->l('You want to Uninstall DormantUsers ?.');
$this->_tabsArray = array(
'DormantUsers' => 'Dormant Users',
);
}
/**
* Don't forget to create update methods if needed:
* http://doc.prestashop.com/display/PS16/Enabling+the+Auto-Update
*/
public function install()
{
return parent::install() && $this->_installTabs();
}
private function _installTabs()
{
$parentTab = new Tab();
foreach (Language::getLanguages() as $language) $parentTab->name[$language['id_lang']] = 'Dormant Users';
$parentTab->class_name = 'DormantUsers';
$parentTab->module = $this->name;
$parentTab->id_parent = 0;
if (!$parentTab->save()) return false;
else {
$idTab = $parentTab->id;
//$idEn = Language::getIdByIso('en');
foreach ($this->_tabsArray as $tabKey => $name) {
$childTab = new Tab();
foreach (Language::getLanguages() as $language) $childTab->name[$language['id_lang']] = $name;
$childTab->class_name = $tabKey;
$childTab->module = $this->name;
$childTab->id_parent = $idTab;
if (!$childTab->save()) return false;
}
}
return true;
}
public function uninstall()
{
$this->_uninstallTabs();
return parent::uninstall();
}
private function _uninstallTabs()
{
foreach ($this->_tabsArray as $tabKey => $name) {
$idTab = Tab::getIdFromClassName($tabKey);
if ($idTab != 0) {
$tab = new Tab($idTab);
$tab->delete();
}
}
$idTab = Tab::getIdFromClassName('DormantUsers');
if ($idTab != 0) {
$tab = new Tab($idTab);
$tab->delete();
}
return true;
}
/**
* Add the CSS & JavaScript files you want to be loaded in the BO.
*/
public function hookBackOfficeHeader()
{
if (Tools::getValue('module_name') == $this->name) {
}
}
}
In the controllers folder controllers/admin/DormantUsersController.php have the following code .
<?php
require_once(_PS_MODULE_DIR_.'dormantusers/dormantusers.php');
require_once(_PS_MODULE_DIR_.'dormantusers/classes/DormantUsers.php');
class DormantUsersController extends ModuleAdminController
{
public $module;
public $html;
public $tabName = 'renderForm';
public function __construct()
{
$this->tab = 'dormantusers';
$this->module = new dormantusers();
$this->addRowAction('view');
$this->explicitSelect = false;
$this->context = Context::getContext();
$this->id_lang = $this->context->language->id;
$this->lang = false;
$this->ajax = 1;
$this->path = _MODULE_DIR_.'dormantusers';
$this->default_form_language = $this->context->language->id;
$this->table = 'customers';
$this->className = 'DormantUsers';
$this->identifier = 'id_customer';
$this->allow_export = true;
$this->_select = '
firstname,
lastname,
email,
nationality,
passport_no,
date_add
';
$this->name = 'DormantUsers';
$this->bootstrap = true;
$this->initList();
parent::__construct();
}
private function initList()
{
$this->fields_list = array(
'firstname' => array(
'title' => $this->l('First Name'),
'width' => 140,
'type' => 'text',
),
'lastname' => array(
'title' => $this->l('Last Name'),
'width' => 140,
'type' => 'text',
),
'email' => array(
'title' => $this->l('Email'),
'width' => 140,
'type' => 'text',
),
'nationality' => array(
'title' => $this->l('Nationality'),
'width' => 140,
'type' => 'text',
),
'date_add' => array(
'title' => $this->l('date add'),
'width' => 140,
'type' => 'text',
),
'passport_no' => array(
'title' => $this->l('passport_no'),
'width' => 140,
'type' => 'text',
),
);
$helper = new HelperList();
$helper->shopLinkType = '';
$helper->simple_header = true;
// Actions to be displayed in the "Actions" column
$helper->actions = array('view');
$helper->identifier = 'id_customer';
$helper->show_toolbar = true;
$helper->title = 'HelperList';
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;
return $helper;
}
public function initPageHeaderToolbar()
{
$this->page_header_toolbar_title = $this->l('Dormant Users List ');
parent::initPageHeaderToolbar();
}
public function initToolbar()
{
parent::initToolbar();
$this->context->smarty->assign('toolbar_scroll', 1);
$this->context->smarty->assign('show_toolbar', 1);
$this->context->smarty->assign('toolbar_btn', $this->toolbar_btn);
}
public function postProcess()
{
parent::postProcess();
}
}
You have to define function viewAccess in DormantUsersController class. Try this code
public function viewAccess($disable = false)
{
if (version_compare(_PS_VERSION_, '1.5.1.0', '<='))
return true;
return parent::viewAccess($disable);
}

How to add a variable to the form so that it is then added to the database (paypal script)?

I would like to add a variable to paypal payment form. Then I would like it to be added to the database . The variable is called "membre_id" (user ID) and is found in the $_SESSION['membre_id'].
Here's the code of form processing :
<?php
require 'lib/init.php';
$action = isset($_POST['action']) ? $_POST['action'] : (isset($_GET['action']) ? $_GET['action'] : '');
if ( !empty($action) ) {
switch ( $action ) {
/***********************************************************************************************************************/
case 'paypal_ipn':
require ('lib/vendor/ipnlistener.php');
$listener = new IpnListener();
try {
$verified = $listener->processIpn();
if ( $verified ) {
// parse our custom field data
$custom = post('custom');
if ( $custom ) {
parse_str(post('custom'), $data);
} else {
$data = array();
}
// pull out some values
$payment_gross = post('payment_gross');
$item_name = post('item_name');
// build customer data
$name = isset($data['name']) && $data['name'] ? $data['name'] : null;
$name_arr = explode(' ', trim($name));
$first_name = $name_arr[0];
$last_name = trim(str_replace($first_name, '', $name));
$email = isset($data['email']) && $data['email'] ? $data['email'] : null;
$description = $item_name ? $item_name : 'no description entered';
$address = isset($data['address']) && $data['address'] ? $data['address'] : null;
$city = isset($data['city']) && $data['city'] ? $data['city'] : null;
$state = isset($data['state']) && $data['state'] ? $data['state'] : null;
$zip = isset($data['zip']) && $data['zip'] ? $data['zip'] : null;
$country = isset($data['country']) && $data['country'] ? $data['country'] : null;
// check for invoice first
if ( isset($data['invoice_id']) && $data['invoice_id'] ) {
$invoice = Model::factory('Invoice')->find_one($data['invoice_id']);
$amount = $invoice->amount;
$type = 'invoice';
$description = $invoice->description;
// now check for item
} elseif ( isset($data['item_id']) && $data['item_id'] ) {
$item = Model::factory('Item')->find_one($data['item_id']);
$amount = $item->price;
$type = 'item';
// check for input amount
} elseif ( $payment_gross ) {
$amount = $payment_gross;
$type = 'input';
// return error if none found
} else {
$amount = 0;
$type = '';
}
switch ( post('txn_type') ) {
case 'web_accept':
// save payment record
$payment = Model::factory('Payment')->create();
$payment->invoice_id = isset($invoice) ? $invoice->id : null;
$payment->name = $name;
$payment->email = $email;
$payment->amount = $amount;
$payment->description = isset($item) ? $item->name : $description;
$payment->address = $address;
$payment->city = $city;
$payment->state = $state;
$payment->zip = $zip;
$payment->country = $country;
$payment->type = $type;
$payment->paypal_transaction_id = post('txn_id');
$payment->save();
// update paid invoice
if ( isset($invoice) ) {
$invoice->status = 'Paid';
$invoice->date_paid = date('Y-m-d H:i:s');
$invoice->save();
}
// build email values first
$values = array(
'customer_name' => $payment->name,
'customer_email' => $payment->email,
'amount' => currency($payment->amount) . '<small>' . currencySuffix() . '</small>',
'description_title' => isset($item) ? 'Item' : 'Description',
'description' => $payment->description,
'payment_method' => 'PayPal',
'transaction_id' => $payment->paypal_transaction_id,
'url' => url(''),
);
email($config['email'], 'payment-confirmation-admin', $values, 'You\'ve received a new payment!');
email($payment->email, 'payment-confirmation-customer', $values, 'Thank you for your payment to ' . $config['name']);
break;
case 'subscr_signup':
try {
$unique_subscription_id = uniqid();
// save subscription record
$subscription = Model::factory('Subscription')->create();
$subscription->unique_id = $unique_subscription_id;
$subscription->paypal_subscription_id = post('subscr_id');
$subscription->name = $name;
$subscription->email = $email;
$subscription->address = $address;
$subscription->city = $city;
$subscription->state = $state;
$subscription->zip = $zip;
$subscription->country = $country;
$subscription->description = isset($item) ? $item->name : $description;
$subscription->price = post('amount3');
$subscription->billing_day = date('j', strtotime(post('subscr_date')));
$subscription->length = $config['subscription_length'];
$subscription->interval = $config['subscription_interval'];
$subscription->trial_days = $config['enable_trial'] ? $config['trial_days'] : null;
$subscription->status = 'Active';
$subscription->date_trial_ends = $config['enable_trial'] ? date('Y-m-d', strtotime('+' . $config['trial_days'] . ' days')) : null;
$subscription->save();
$trial = $subscription->date_trial_ends ? ' <span style="color:#999999;font-size:16px">(Billing starts after your ' . $config['trial_days'] . ' day free trial ends)</span>' : '';
$values = array(
'customer_name' => $name,
'customer_email' => $email,
'amount' => currency(post('amount3')) . '<small>' . currencySuffix() . '</small>' . $trial,
'description_title' => isset($item) ? 'Item' : 'Description',
'description' => isset($item) ? $item->name : $description,
'payment_method' => 'PayPal',
'subscription_id' => $subscription->paypal_subscription_id,
'manage_url' => url('manage.php?subscription_id=' . $unique_subscription_id)
);
email($config['email'], 'subscription-confirmation-admin', $values, 'You\'ve received a new recurring payment!');
email($email, 'subscription-confirmation-customer', $values, 'Thank you for your recurring payment to ' . $config['name']);
} catch (Exception $e) {
}
break;
case 'subscr_cancel':
$subscription = Model::factory('Subscription')->where('paypal_subscription_id', post('subscr_id'))->find_one();
if ( $subscription ) {
$subscription->status = 'Canceled';
$subscription->date_canceled = date('Y-m-d H:i:s');
$subscription->save();
// send subscription cancelation email now
$values = array(
'customer_name' => $subscription->name,
'customer_email' => $subscription->email,
'amount' => currency($subscription->price) . '<small>' . currencySuffix() . '</small>',
'description' => $subscription->description,
'payment_method' => 'PayPal',
'subscription_id' => $subscription->paypal_subscription_id
);
email($config['email'], 'subscription-canceled-admin', $values, 'A recurring payment has been canceled.');
email($subscription->email, 'subscription-canceled-customer', $values, 'Your recurring payment to ' . $config['name'] . ' has been canceled.');
}
break;
case 'subscr_eot':
$subscription = Model::factory('Subscription')->where('paypal_subscription_id', post('subscr_id'))->find_one();
if ( $subscription && $subscription->status == 'Active' ) {
$subscription->status = 'Expired';
$subscription->date_canceled = null;
$subscription->save();
}
break;
}
} else {
die();
}
} catch (Exception $e) {
die();
}
break;
/***********************************************************************************************************************/
case 'paypal_success':
go('index.php#status=paypal_success');
break;
/***********************************************************************************************************************/
case 'paypal_subscription_success':
go('index.php#status=paypal_subscription_success');
break;
/***********************************************************************************************************************/
case 'paypal_cancel':
msg('You canceled your PayPal payment, no payment has been made.', 'warning');
go('index.php');
break;
/***********************************************************************************************************************/
case 'delete_payment':
if ( isset($_GET['id']) ) {
$payment = Model::factory('Payment')->find_one($_GET['id']);
$payment->delete();
}
msg('Payment has been deleted successfully.', 'success');
go('admin.php#tab=payments');
break;
/***********************************************************************************************************************/
case 'delete_subscription':
if ( isset($_GET['id']) ) {
$subscription = Model::factory('Subscription')->find_one($_GET['id']);
$subscription->delete();
}
msg('Subscription has been deleted successfully.', 'success');
go('admin.php#tab=subscriptions');
break;
/***********************************************************************************************************************/
case 'create_invoice':
if ( post('email') && post('amount') && post('description') ) {
$unique_invoice_id = uniqid();
$invoice = Model::factory('Invoice')->create();
$invoice->unique_id = $unique_invoice_id;
$invoice->email = post('email');
$invoice->description = post('description');
$invoice->amount = post('amount');
$invoice->number = post('number');
$invoice->status = 'Unpaid';
$invoice->date_due = post('date_due') ? date('Y-m-d', strtotime(post('date_due'))) : null;
$invoice->save();
}
$number = $invoice->number ? $invoice->number : $invoice->id();
if ( post('send_email') && post('send_email') ) {
$values = array(
'number' => $number,
'amount' => currency($invoice->amount) . '<small>' . currencySuffix() . '</small>',
'description' => $invoice->description,
'date_due' => !is_null($invoice->date_due) ? date('F jS, Y', strtotime($invoice->date_due)) : '<em>no due date set</em>',
'url' => url('?invoice_id=' . $unique_invoice_id)
);
email($invoice->email, 'invoice', $values, 'Invoice from ' . $config['name']);
$msg = ' and sent';
}
msg('Invoice has been created' . (isset($msg) ? $msg : '') . ' successfully.', 'success');
go('admin.php#tab=invoices');
break;
/***********************************************************************************************************************/
case 'delete_invoice':
if ( isset($_GET['id']) ) {
$invoice = Model::factory('Invoice')->find_one($_GET['id']);
$invoice->delete();
}
msg('Invoice has been deleted successfully.', 'success');
go('admin.php#tab=invoices');
break;
/***********************************************************************************************************************/
case 'add_item':
if ( post('name') && post('price') ) {
$item = Model::factory('Item')->create();
$item->name = post('name');
$item->price = post('price');
$item->save();
}
msg('Item has been added successfully.', 'success');
go('admin.php#tab=items');
break;
/***********************************************************************************************************************/
case 'edit_item':
if ( post('id') && post('name') && post('price') ) {
$item = Model::factory('Item')->find_one(post('id'));
$item->name = post('name');
$item->price = post('price');
$item->save();
}
msg('Item has been edited successfully.', 'success');
go('admin.php#tab=items');
break;
/***********************************************************************************************************************/
case 'delete_item':
if ( isset($_GET['id']) ) {
$item = Model::factory('Item')->find_one($_GET['id']);
$item->delete();
}
msg('Item has been deleted successfully.', 'success');
go('admin.php#tab=items');
break;
/***********************************************************************************************************************/
case 'save_config':
if ( post('config') && is_array(post('config')) ) {
foreach ( post('config') as $key => $value ) {
$config = Model::factory('Config')->where('key', $key)->find_one();
if ( $config ) {
$config->value = $value;
$config->save();
}
}
}
msg('Your settings have been saved successfully.', 'success');
go('admin.php#tab=settings');
break;
/***********************************************************************************************************************/
case 'login':
if (
post('admin_username') && post('admin_username') == $config['admin_username'] &&
post('admin_password') && post('admin_password') == $config['admin_password']
) {
// login successful, set session
$_SESSION['admin_username'] = $config['admin_username'];
} else {
// login failed, set error message
msg('Login attempt failed, please try again.', 'danger');
}
go('admin.php');
break;
/***********************************************************************************************************************/
case 'logout':
unset($_SESSION['admin_username']);
session_destroy();
session_start();
msg('You have been logged out successfully.', 'success');
go('admin.php');
break;
/***********************************************************************************************************************/
case 'install':
$status = true;
$message = '';
try {
$db = new PDO('mysql:host=' . $config['db_host'] . ';dbname=' . $config['db_name'], $config['db_username'], $config['db_password']);
$sql = file_get_contents('lib/sql/install.sql');
$result = $db->exec($sql);
} catch (PDOException $e) {
$status = false;
$message = $e->getMessage();
}
$response = array(
'status' => $status,
'message' => $message
);
header('Content-Type: application/json');
die(json_encode($response));
break;
/***********************************************************************************************************************/
}
}
There is a parameter in the API request called "custom". That's what you need to pass your data in and then it will come back within IPN as $_POST['custom']

(Magento 1.7) How to modify the report module?

I followed a tutorial to create report module and the tutorial show me exactly what I wanted. Now, I would like to modify the database into my database. There are two tables that I want to join (member_download and sales_payment). What should I modify from this code to link it into my database?
Here is the code:
<?php
class Wcl_ReportNewOrders_Model_Reportneworders extends Mage_Reports_Model_Mysql4_Product_Ordered_Collection
{
function __construct() {
parent::__construct();
}
protected function _joinFields($from = '', $to = '')
{
$this->addAttributeToSelect('name')
->addAttributeToSelect('increment_id')
->addOrderedQty($from, $to)
->setOrder('sku', self::SORT_ORDER_ASC);
//Mage::log('SQL: '.$this->getSelect()->__toString());
return $this;
}
public function addOrderedQty($from = '', $to = '')
{
$adapter = $this->getConnection();
$compositeTypeIds = Mage::getSingleton('catalog/product_type')->getCompositeTypes();
$orderTableAliasName = $adapter->quoteIdentifier('order');
$addressTableAliasName = 'a';
$downloadTableAliasName = 'download';
$orderJoinCondition = array(
$orderTableAliasName . '.entity_id = order_items.order_id',
$adapter->quoteInto("{$orderTableAliasName}.state = ?", Mage_Sales_Model_Order::STATE_PROCESSING),
);
$addressJoinCondition = array(
$addressTableAliasName . '.entity_id = order.shipping_address_id'
);
$downloadJoinCondition = array(
$downloadTableAliasName . '.order_id = order_items.order_id'
);
$productJoinCondition = array(
//$adapter->quoteInto('(e.type_id NOT IN (?))', $compositeTypeIds),
'e.entity_id = order_items.product_id',
$adapter->quoteInto('e.entity_type_id = ?', $this->getProductEntityTypeId())
);
if ($from != '' && $to != '') {
$fieldName = $orderTableAliasName . '.created_at';
$orderJoinCondition[] = $this->_prepareBetweenSql($fieldName, $from, $to);
}
$this->getSelect()->reset()
->from(
array('order_items' => $this->getTable('sales/order_item')),
array(
'qty_ordered' => 'order_items.qty_ordered',
'order_items_name' => 'order_items.name',
'order_increment_id' => 'order.increment_id',
'sku' => 'order_items.sku',
'type_id' => 'order_items.product_type',
'shipping_address_id' => 'order.shipping_address_id'
))
->joinInner(
array('order' => $this->getTable('sales/order')),
implode(' AND ', $orderJoinCondition),
array())
->joinLeft(
array('a' => $this->getTable('sales/order_address')),
implode(' AND ', $addressJoinCondition),
array(
'shipto_name' => "CONCAT(COALESCE(a.firstname, ''), ' ', COALESCE(a.lastname, ''))"
),
array())
->joinLeft(
array('e' => $this->getProductEntityTableName()),
implode(' AND ', $productJoinCondition),
array(
'created_at' => 'e.created_at',
'updated_at' => 'e.updated_at'
))
->where('parent_item_id IS NULL')
//->group('order_items.product_id')
->having('order_items.qty_ordered > ?', 0);
return $this;
}
public function addItem(Varien_Object $item)
{
$itemId = $this->_getItemId($item);
if (!is_null($itemId)) {
if (isset($this->_items[$itemId])) {
// Unnecessary exception - http://www.magentocommerce.com/boards/viewthread/10634/P0/
//throw new Exception('Item ('.get_class($item).') with the same id "'.$item->getId().'" already exist');
}
$this->_items[$itemId] = $item;
} else {
$this->_items[] = $item;
}
return $this;
}
}
Please tell me how to modify the database. I am new with magento. Thanks!
i checked your link that you provided. open file at below location
Wcl_ReportNewOrders_Block_Adminhtml_ReportNewOrders_Grid
below is the function where you can modify the database
protected function _prepareCollection() {
parent::_prepareCollection();
// Get the data collection from the model
$this->getCollection()->initReport('reportneworders/reportneworders');
return $this;
}
Replace the above code with below code
protected function _prepareCollection() {
parent::_prepareCollection();
$collection = $this->getCollection()->initReport('reportneworders/reportneworders');
/*
perform your desired operation here
// print_r((string)$collection->getSelect();
*/
$this->setCollection($collection);
return $this;
}

yii user-management edit field

I have managed to set-up yii-user-management. Thanks to help from here.
However, when I am in profile/fields/admin .
I click on edit field and then change the field from required 'no' to 'yes' in the dropdown, then save, but nothing happens.
I also get :
CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(0) NOT NULL DEFAULT 0' at line 1. The SQL statement executed was: ALTER TABLE profile ADD `` (0) NOT NULL DEFAULT 0
When creating a field.
Let me know if you need some code or files. Any help appreciated.
Here is the profile/models/YumProfileField.php
class YumProfileField extends YumActiveRecord
{
const VISIBLE_HIDDEN=0;
const VISIBLE_ONLY_OWNER=1;
const VISIBLE_REGISTER_USER=2;
const VISIBLE_USER_DECISION=3;
const VISIBLE_PUBLIC=4; // Field is public even if the user decides to hide it
/**
* Returns the static model of the specified AR class.
* #param string $className
* #return YumProfileField
*/
public static function model($className=__CLASS__)
{
return parent::model($className);
}
public function isPublic($user = null) {
if($user == null)
$user = Yii::app()->user->id;
if(!$this->visible)
return false;
if($privacy = YumUser::model()->findByPk($user)->privacy) {
if($privacy->public_profile_fields & pow(2, $this->id))
return true;
}
return false;
}
public function tableName()
{
$this->_tableName = Yum::module('profile')->profileFieldTable;
return $this->_tableName;
}
public function scopes()
{
return array(
'forAll'=>array(
'condition'=>'visible='.self::VISIBLE_PUBLIC,
),
'forUser'=>array(
'condition'=>'visible>='.self::VISIBLE_REGISTER_USER,
),
'forOwner'=>array(
'condition'=>'visible>='.self::VISIBLE_ONLY_OWNER,
),
);
}
public static function itemAlias($type,$code=NULL) {
$_items = array(
'field_type' => array(
'INTEGER' => Yum::t('INTEGER'),
'VARCHAR' => Yum::t( 'VARCHAR'),
'TEXT'=> Yum::t( 'TEXT'),
'DATE'=> Yum::t( 'DATE'),
'DROPDOWNLIST' => Yum::t('DROPDOWNLIST'),
'FLOAT'=> Yum::t('FLOAT'),
'BOOL'=> Yum::t('BOOL'),
'BLOB'=> Yum::t('BLOB'),
'BINARY'=> Yum::t('BINARY'),
'FILE'=> 'FILE',
),
'required' => array(
'0' => Yum::t('No'),
'1' => Yum::t('Yes'),
),
'visible' => array(
self::VISIBLE_USER_DECISION => Yum::t('Let the user choose in privacy settings'),
self::VISIBLE_PUBLIC => Yum::t('For all'),
self::VISIBLE_REGISTER_USER => Yum::t('Registered users'),
self::VISIBLE_ONLY_OWNER => Yum::t('Only owner'),
self::VISIBLE_HIDDEN => Yum::t('Hidden'),
),
);
if (isset($code))
return isset($_items[$type][$code]) ? $_items[$type][$code] : false;
else
return isset($_items[$type]) ? $_items[$type] : false;
}
}
The YumFieldsController:
class YumFieldsController extends YumController
{
const PAGE_SIZE=10;
public function accessRules()
{
return array(
array('allow',
'actions'=>array('index', 'create', 'update', 'view', 'admin','delete'),
'users'=>array(Yii::app()->user->name),
'expression' => 'Yii::app()->user->isAdmin()'
),
array('deny', // deny all users
'users'=>array('*'),
),
);
}
public function actionView()
{
$this->layout = Yum::module()->adminLayout;
$this->render('view',array(
'model'=>$this->loadModel('YumProfileField'),
));
}
public function actionCreate() {
$this->layout = Yum::module()->adminLayout;
$model = new YumProfileField;
// add to group?
if(isset($_GET['in_group']))
$model->field_group_id=$_GET['in_group'];
if(isset($_POST['YumProfileField'])) {
$model->attributes = $_POST['YumProfileField'];
$field_type = $model->field_type;
if($field_type == 'DROPDOWNLIST')
$field_type = 'INTEGER';
if($model->validate()) {
$sql = 'ALTER TABLE '.YumProfile::model()->tableName().' ADD `'.$model->varname.'` ';
$sql .= $field_type;
if ($field_type!='TEXT' && $field_type!='DATE')
$sql .= '('.$model->field_size.')';
$sql .= ' NOT NULL ';
if ($model->default)
$sql .= " DEFAULT '".$model->default."'";
else
$sql .= (($field_type =='TEXT' || $model->field_type=='VARCHAR')?" DEFAULT ''":" DEFAULT 0");
$model->dbConnection->createCommand($sql)->execute();
$model->save();
$this->redirect(array('view','id'=>$model->id));
}
}
$this->render('create',array(
'model'=>$model,
));
}
public function actionUpdate()
{
$this->layout = Yum::module()->adminLayout;
$model = $this->loadModel('YumProfileField');
if(isset($_POST['YumProfileField']))
{
$model->attributes=$_POST['YumProfileField'];
// ALTER TABLE `test` CHANGE `profiles` `field` INT( 10 ) NOT NULL
// ALTER TABLE `test` CHANGE `profiles` `description` INT( 1 ) NOT NULL DEFAULT '0'
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}
$this->render('update',array(
'model'=>$model,
));
}
public function actionDelete()
{
$this->layout = Yum::module()->adminLayout;
if(Yii::app()->request->isPostRequest)
{
// we only allow deletion via POST request
$model = $this->loadModel('YumProfileField');
$sql = 'ALTER TABLE '.YumProfile::model()->tableName().' DROP `'.$model->varname.'`';
if ($model->dbConnection->createCommand($sql)->execute()) {
$model->delete();
}
if(!isset($_POST['ajax']))
$this->redirect(array('index'));
}
else
throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
}
public function actionIndex()
{
$this->layout = Yum::module()->adminLayout;
$dataProvider=new CActiveDataProvider('YumProfileField', array(
'pagination'=>array(
'pageSize'=>self::PAGE_SIZE,
),
'sort'=>array(
'defaultOrder'=>'position',
),
));
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}
public function actionAdmin()
{
$this->layout = Yum::module()->adminLayout;
$dataProvider=new CActiveDataProvider('YumProfileField', array(
'pagination'=>array(
'pageSize'=>self::PAGE_SIZE,
),
'sort'=>array(
'defaultOrder'=>'position',
),
));
$this->render('admin',array(
'dataProvider'=>$dataProvider,
));
}
}
YumProfile.php model
class YumProfile extends YumActiveRecord
{
const PRIVACY_PRIVATE = 'private';
const PRIVACY_PUBLIC = 'public';
/**
* #var array of YumProfileFields
*/
static $fields=null;
public function init()
{
parent::init();
// load profile fields only once
$this->loadProfileFields();
}
public function afterSave() {
if($this->isNewRecord)
Yii::log(Yum::t( 'A profile been created: {profile}', array(
'{profile}' =>json_encode($this->attributes))));
else
Yii::log(Yum::t( 'A profile been update: {profile}', array(
'{profile}' => json_encode($this->attributes))));
return parent::afterSave();
}
public function recentComments($count = 3) {
$criteria = new CDbCriteria;
$criteria->condition = 'id = ' .$this->id;
$criteria->order = 'createtime DESC';
$criteria->limit = $count;
return YumProfileComment::model()->findAll($criteria);
}
public function beforeValidate() {
if($this->isNewRecord)
$this->timestamp = time();
return parent::beforeValidate();
}
/**
* #param string $className
* #return YumProfile
*/
public static function model($className=__CLASS__)
{
return parent::model($className);
}
// All fields that the user has activated in his privacy settings will
// be obtained and returned for the use in the profile view
public function getPublicFields() {
if(!Yum::module('profile')->enablePrivacySetting)
return false;
$fields = array();
if($privacy = YumUser::model()
->cache(500)
->with('privacy')
->findByPk($this->user_id)
->privacy->public_profile_fields) {
$i = 1;
foreach(YumProfileField::model()->cache(3600)->findAll() as $field) {
if(
(($i & $privacy)
&& $field->visible != YumProfileField::VISIBLE_HIDDEN)
|| $field->visible == YumProfileField::VISIBLE_PUBLIC)
$fields[] = $field;
$i*=2;
}
}
return $fields;
}
/**
* Returns resolved table name
* #return string
*/
public function tableName()
{
$this->_tableName = Yum::module('profile')->profileTable;
return $this->_tableName;
}
public function rules()
{
$required = array();
$numerical = array();
$rules = array();
$safe = array();
foreach (self::$fields as $field) {
$field_rule = array();
if ($field->required == 1)
array_push($required, $field->varname);
if ($field->field_type == 'int'
|| $field->field_type == 'FLOAT'
|| $field->field_type =='INTEGER'
|| $field->field_type =='BOOLEAN')
array_push($numerical, $field->varname);
if ($field->field_type == 'DROPDOWNLIST')
array_push($safe, $field->varname);
if ($field->field_type == 'VARCHAR' || $field->field_type == 'TEXT') {
$field_rule = array($field->varname,
'length',
'max'=>$field->field_size,
'min' => $field->field_size_min);
if ($field->error_message)
$field_rule['message'] = Yum::t($field->error_message);
array_push($rules,$field_rule);
}
if ($field->match) {
$field_rule = array($field->varname,
'match',
'pattern' => $field->match);
if ($field->error_message)
$field_rule['message'] = Yum::t( $field->error_message);
array_push($rules,$field_rule);
}
if ($field->range) {
// allow using commas and semicolons
$range=explode(';',$field->range);
if(count($range)===1)
$range=explode(',',$field->range);
$field_rule = array($field->varname,'in','range' => $range);
if ($field->error_message)
$field_rule['message'] = Yum::t( $field->error_message);
array_push($rules,$field_rule);
}
if ($field->other_validator) {
$field_rule = array($field->varname,
$field->other_validator);
if ($field->error_message)
$field_rule['message'] = Yum::t( $field->error_message);
array_push($rules, $field_rule);
}
}
array_push($rules,
array(implode(',',$required), 'required'));
array_push($rules,
array(implode(',',$numerical), 'numerical', 'integerOnly'=>true));
array_push($rules,
array(implode(',',$safe), 'safe'));
$rules[] = array('allow_comments, show_friends', 'numerical');
$rules[] = array('email', 'unique');
$rules[] = array('email', 'CEmailValidator');
$rules[] = array('privacy', 'safe');
return $rules;
}
public function relations()
{
$relations = array(
'user' => array(self::BELONGS_TO, 'YumUser', 'user_id'),
'comments' => array(self::HAS_MANY, 'YumProfileComment', 'profile_id'),
);
$fields = Yii::app()->db->cache(3600)->createCommand(
"select * from ".YumProfileField::model()->tableName()." where field_type = 'DROPDOWNLIST'")->queryAll();
foreach($fields as $field) {
$relations[ucfirst($field['varname'])] = array(
self::BELONGS_TO, ucfirst($field['varname']), $field['varname']);
}
return $relations;
}
// Retrieve a list of all users that have commented my profile
// Do not show my own profile visit
public function getProfileCommentators() {
$commentators = array();
foreach($this->comments as $comment)
if($comment->user_id != Yii::app()->user->id)
$commentators[$comment->user_id] = $comment->user;
return $commentators;
}
public function getProfileFields() {
$fields = array();
if(self::$fields)
foreach(self::$fields as $field) {
$varname = $field->varname;
$fields[$varname] = Yum::t($varname);
}
return $fields;
}
public function name() {
return sprintf('%s %s', $this->firstname, $this->lastname);
}
public function attributeLabels()
{
$labels = array(
'id' => Yum::t('Profile ID'),
'user_id' => Yum::t('User ID'),
'privacy' => Yum::t('Privacy'),
'show_friends' => Yum::t('Show friends'),
'allow_comments' => Yum::t('Allow profile comments'),
);
if(self::$fields)
foreach (self::$fields as $field)
$labels[$field->varname] = Yum::t($field->title);
return $labels;
}
/**
* Load profile fields.
* Overwrite this method to get another set of fields
* Makes use of cache so the amount of sql queries per request is reduced
* #since 0.6
* #return array of YumProfileFields or empty array
*/
public function loadProfileFields()
{
if(self::$fields===null)
{
self::$fields=YumProfileField::model()->cache(3600)->findAll();
if(self::$fields==null)
self::$fields=array();
}
return self::$fields;
}
}
looks like you're trying to add a column with no name or type? MySQL ALTER TABLE examples.
Also, check your db user has permissions to ALTER TABLE.

How can I automatically sign in users in a phpBB3 forum based on accounts in a Rails app?

I have a mobile app that uses Rails/MySQL as a backend (just serves JSON, I know we don't need full blown Rails, but this was the simplest solution to get started). My Rails app uses devise for auth. I'd like my users to be able to also access a Phpbb3 forum without having to sign up again. What's the best way to do this? Have the Phpbb3 forum read accounts right from the same MySQL?
Use the email address as a base.
name a file inside includes/ucp called ucp_my_rails_app_connect.php
<?php
/*
* #package My Package
* #author Me
* #license http://opensource.org/licenses/gpl-license.php GNU Public License
* #link my href
* #copyright (c) my copyright
*
* #license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/*
* #ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/*
* ucp_myclass
* my rails app connect
* #package my package
*/
class ucp_my_rails_app_connect
{
var $u_action;
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
/** Do some DB code here for rails or wrap it in a private function*/
$server_url = generate_board_url();
$key_len = 54 - strlen($server_url);
$key_len = max(6, $key_len); // we want at least 6
$key_len = ($config['max_pass_chars']) ? min($key_len, $config['max_pass_chars']) : $key_len; // we want at most $config['max_pass_chars']
$user_actkey = substr(gen_rand_string(10), 0, $key_len);
$new_user_password = gen_rand_string(8);
$data = array(
'username' => utf8_normalize_nfc(/** rails DB username*/),
'steam_id' => request_var('steam_id', ''),
'new_password' => $new_user_password,
'password_confirm' => $new_user_password,
'email' => strtolower(/** rails DB email*/),
'email_confirm' => strtolower(/** rails DB email*/)
);
if($my_rails_exec_func == $some_val) /* make some code so not just anyone can submit stuff to this area*/
{
//Check and initialize some variables if needed
$error = validate_data($data, array(
'username' => array(
array('string', false, $config['min_name_chars'], $config['max_name_chars']),
array('username', '')),
'new_password' => array(
array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
array('password')),
'password_confirm' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
'email' => array(
array('string', false, 6, 60),
array('email')),
'email_confirm' => array('string', false, 6, 60),
'tz' => array('num', false, -14, 14),
'lang' => array('match', false, '#^[a-z_\-]{2,}$#i'),
));
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
if (!sizeof($error))
{
// Which group by default?
$group_name = ($coppa) ? 'REGISTERED_COPPA' : 'REGISTERED';
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . "
WHERE group_name = '" . $db->sql_escape($group_name) . "'
AND group_type = " . GROUP_SPECIAL;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$group_id = $row['group_id'];
if (($config['require_activation'] == USER_ACTIVATION_SELF ||
$config['require_activation'] == USER_ACTIVATION_ADMIN) && $config['email_enable'])
{
$user_actkey = gen_rand_string(mt_rand(6, 10));
$user_type = USER_INACTIVE;
$user_inactive_reason = INACTIVE_REGISTER;
$user_inactive_time = time();
}
else
{
$user_type = USER_NORMAL;
$user_actkey = '';
$user_inactive_reason = 0;
$user_inactive_time = 0;
}
$user_row = array(
'username' => $data['username'],
'user_password' => phpbb_hash($data['new_password']),
'user_email' => $data['email'],
'group_id' => (int) $group_id,
'user_timezone' => (float) $data['tz'],
'user_dst' => $is_dst,
'user_lang' => $data['lang'],
'user_type' => $user_type,
'user_actkey' => $user_actkey,
'user_ip' => $user->ip,
'user_regdate' => time(),
'user_inactive_reason' => $user_inactive_reason,
'user_inactive_time' => $user_inactive_time,
);
if ($config['new_member_post_limit'])
{
$user_row['user_new'] = 1;
}
// Register user...
$user_id = user_add($user_row);
// This should not happen, because the required variables are listed above...
if ($user_id === false)
{
trigger_error('NO_USER', E_USER_ERROR);
}
// DB Error
if(!$result)
{
trigger_error('Unable to connect with phpBB database.');
}
// Okay, captcha, your job is done.
if ($config['enable_confirm'] && isset($captcha))
{
$captcha->reset();
}
if ($coppa && $config['email_enable'])
{
$message = $user->lang['ACCOUNT_COPPA'];
$email_template = 'coppa_welcome_inactive_steam';
}
else if ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable'])
{
$message = $user->lang['ACCOUNT_INACTIVE'];
$email_template = 'user_welcome_inactive_steam';
}
else if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $config['email_enable'])
{
$message = $user->lang['ACCOUNT_INACTIVE_ADMIN'];
$email_template = 'admin_welcome_inactive_steam';
}
else
{
$message = $user->lang['ACCOUNT_ADDED'];
$email_template = 'user_welcome_steam';
}
if ($config['email_enable'])
{
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
$messenger = new messenger(false);
$messenger->template($email_template, $data['lang']);
$messenger->to($data['email'], $data['username']);
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
$messenger->assign_vars(array(
'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])),
'USERNAME' => htmlspecialchars_decode($data['username']),
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
);
if ($coppa)
{
$messenger->assign_vars(array(
'FAX_INFO' => $config['coppa_fax'],
'MAIL_INFO' => $config['coppa_mail'],
'EMAIL_ADDRESS' => $data['email'])
);
}
$messenger->send(NOTIFY_EMAIL);
if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
{
// Grab an array of user_id's with a_user permissions ... these users can activate a user
$admin_ary = $auth->acl_get_list(false, 'a_user', false);
$admin_ary = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();
// Also include founders
$where_sql = ' WHERE user_type = ' . USER_FOUNDER;
if (sizeof($admin_ary))
{
$where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary);
}
$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
FROM ' . USERS_TABLE . ' ' .
$where_sql;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$messenger->template('admin_activate', $row['user_lang']);
$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);
$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($data['username']),
'U_USER_DETAILS' => "$server_url/memberlist.$phpEx?mode=viewprofile&u=$user_id",
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
);
$messenger->send($row['user_notify_type']);
}
$db->sql_freeresult($result);
}
}
$message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '', '');
trigger_error($message);
}
}
}
}
?>
now we add the class to ucp.php
case 'register':
if ($user->data['is_registered'] || isset($_REQUEST['not_agreed']))
{
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
}
$module->load('ucp', 'register');
$module->display($user->lang['REGISTER']);
break;
case 'my_rails_app_connect':
if ($user->data['is_registered'])
{
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
}
$module->load('ucp', 'my_rails_app_connect');
$module->display($user->lang['REGISTER']);
break;
Now we add a login for the rails app
create a file called railsapp.php
<?php define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
// Load include files.
include($phpbb_root_path . 'common.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
// Set up a new user session.
$user->session_begin();
$auth->acl($user->data);
$user->setup('ucp');
$my_rails_user_email = some_code_to_get_user_email_from_rails_database; //maybe use a cookie or make the user allow the phpBB script access to the rails DB or make them login into the rails app
$mysql = 'SELECT user_id
FROM ' . USERS_TABLE
. " WHERE user_email='$my_user_rails_email'";
// Execute the query.
$result = $db->sql_query($sql);
// Retrieve the row data.
$row = $db->sql_fetchrow($result);
// Free up the result handle from the query.
$db->sql_freeresult($result);
// Check to see if we found a user_id with the associated Facebook Id.
if ($row) // User is registered already, let's log him in!
{
// Check for user ban.
if($user->check_ban($row['user_id']))
{
trigger_error($user->lang['BAN_TRIGGERED_BY_USER']);
}
// Log user in.
$result = $user->session_create($row['user_id'], 0, 0, 1);
// Alert user if we failed to log them in.
if(!$result)
{
trigger_error($user->lang['LOGIN_FAILURE']);
}
$redirect = $phpbb_root_path . 'index.' . $phpEx;
$message = ($l_success) ? $l_success : $user->lang['LOGIN_REDIRECT'];
$l_redirect = ($admin) ? $user->lang['PROCEED_TO_ACP'] : (($redirect === "{$phpbb_root_path}index.$phpEx" || $redirect === "index.$phpEx") ? $user->lang['RETURN_INDEX'] : $user->lang['RETURN_PAGE']);
// append/replace SID (may change during the session for AOL users)
$redirect = reapply_sid($redirect);
// Special case... the user is effectively banned, but we allow founders to login
if (defined('IN_CHECK_BAN') && $result['user_row']['user_type'] != USER_FOUNDER)
{
return;
}
$redirect = meta_refresh(3, $redirect);
trigger_error($message . '<br /><br />' . sprintf($l_redirect, '', ''));
}
?>
In index_body.html in styles/your_template_name/templates/ add
Connect With Rails
If you need help just drop by MY phpBB mod support forums to discuss further