Hi,
I ask kindly a new Feature.

I would like to hide the +1 button if node is not published.
this feature is required for +1 button inside node content.

The same feature is presents in fb_social module and it is not really important.. but it is really comfortable when you are working at a new content andwatch node preview or save it without publish.

Could it be implemented?

Thank you for all.

Comments

corbacho’s picture

Yes, it has a lot of sense, thanks for your collaboration lately ;)

tony barnes’s picture

I've just added this to ours - works like the FB button now.

Open /modules/google_plusone/google_plusone.admin.inc

Find:

  $form['display']['google_plusone_node_location'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Display the button in these view modes:'),
    '#options' => $locations + array('links' => t('Node links')),
    '#default_value' => variable_get('google_plusone_node_location', array('full')),
  );

afterwards add:

  $form['google_plusone_node_ids'] = array(
    '#type' => 'textfield',
    '#title' => t('Don\'t Display the +1 button on these nodes'),
    '#default_value' => variable_get('google_plusone_node_ids', ''),
    '#description' => t('This nodes will not have the "+1" button automatically added to them.').'<br />'.
                      '<b>'.t('USE \',\' BETWEEN NODES NUMBERS. EX: 12345,21312, ').'</b>',
  );

Open google_plusone.module

Find:

  // Wrap it and serve it
  if ($variables['css'] !== 'nowrapper') {
    $css = empty($variables['css']) ? '' : 'style="' . check_plain($variables['css']) . '"';
    $button = '<div class="g-plusone-wrapper" ' . $css . '>' . $button . '</div>';
  }

after add:

//get the array with the nodes from where the like button will be excluded
$sNodesNotShow = variable_get('fblikebutton_node_ids', '');
$aNodesNotShow = explode(',',$sNodesNotShow);

if (in_array($node->nid, $aNodesNotShow)) {
         $button="";
}

It now works just like the FB button, and you can ban it on whatever pages you like.