1

I am brand new to Drupal but not to OOPHP. I am assuming responsibility for a site which uses Up/Down Vote 6.x.

The issue is that the posts are very long and hold many many images and it doesn't look like the module supports any widget position other than at the top of <div class="content">.

I would like to move it to just above the footer links of the node, after the content.

I have been googling this without success. Can anyone advise me or direct me to the relevent docs?

0

1 Answer 1

1

Widget is getting displayed using hook_node_view code in vud_node.module...

/**
 * Implementation of hook_node_view().
 */
function vud_node_node_view($node, $view_mode, $langcode) {
  // avoid showing the widget in some node builds
  $exclude_modes = array(
    NODE_BUILD_PREVIEW,
    NODE_BUILD_SEARCH_INDEX,
    NODE_BUILD_SEARCH_RESULT,
    NODE_BUILD_RSS,
  );
  if (in_array($node->build_mode, $exclude_modes)) {
    break;
  }
  if (($can_edit=user_access('use vote up/down on nodes')) || user_access('view vote up/down count on nodes')) {
    $node_type = in_array($node->type, variable_get('vud_node_types', array()), TRUE);
    $widget_showmode = variable_get('vud_node_widget_show', VUD_NODE_DISPLAY_BOTH);
    $tag = variable_get('vud_tag', 'vote');
    $widget = variable_get('vud_node_widget', 'plain');
    $vote_on_teaser = (bool)variable_get('vud_node_widget_vote_on_teaser', TRUE);
    $teaser = $a3;

    $widget_message_code = VUD_WIDGET_MESSAGE_ERROR;
    if (!$can_edit) {
      $widget_message_code = VUD_WIDGET_MESSAGE_DENIED;
    }
    elseif (!$vote_on_teaser) {
      $widget_message_code = VUD_NODE_WIDGET_MESSAGE_TEASER_DENIED;
    }

    if ($node_type) {

      switch ($widget_showmode) {
        case VUD_NODE_DISPLAY_TEASER_ONLY:
          if ($teaser == 1) {
            $node->content['vud_node_widget_display'] = array(
              '#value' => theme('vud_widget', $node->nid, 'node', $tag, $widget, !$vote_on_teaser || !$can_edit, $widget_message_code),
              '#weight' => -10,
            );
          }
          break;
        case VUD_NODE_DISPLAY_FULL_ONLY:
          if ($teaser == 0) {
            $node->content['vud_node_widget_display'] = array(
              '#value' => theme('vud_widget', $node->nid, 'node', $tag, $widget, !$can_edit, $widget_message_code),
              '#weight' => -10,
            );
          }
          break;
        case VUD_NODE_DISPLAY_BOTH:
          if ($teaser == 1) {
            $readonly = !$vote_on_teaser || !$can_edit;
          }
          else {
            $readonly = !$can_edit;
          }
          $node->content['vud_node_widget_display'] = array(
            '#value' => theme('vud_widget', $node->nid, 'node', $tag, $widget, $readonly, $widget_message_code),
            '#weight' => -10,
          );
          break;
      }

    }
  }
}

Implement hook_node_view_alter in your custom module and change the weight to higher value so that it will be displayed at bottom...

In Drupal modules extends permissions by defining them using hook_permission.. You can find list of permissions in "admin/people/permissions" ..

For vote up / down set permissions in above page.. See screenshot below..

enter image description here

7
  • 1
    Thank you! Will do now. On a separate issue users are reporting that only Admin can see the voting widget. The config does not have settings pertaining to that. Any thoughts? Perhaps I should post as new question. Commented Apr 22, 2014 at 5:36
  • 1
    See updated answer for permissions issue..
    – Anil Sagar
    Commented Apr 22, 2014 at 5:41
  • Thank you very much! I appreciate your help! My config does not show this setting. I have posted a new question with screenshots of config tabs and modules here drupal.stackexchange.com/questions/110864/… I sure would appreciate it if you would take a look! Commented Apr 22, 2014 at 13:15
  • Turns out I needed to administer user permissions in /admin/users/permissions Commented Apr 22, 2014 at 14:22
  • 1
    Looks like this is implemented in vud_node_nodeapi in vud_node.module in this version Commented Apr 22, 2014 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.