Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
i tried to figure out, how to get just the username without linking to the profile. no success.
what i want, is to display a "Give Userpoints" link
Something like that <a href="user2userpoints/$USERS_PROFILE_NAME">Give Userpoints</a>
Michelle, may you tell me what to add in author_pane.module? May it be that the link disappears, when you are watching your own profile?
thank you!
Comments
Comment #1
MichelleThis is untested but something like:
Michelle
Comment #2
Witch CreditAttribution: Witch commentedGreat Michelle, i just had to add a slash
<a href="/user2userpoints/<?php print $account->name ?>
it works fine. thank you!!!!
Comment #3
MichelleOh, yep. I didn't look at your URL that close.
Michelle
Comment #5
dmetzcher CreditAttribution: dmetzcher commentedI'm so happy that I found this issue. I'd like to post my code below in case others might find it useful. Since, on my site, Userpoints equal money, I needed to remove the Userpoints on the Author Pane (Michelle already answered that question here: #370046: Userpoints on the Author Pane). Replacing it with a link that allows the visiting user to give points to the user whose Author Pane is being viewed was the next step.
In author-pane.tpl.php, I replaced...
with...
The new code above will display a link to "Give Userpoints" on the Author Pane if the user is viewing any Author Pane other than their own.
Note that the Userpoints Contrib package is required and the user2userpoints module (part of the Userpoints Contrib package) must be enabled and working.
Comment #6
MichelleYou might also want to check that $user->uid != 0.
Michelle
Comment #7
dmetzcher CreditAttribution: dmetzcher commentedNice catch, Michelle. Thanks. I've edited comment #5 above to include the code to check for anonymous users. :)
I also added a class (author-pane-line) so that it can be styled along with the other line items in the Author Pane.
Comment #8
mr.j CreditAttribution: mr.j commentedDon't forget to check for permission too:
if ($user->uid != $account->uid && $user->uid != 0 && user_access(USER2USERPOINTS_PERM_SEND)) {