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

Files: 
CommentFileSizeAuthor
#3 0001-Issue-1024138-by-nohup-marvil07-Namespace-the-user-v.patch3.9 KBmarvil07
#1 vote_up_down-1024138-1.patch554 bytesnohup
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch vote_up_down-1024138-1.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots. View

Comments

nohup’s picture

Status: Active » Needs review
FileSize
554 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch vote_up_down-1024138-1.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots. View

patch for vud.module attached

marvil07’s picture

Title: Use function argument instead of arg » Namespace the user votes tab
Status: Needs review » Needs work
Issue tags: +interoperability

I 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().

marvil07’s picture

Title: Namespace the user votes tab » Namespace the user votes tab and move access check to access callback
Status: Needs work » Fixed
FileSize
3.9 KB

I 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.

marvil07’s picture

Version: 6.x-3.x-dev » 7.x-1.x-dev
Status: Fixed » Patch (to be ported)

I think 7.x can use this :-p

marvil07’s picture

Version: 7.x-1.x-dev » 6.x-3.x-dev
Status: Patch (to be ported) » Fixed

Maybe 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.

Status: Fixed » Closed (fixed)
Issue tags: -interoperability

Automatically closed -- issue fixed for 2 weeks with no activity.