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.
In the function vud_user_votes()
use the function argument passed by the menu handler instead of arg(1)
Change from:
function vud_user_votes() {
if ($account = user_load(array('uid' => arg(1), 'status' => 1))) {
to:
function vud_user_votes($account) {
if(!is_object($account)) $account = user_load(array('uid' => arg(1), 'status' => 1));
if ($account) {
This change will avoid the use of arg(1) and will make it compatibility with the me module #925882: user/me/votes not mapped to user/[uid]/votes
Comment | File | Size | Author |
---|---|---|---|
#3 | 0001-Issue-1024138-by-nohup-marvil07-Namespace-the-user-v.patch | 3.9 KB | marvil07 |
#1 | vote_up_down-1024138-1.patch | 554 bytes | nohup |
Comments
Comment #1
nohup CreditAttribution: nohup commentedpatch for vud.module attached
Comment #2
marvil07 CreditAttribution: marvil07 commentedI see what you mean.
But the real problem is that we are using "votes" string as we are the only module handling votes :-p
So, I would be glad to commit a patch that provides a better menu path, namespacing it.
I mean, changing:
$items['user/%user/votes']
with$items['user/%user/vote_up_down/votes'
.It is going to need a menu rebuilt on a
hook_update_N()
.Comment #3
marvil07 CreditAttribution: marvil07 commentedI changed a little the patch, and then pushed! (to 6.x-3.x and 6.x-2.x)
Thanks for reporting and providing the patch.
Comment #4
marvil07 CreditAttribution: marvil07 commentedI think 7.x can use this :-p
Comment #5
marvil07 CreditAttribution: marvil07 commentedMaybe is better to drop that feature for 7.x, I just realized that it's vud_node specific, so it should live there. Anyway, moving to old state.