Cron task update table

It would be possible to make this SQL query periodically??
update Profiles
set Avatar=NEW_ITEM_2

thx

Quote · 19 May 2016

There is a Dolphin cron table that holds cron jobs for Dolphin; you would add to that table as well as adding the function that performs the update.  I suggest studying that table and the functions to see how it is done.

Geeks, making the world a better place
Quote · 19 May 2016

Of course you can do it outside of Dolphin as well by adding the script to run  and creating a cron job on the server.

Geeks, making the world a better place
Quote · 19 May 2016

I do not know mysql.

My hosting provider tells me to look me expert that generates me the file, so they can add the cron job.

Quote · 19 May 2016

To give a detailed answer requires detailed information.  Exactly what are you wanting to accomplish?  What is NEW_ITEM_2?  Will you be using the avatar module or using photo thumbs?  Dolphin handles the icon differently; you have to know about how they are stored on the server, etc.

Geeks, making the world a better place
Quote · 19 May 2016

Thank you very much. I 'm adapting the script arrowchat to my dolphin. The NEW_ITEM_2 field is a field that I gather with user registration . Arrowchat take the Avatar keeps the information from the field Profiles table in a variable. Then,This variable that I use it to show another image in chat . I do not use the Avatar module.

Quote · 19 May 2016

Originally you basically wanted to set the data in the Avatar field equal to NEW_ITEM_2; Now you want to set the Avatar field equal to the NEW_ITEM_2 field; for one, both fields need to be of the same type.  See, details are important.

 

I suggest posting a job for this arrowchat integration; I may be interested in the job.

Geeks, making the world a better place
Quote · 19 May 2016

they are the same type, there is no problem,

Quote · 19 May 2016

The integration of arrowchat with dolphin does not work properly with photo thumbnail profile.

Instead of displaying the avatar image I want to show an image that depends on NEW_ITEM_2 .


Actually I 've already got , but I need to be updated periodically.

arrow.png · 133.9K · 251 views
Quote · 19 May 2016

OK, I think I understand. Arrow Chat is coded to use the avatar from Dolphin but you want it to use photo icon instead.  Avatar uses a number that corresponds to the image stored in the avatar module.  Would it be better to change Arrow Chat to use photo icon?  If not, then you will need to store a user icon in the avatar module and store the number in the avatar field so that when Arrow chat looks up the avatar it will find it.  By the way, there are two avatar images, the regular size and a smaller one.

Geeks, making the world a better place
Quote · 19 May 2016

The variable that stores the number of the avatar is $image.

But I can not find where is defined to change .

 

 

arrowchat/includes/integration.php

/**

* This function returns the URL of the avatar of the specified user ID.

*

* @param userid the user ID of the user

* @param image if the image includes more than just a user ID, this param is passed

* in from the avatar row in the buddylist and get user details functions.

* @return the link of the user ID's profile

*/

function get_avatar($image, $user_id) 

{

global $base_url;

 

if (is_file(dirname(dirname(dirname(__FILE__))) . '/modules/boonex/avatar/data/images/' . $image . '.jpg')) 

{

return $base_url . '../modules/boonex/avatar/data/images/' . $image . '.jpg';

else 

{

return $base_url . AC_FOLDER_ADMIN . "/images/img-no-avatar.gif";

}

}

 

Quote · 20 May 2016

Continuing the cron task . Is this correct serious file to add to the table sys_cron_jobs ?


<?php

 

require_once( BX_DIRECTORY_PATH_INC . 'db.inc.php' );

require_once('BxDolCron.php');

 

class BxDolCronAvatar extends BxDolCron

{

 db_res("UPDATE `Profiles` SET `Avatar`=`NEW_ITEM_2`");

 

}

Quote · 20 May 2016

I would do it that way ...

Add a file named "BxAvaCron.php" to folder "/modules/boonex/avatar/classes" and insert the following code there.

<?php
bx_import('BxDolCron');

class BxAvaCron extends BxDolCron
{
    var $_oModule;

    /**
     *
     */
    function BxAvaCron()
    {
        parent::BxDolCron();
        $this->_oModule = BxDolModule::getInstance('BxAvaModule');
    }

    /**
     * update the avatar references
     */
    function processing()
    {
        $this->_oModule->_oDb->manipulateAllAvatarReferences();
    }
}


Edit the file "BxAvaDb.php" in the same folder and add the following function to the bottom of the file BEFORE the last "}"

function manipulateAllAvatarReferences() {
    return $this->query("UPDATE `Profiles` SET `Avatar`='NEW_ITEM_2' WHERE 1");
}


After that you can execute the following SQL via PHPMyAdmin in the correct DB

INSERT INTO `sys_cron_jobs` ( `name`, `time`, `class`, `file`, `eval`) VALUES
('BxAva', '* * * * *', 'BxAvaCron', 'modules/boonex/avatar/classes/BxAvaCron.php', '');
http://www.boonex.com/market/posts/paansystems - your resource for Dolphin Pro
Quote · 20 May 2016

thank you very much. How often is the runs ?

Quote · 20 May 2016

Every minute in this example ...

http://www.boonex.com/market/posts/paansystems - your resource for Dolphin Pro
Quote · 25 May 2016
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.