I'm not sure what the footer part of the nodes and comments is called, but it's labeled in the .css as "div.links ul.links".

I would like to see user2userpoints put the "give points" under each node/comment. It seems like an easy way to make the interface easier for the user.

It seems like a fairly easy thing to modify, but I have little knowledge of php and even less knowledge of the Drupal functions.

Comments

jredding’s picture

Project: User Points » User Points Contributed modules
Version: master » 5.x-2.x-dev
Component: User interface » Code: user2userpoints

properly classifying this over to the contributed modules

neomenlo’s picture

you know, if someone could just point me in the right direction of some good docs on how to add stuff to that footer thing i was talking about, i would be willing to do it.

Thing is, i cannot seem to find it. Either there are no docs for it, or I cannot think of what that footer is supposed to be called.

jredding’s picture

api.drupal.org is your friend

http://api.drupal.org/api/function/hook_footer/5
That's for the footer (which the title states)

Under the node..
http://api.drupal.org/api/function/hook_link/5

Good Luck!

neomenlo’s picture

Title: user2userpoints "give points" in footer of node/comments » user2userpoints "give points" in links footer
Assigned: Unassigned » neomenlo
Status: Active » Needs review
StatusFileSize
new1.23 KB

I have spent a very long time on this. My lack of php knowledge really made this difficult.

No matter what i do to the "if" I just can't seem to keep the "give points" from appearing at the bottom of the current user's post

This is all it took, but you wouldn't believe how long it took me.
Please let me know if you can figure out what in the world i did wrong to make the "give points" appear at the bottom of the current users posts too.

/* Give points at footer of nodes and comments */
function user2userpoints_link($type, $node = NULL, $teaser = FALSE) {
  $links = array();
  if ($node->uid != $user->uid && $node->type != 'page' && user_access(USER2USERPOINTS_PERM_SEND)) {
      $links['user2userpoints'] = array(
      'title'              => t('Give !points', userpoints_translation()), 
      'href'		   => 'user2userpoints/'. $node->name,
      'callback'           => 'drupal_get_form',
      'callback arguments' => array('user2userpoints_giveform'),
      'access'             => array(USER2USERPOINTS_PERM_SEND),
      );
  }
  return $links;
}

Important note! It was my choice to keep the "give points" from appearing on "PAGE" nodes. In my opinion, it really only belongs on community/dynamic nodes. Although, it should probably be up to the user.

jredding’s picture

I don't fully understand what you are attempting to do with your link array as it as callbacks and access. Its like a mix of hook_menu, FAPI and a links array.

/* Give points at footer of nodes and comments */
function user2userpoints_link($type, $node = NULL, $teaser = FALSE) {
  global $user; 
  $links = array();
  if ($node->uid != $user->uid && $node->type != 'page' && user_access(USER2USERPOINTS_PERM_SEND)) {
      $links['user2userpoints'] = array(
      'title'              => t('Give !points', userpoints_translation()),
      'href'    => 'user2userpoints/'. $node->name
      );
  }
  return $links;
}

if the URL user2userpoints/ ?
or is it
user2userpoints/ ?

I have no idea really just node name seems odd to me.

neomenlo’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.06 KB

That works so much better. Thanks so much!
I'm still learning. Honestly, I had no idea what I was doing either. I was just trying different things, looking at what other modules did, and looking at what that code did.

if the URL user2userpoints/ ?
or is it
user2userpoints/ ?

I do not understand the question.

This is really working very nicely now. That solved my frustrations in trying to get it to stop showing up at the bottom of the user's own posts. Clicking the "Give Points" link still fills in the users name.

The only thing that i think needs improvement is allowing the user to choose what node types to show it on. For the time being, I think it is safe to say that nobody will want it on "page".

berdir’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

Sorry for pinging the participants.

Now that Drupal 7 is out, there is no support for Drupal 5 and the
corresponding modules anymore. Therefore, I'm closing all old issues
which are still open.

I suggest you upgrade to Drupal 6 or 7 and figure out if you're feature
is still needed or the bug still exists and open a new issue in that
case.