Coding / Developers
Quote:
Originally posted by: Aileen Marcell

Even so, if you develop your own module and use this query, you don't need to follow the regular PhpFox's strategy, so you can directly store the query in a variable and send it to the data base.


Not exactly true. There are a number of cases where fox will trigger errors or reject statements. There really is no way to send any query directly to the database unless you circumvent the database interface.

A feature request is needed.


This example is contrived but exhibits one issue:

Phpfox::getLib('database')->query("UPDATE phpfox2_user SET full_name='fred' WHERE user_name='steward';UPDATE phpfox2_user SET user_name='fred' WHERE user_id=2");

SQL does this no problem. But Phpfox triggers an error.


There's another, long forgotten now... if I played with the IN() clause I could find it again. Basically fox has reduced all of us to the lowest common denominator of sql.

Which is fine.

But seriously don't kill yourself trying to use the phpfox database library unless you are doing exactly what fox has anticipated.

Compound queries or offbeat constructs require PDO.

Many hours lost here.

It is not the case that you can send arbitrary queries to the database.
April 24, 2014 7:33 pm
Thanks data66 very much for the helpful guide!

Actually I want to disable the core profile feed and create a block that show feed belongs to an user (integrated with third party module). It is very difficult for me to do this. I will follow by your guide and try to do something.
April 21, 2014 4:00 pm
TextCrawler is an excellent tool for doing this. I renamed one of the core modules on my site without any problems.

http://www.digitalvolcano.co.uk/textcrawler.html

As always it is best to back up your original files and SQL.



Quote:
Originally posted by: Ryan Paiva

You'll need to rename the module id throughout the product. A mass search and replace sometimes does the trick but it can be quite time consuming to fully test.
April 15, 2014 1:07 am
Moved to proper forum section. In the Support menu you will find the developer api, the knowledgebase, and the app documentation. Each of these can be useful for what you want to do. A link to the table of contents is in my signature for the knowledgebase to make that easier to find things also.
April 5, 2014 2:23 pm
So, we create a php file and place it in the Fox directory then use the http://www.phpfox.com/addons/view/cronjob-manager/ to run it ?
Quote:
$iAgeInDays = 200;
$iTime = (Phpfox::getTime() - ($iAgeInDays * CRON_ONE_DAY));
$aCommentsToDelete = Phpfox::getLib('phpfox.database')->select('comment_id')
->from(Phpfox::getT('comment'))
->where('time_stamp < ' . $iTime)
->execute('getSlaveRows');
foreach ($aCommentsToDelete as $aComment)
{
if (isset($aComment['comment_id']))
{
Phpfox::getLib('phpfox.database')->delete(Phpfox::getT('comment'), 'comment_id = ' . (int)$aComment
['comment_id']);
Phpfox::getLib('phpfox.database')->delete(Phpfox::getT('comment_text'), 'comment_id = ' .
(int)$aComment['comment_id']);
Phpfox::getLib('phpfox.database')->delete(Phpfox::getT('comment_rating'), 'comment_id = ' .
(int)$aComment['comment_id']);
}
}
March 31, 2014 8:09 pm
Any server processing should be done within a service file. Create a file module/myevents/include/service/myevents.class.php with coding like:
PHP:
<?php
/**
 * [PHPFOX_HEADER]
 */

defined('PHPFOX') or exit('NO DICE!');

/**
 * 
 * 
 * @copyright        
 * @author          
 * @package          
 * @version         
 */
class Myevents_Service_Myevents extends Phpfox_Service
{
    public function 
compareDates($iDate)
    {
        
$iStoredDate $this->database()->select('mydatecolumn')
            ->
from(Phpfox::getT('myevents'))
            ->
where('user_id = ' . (int) Phpfox::getUserId())
            ->
execute('getSlaveField');

        
$bResult $iDate $iStoredDate true false;
        
$return $bResult;
    }
}    
?>


Then you can process it when it gets to the ajax file like:

PHP:
public function getDate()
    {
        
$todayJS $this->get('today');

        
$bResult Phpfox::getService('myevent')->compareDates($todayJS);

    
//Any other php code you need can be put here.

    


Again, this is just an example of a way to do this. Your circumstances might warrant a different approach.
March 25, 2014 9:26 pm