You are here

function joomla_myblog_set_map in Joomla to Drupal 6

Same name and namespace in other branches
  1. 7.2 joomla_myblog.module \joomla_myblog_set_map()
  2. 7 joomla_myblog.module \joomla_myblog_set_map()
1 call to joomla_myblog_set_map()
joomla_myblog_map_form_submit in ./joomla_myblog.module

File

./joomla_myblog.module, line 111

Code

function joomla_myblog_set_map($myblogcategoryid, $tid) {
  $map = db_fetch_object(db_query('SELECT * FROM {joomla_myblog_categories} WHERE myblogcategoryid = %d', $myblogcategoryid));
  if ($map) {
    if ($map->tid == $tid) {

      // Mapping does not need updating
      return NULL;
    }

    // Update the existing mapping
    $map->tid = $tid;
    return drupal_write_record('joomla_myblog_categories', $map, 'myblogcategoryid');
  }
  $map = new stdClass();
  $map->myblogcategoryid = $myblogcategoryid;
  $map->tid = $tid;

  // Create a new mapping
  return drupal_write_record('joomla_myblog_categories', $map);
}