Missing argument 3 for flag_page()

tobiberlin - November 2, 2009 - 08:40
Project:Flag
Version:6.x-1.1
Component:Flag core
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi,

I wanted to create a link to flag a user. The link should have been shown in a panel used to view user-profiles. I added a content pane using the function

<?php print flag_create_link('fools', $account->uid); ?>

Everything works fine so far but when I click on the link and the page is refreshed the message appears:

warning: Missing argument 3 for flag_page() in /srv/www/vhosts/mysite/httpdocs/sites/all/modules/flag/flag.module on line 837.

I had a look on the generated link and for me it looks as if it is not generated well (tutor is the name of the flag):

http://MYSITE/flag/flag/tutor/?destination=user%2F34&token=54bbc4864e5d9af05f4874c93a51885d

The same issue appears when I use a block including this function. Any ideas?

Greez,
Tobias

#1

tobiberlin - November 2, 2009 - 09:05

I have to add that it seems that a user clicking on this link flags himself - and not the user shown on the page! After flagging the unflag-link appears with every user profile the current user visits.

And the function above is not right - I changed the flag "fools" to "tutor". Sorry for this mistake.

#2

quicksketch - November 2, 2009 - 23:43

It sounds like you're probably passing an invalid value to flag_create_link(). Are you sure that $account->uid has a value? The ID of the account to flag is missing from the URL, which is causing those errors.

#3

tobiberlin - November 3, 2009 - 11:25
Status:active» fixed

Thank you for this tipp - that helped me. I used a function to get the argument from a view so this was not the right function to get the argument from panels. So this was my sollution: http://drupal.org/node/292734

I changed

<?php

global $base_url;
$uid = arg(1);
print
'<a href="' . $base_url . '/detailed_bio/' . arg(1) . '">More</a>';

?>

to

<?php

print flag_create_link('tutor', arg(1));
?>

This works fine for me

#4

System Message - November 17, 2009 - 11:30
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.