Drupal custom module cron
Click here to download the final module. Click here to view the details of the module.
To write a module for it to integrate with the cron use the hook_cron drupal function.
There are three basic files in any standard drupal module.
modulename.install
modulename.info
modulename.info
Now the module which i had created is called admin_notification
So the three files are as follows
admin_notification.info
; $Id: admin_notification.install,v 1.1 2010/06/05 16:23:30 q0rban Exp $
name = Admin Notification
description = Sets a cron to send notification to the store email address(admin/store/settings/store/edit/contact) if order is not completed within 24hours before the delivery date
dependencies[] = uc_order
dependencies[] = uc_ddate
package = Ubercart – extra
core = 6.x
; Information added by drupal.org packaging script on 2009-08-28
version = “6.x-1.0-alpha1″
core = “6.x”
project = “admin_notification”
datestamp = “1251493563″
admin_notifications.install
<?php
// $Id: admin_notification.install,v 1.1 2010/06/05 16:23:30 q0rban Exp $
/**
* Implementation of hook_install().
*/
function admin_notification_install() {
drupal_install_schema(’admin_notification’);
}
/**
* Implementation of hook_uninstall().
*/
function admin_notification_uninstall() {
drupal_uninstall_schema(’admin_notification’);
}
admin_notification.module
<?php
// $Id: admin_notification.install,v 1.1 2010/06/05 16:23:30 q0rban Exp $
/**
* @file
* Sets a cron to send notification to the admin email order is not completed 24hours before the delivery date
*
* Built by Sumaiya Javed
* http://sumaiyajaved.com
*/
/**
* Implementation of hook_cron().
*/
function admin_notification_cron() {
// put your cron code in here
}
//Note there is no closing ?> php tags in the module file