Closed (fixed)
Project:
Flag
Version:
6.x-2.0-beta6
Component:
Flag core
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
20 Aug 2009 at 09:37 UTC
Updated:
28 Jul 2017 at 02:55 UTC
Jump to comment: Most recent
Comments
Comment #1
quicksketchIf you're putting code in a block, the $node variable does not exist, so you need to load it manually first.
I'm going to go ahead and mark this fixed since it's been 3 weeks since the issue was filed. Please reopen if you have further questions on this.
Comment #3
rami.sedhom commentedI'm not sure if I should report this as new issue or report it here since it's related to the same topic.
Anyway, I have tried to place flag in a block using the below code:
The block is working fine in FireFox in all ways but not working in IE7 when flag link type is "JavaScript toggle". The Flag text is being printed but not linked to anything. Any ideas how to resolve this?!
Comment #4
quicksketchThis probably isn't related to this issue unless the link only doesn't work when displayed in the block. You'll probably find that the link doesn't work anywhere, not just when it's displayed in the block. Check the page for JavaScript errors that may cause Flag's AJAX to fail.
Comment #5
quicksketchComment #6
rami.sedhom commentedSorry for late response but actually the link only doesn't work when displayed in the block. It's working fine when it's placed in links underneath the post and there's no javascript errors in the browser.
Comment #7
dercheffeFirst I want say "Thanks!" for this very useful module.
A few weeks ago, I started to port my major Drupal project to D7. Now I would need a block, in which I can display the different flags as a link list in my first sidebar. Can anybody help me, how I can solve my problem?
Will there be a block provided by the module in the near future?
Thanks for your replies :)
Cya,
dercheffe
Comment #8
drupalreggie commentedI'm using views to generate a block containing flag links relating to a node. I'm using the following code in a custom PHP field
But I do not see the flag text appear in the block...
Any suggestions?
Comment #9
drupalreggie commentedComment #10
drupalreggie commentedgot the above code to work OK, I had to set the relationship with the flag up in views.
Comment #12
zilla commentedany idea how to modify that code snippet above for D7 so that i don't get the php error?
Comment #13
maked1sky commentedFriends if you get ERROR 404 or php error after confirm flag at views php fileds check VAILABLE VARIABLES
at PHP fields.
For me it works fine:
Output code
print flag_create_link('price_payment', $data->nid);// price_payment - name of my flag, $data->nid instead of $node->nidComment #14
mikemoretti commentedActually, you already have the nid, it's arg(1). You don't even need to load the node. I used this code and it works like a charm:
Comment #15
Anonymous (not verified) commentedThis might be a bit late but will help someone for sure.
This is how to create a bookmark link in a block using views (Drupal 7 and 8):
Have fun