Skip to main content
added 431 characters in body
Source Link
xurshid29
  • 2.5k
  • 15
  • 13

if I understand you correctly then you have somekind of users and one content type "Artist Page". That users must fill (create) a node of that Artist Page content type. but some users may skip this step. In that case you can do following I think:

  1. node table has a uid field (author of content).
  2. Fetch separately (as array) uids of node and users tables and compare them;
  3. Get difference of arrays and compare there created time with current time, if difference is reaches(notification time) then send them an email, if difference is reaches(deletion time) then delete them.... These operation can be done on cron job. I recommend Elysia cron module.

Example:

function MY_MODULE_cronapi($op, $job = NULL) {
  $items['my_custom_task'] = array(
    'description' => 'My custom task description',
    'rule' => '*/20 * * * *', // Example rule - execute job every 20 min
    'callback' => 'my_custom_task',
    'arguments' => array(),
  );

  return $items;
}


function my_custom_task() {
  $subquery = db_select('node', 'n');
  ->fields('n', array('uid'))
    ->condition('n.type', 'MY_TYPE', '=')
    ->execute()
    ->fetchCol();

  $uids = db_select('users', 'u')
    ->fields('u', array('uid', 'created'))
    ->condition('u.uid', $subquery, 'NOT IN');
  ->execute()
    ->fetchAll();

  if(!$uids) {
    foreach($uids as $key => $uid) {
      $user_id = $uids[$key]->uid;
      $user_created = $uids[$key]->created;

      $notif_time_min = time() + 60*60*24*7; // example
      $notif_time_max = time() + 60*60*24*8; // example

      $del_time = time() + 60*60*24*15; // example

      if((time() - $user_created > $notif_time_min) && (time() - $user_created < $notif_time_max)) {
        // send_email()
      }
      elseif(time() - $user_created > $del_time) {
        //del_user()
      }
    }
  }
}

//P.S: I'd recommend to modify the callback part of cronjob. You can have too many users and every time cron job queries the tables(users and node tables) for existence of left users; Good solution will be creating a custom module which holds somekind of flag, which verifies that user is valid or not, you can flag as unverified on registration and change to verified on creation on node. This can be achieved by Rules or Action or custom code...

if I understand you correctly then you have somekind of users and one content type "Artist Page". That users must fill (create) a node of that Artist Page content type. but some users may skip this step. In that case you can do following I think:

  1. node table has a uid field (author of content).
  2. Fetch separately (as array) uids of node and users tables and compare them;
  3. Get difference of arrays and compare there created time with current time, if difference is reaches(notification time) then send them an email, if difference is reaches(deletion time) then delete them.... These operation can be done on cron job. I recommend Elysia cron module.

Example:

function MY_MODULE_cronapi($op, $job = NULL) {
  $items['my_custom_task'] = array(
    'description' => 'My custom task description',
    'rule' => '*/20 * * * *', // Example rule - execute job every 20 min
    'callback' => 'my_custom_task',
    'arguments' => array(),
  );

  return $items;
}


function my_custom_task() {
  $subquery = db_select('node', 'n');
  ->fields('n', array('uid'))
    ->condition('n.type', 'MY_TYPE', '=')
    ->execute()
    ->fetchCol();

  $uids = db_select('users', 'u')
    ->fields('u', array('uid', 'created'))
    ->condition('u.uid', $subquery, 'NOT IN');
  ->execute()
    ->fetchAll();

  if(!$uids) {
    foreach($uids as $key => $uid) {
      $user_id = $uids[$key]->uid;
      $user_created = $uids[$key]->created;

      $notif_time_min = time() + 60*60*24*7; // example
      $notif_time_max = time() + 60*60*24*8; // example

      $del_time = time() + 60*60*24*15; // example

      if((time() - $user_created > $notif_time_min) && (time() - $user_created < $notif_time_max)) {
        // send_email()
      }
      elseif(time() - $user_created > $del_time) {
        //del_user()
      }
    }
  }
}

if I understand you correctly then you have somekind of users and one content type "Artist Page". That users must fill (create) a node of that Artist Page content type. but some users may skip this step. In that case you can do following I think:

  1. node table has a uid field (author of content).
  2. Fetch separately (as array) uids of node and users tables and compare them;
  3. Get difference of arrays and compare there created time with current time, if difference is reaches(notification time) then send them an email, if difference is reaches(deletion time) then delete them.... These operation can be done on cron job. I recommend Elysia cron module.

Example:

function MY_MODULE_cronapi($op, $job = NULL) {
  $items['my_custom_task'] = array(
    'description' => 'My custom task description',
    'rule' => '*/20 * * * *', // Example rule - execute job every 20 min
    'callback' => 'my_custom_task',
    'arguments' => array(),
  );

  return $items;
}


function my_custom_task() {
  $subquery = db_select('node', 'n');
  ->fields('n', array('uid'))
    ->condition('n.type', 'MY_TYPE', '=')
    ->execute()
    ->fetchCol();

  $uids = db_select('users', 'u')
    ->fields('u', array('uid', 'created'))
    ->condition('u.uid', $subquery, 'NOT IN');
  ->execute()
    ->fetchAll();

  if(!$uids) {
    foreach($uids as $key => $uid) {
      $user_id = $uids[$key]->uid;
      $user_created = $uids[$key]->created;

      $notif_time_min = time() + 60*60*24*7; // example
      $notif_time_max = time() + 60*60*24*8; // example

      $del_time = time() + 60*60*24*15; // example

      if((time() - $user_created > $notif_time_min) && (time() - $user_created < $notif_time_max)) {
        // send_email()
      }
      elseif(time() - $user_created > $del_time) {
        //del_user()
      }
    }
  }
}

//P.S: I'd recommend to modify the callback part of cronjob. You can have too many users and every time cron job queries the tables(users and node tables) for existence of left users; Good solution will be creating a custom module which holds somekind of flag, which verifies that user is valid or not, you can flag as unverified on registration and change to verified on creation on node. This can be achieved by Rules or Action or custom code...

added 4 characters in body
Source Link
xurshid29
  • 2.5k
  • 15
  • 13
  1. node table has a uid field (author of content).

    node table has a uid field (author of content).
  2. Fetch separately (as array) uids of node and users tables and compare them;

    Fetch separately (as array) uids of node and users tables and compare them;
  3. Get difference of arrays and compare there created time with current time, if difference is reaches(notification time) then send them an email, if difference is reaches(deletion time) then delete them.... These operation can be done on cron job. I recommend Elysia cron module. Example:

    function MY_MODULE_cronapi($op, $job = NULL) { $items['my_custom_task'] = array( 'description' => 'My custom task description', 'rule' => '*/20 * * * *', // Example rule - execute job every 20 min 'callback' => 'my_custom_task', 'arguments' => array(), );

    return $items; }

    function my_custom_task() { $subquery = db_select('node', 'n'); ->fields('n', array('uid')) ->condition('n.type', 'MY_TYPE', '=') ->execute() ->fetchCol();

    $uids = db_select('users', 'u') ->fields('u', array('uid', 'created')) ->condition('u.uid', $subquery, 'NOT IN'); ->execute() ->fetchAll();

    if(!$uids) { foreach($uids as $key => $uid) { $user_id = $uids[$key]->uid; $user_created = $uids[$key]->created;

      $notif_time_min = time() + 60*60*24*7; // example
      $notif_time_max = time() + 60*60*24*8; // example
    
      $del_time = time() + 60*60*24*15; // example
    
      if((time() - $user_created > $notif_time_min) && (time() - $user_created < $notif_time_max)) {
        // send_email()
      }
      elseif(time() - $user_created > $del_time) {
        //del_user()
      }
    }
    

    } }

    Get difference of arrays and compare there created time with current time, if difference is reaches(notification time) then send them an email, if difference is reaches(deletion time) then delete them.... These operation can be done on cron job. I recommend Elysia cron module.

Example:

function MY_MODULE_cronapi($op, $job = NULL) {
  $items['my_custom_task'] = array(
    'description' => 'My custom task description',
    'rule' => '*/20 * * * *', // Example rule - execute job every 20 min
    'callback' => 'my_custom_task',
    'arguments' => array(),
  );

  return $items;
}


function my_custom_task() {
  $subquery = db_select('node', 'n');
  ->fields('n', array('uid'))
    ->condition('n.type', 'MY_TYPE', '=')
    ->execute()
    ->fetchCol();

  $uids = db_select('users', 'u')
    ->fields('u', array('uid', 'created'))
    ->condition('u.uid', $subquery, 'NOT IN');
  ->execute()
    ->fetchAll();

  if(!$uids) {
    foreach($uids as $key => $uid) {
      $user_id = $uids[$key]->uid;
      $user_created = $uids[$key]->created;

      $notif_time_min = time() + 60*60*24*7; // example
      $notif_time_max = time() + 60*60*24*8; // example

      $del_time = time() + 60*60*24*15; // example

      if((time() - $user_created > $notif_time_min) && (time() - $user_created < $notif_time_max)) {
        // send_email()
      }
      elseif(time() - $user_created > $del_time) {
        //del_user()
      }
    }
  }
}
  1. node table has a uid field (author of content).

  2. Fetch separately (as array) uids of node and users tables and compare them;

  3. Get difference of arrays and compare there created time with current time, if difference is reaches(notification time) then send them an email, if difference is reaches(deletion time) then delete them.... These operation can be done on cron job. I recommend Elysia cron module. Example:

    function MY_MODULE_cronapi($op, $job = NULL) { $items['my_custom_task'] = array( 'description' => 'My custom task description', 'rule' => '*/20 * * * *', // Example rule - execute job every 20 min 'callback' => 'my_custom_task', 'arguments' => array(), );

    return $items; }

    function my_custom_task() { $subquery = db_select('node', 'n'); ->fields('n', array('uid')) ->condition('n.type', 'MY_TYPE', '=') ->execute() ->fetchCol();

    $uids = db_select('users', 'u') ->fields('u', array('uid', 'created')) ->condition('u.uid', $subquery, 'NOT IN'); ->execute() ->fetchAll();

    if(!$uids) { foreach($uids as $key => $uid) { $user_id = $uids[$key]->uid; $user_created = $uids[$key]->created;

      $notif_time_min = time() + 60*60*24*7; // example
      $notif_time_max = time() + 60*60*24*8; // example
    
      $del_time = time() + 60*60*24*15; // example
    
      if((time() - $user_created > $notif_time_min) && (time() - $user_created < $notif_time_max)) {
        // send_email()
      }
      elseif(time() - $user_created > $del_time) {
        //del_user()
      }
    }
    

    } }

  1. node table has a uid field (author of content).
  2. Fetch separately (as array) uids of node and users tables and compare them;
  3. Get difference of arrays and compare there created time with current time, if difference is reaches(notification time) then send them an email, if difference is reaches(deletion time) then delete them.... These operation can be done on cron job. I recommend Elysia cron module.

Example:

function MY_MODULE_cronapi($op, $job = NULL) {
  $items['my_custom_task'] = array(
    'description' => 'My custom task description',
    'rule' => '*/20 * * * *', // Example rule - execute job every 20 min
    'callback' => 'my_custom_task',
    'arguments' => array(),
  );

  return $items;
}


function my_custom_task() {
  $subquery = db_select('node', 'n');
  ->fields('n', array('uid'))
    ->condition('n.type', 'MY_TYPE', '=')
    ->execute()
    ->fetchCol();

  $uids = db_select('users', 'u')
    ->fields('u', array('uid', 'created'))
    ->condition('u.uid', $subquery, 'NOT IN');
  ->execute()
    ->fetchAll();

  if(!$uids) {
    foreach($uids as $key => $uid) {
      $user_id = $uids[$key]->uid;
      $user_created = $uids[$key]->created;

      $notif_time_min = time() + 60*60*24*7; // example
      $notif_time_max = time() + 60*60*24*8; // example

      $del_time = time() + 60*60*24*15; // example

      if((time() - $user_created > $notif_time_min) && (time() - $user_created < $notif_time_max)) {
        // send_email()
      }
      elseif(time() - $user_created > $del_time) {
        //del_user()
      }
    }
  }
}
Source Link
xurshid29
  • 2.5k
  • 15
  • 13

if I understand you correctly then you have somekind of users and one content type "Artist Page". That users must fill (create) a node of that Artist Page content type. but some users may skip this step. In that case you can do following I think:

  1. node table has a uid field (author of content).

  2. Fetch separately (as array) uids of node and users tables and compare them;

  3. Get difference of arrays and compare there created time with current time, if difference is reaches(notification time) then send them an email, if difference is reaches(deletion time) then delete them.... These operation can be done on cron job. I recommend Elysia cron module. Example:

    function MY_MODULE_cronapi($op, $job = NULL) { $items['my_custom_task'] = array( 'description' => 'My custom task description', 'rule' => '*/20 * * * *', // Example rule - execute job every 20 min 'callback' => 'my_custom_task', 'arguments' => array(), );

    return $items; }

    function my_custom_task() { $subquery = db_select('node', 'n'); ->fields('n', array('uid')) ->condition('n.type', 'MY_TYPE', '=') ->execute() ->fetchCol();

    $uids = db_select('users', 'u') ->fields('u', array('uid', 'created')) ->condition('u.uid', $subquery, 'NOT IN'); ->execute() ->fetchAll();

    if(!$uids) { foreach($uids as $key => $uid) { $user_id = $uids[$key]->uid; $user_created = $uids[$key]->created;

      $notif_time_min = time() + 60*60*24*7; // example
      $notif_time_max = time() + 60*60*24*8; // example
    
      $del_time = time() + 60*60*24*15; // example
    
      if((time() - $user_created > $notif_time_min) && (time() - $user_created < $notif_time_max)) {
        // send_email()
      }
      elseif(time() - $user_created > $del_time) {
        //del_user()
      }
    }
    

    } }