You are here

function plus1_update_6201 in Plus 1 6.2

Implements hook_update_N(). Set weight within a normal delta. No content types by default.

File

./plus1.install, line 68
A simple +1 voting widget module.

Code

function plus1_update_6201() {
  $ret = array();
  $w = variable_get('plus1_weight', 'not set');
  if ($w != 'not set') {
    $w = (int) $w;
    $x = $w > 20 ? 20 : ($w < -20 ? -20 : $w);
    if ($x != $w) {
      variable_set('plus1_weight', $x);
      $ret[] = array(
        'success' => TRUE,
        'query' => "Widget weight changed to {$x}.",
      );
    }
  }
  $t = variable_get('plus1_nodetypes', array());
  if (!$t) {
    variable_get('plus1_nodetypes', array(
      'story',
    ));
    $ret[] = array(
      'success' => TRUE,
      'query' => 'Voting enabled for "story."',
    );
  }
  return $ret;
}