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.
Hello,
i love this great module. :)
I have one, maybe minor, problem.
I want to place the flag link in a block on the right sidebar.
At first i read this guide:
http://drupal.org/node/295383
an so i thought i create a block with PHP but in did'nt work out.
When i put the link into the node-[content-type].tpl.php everything works fine, but i think it would be more flexible to put in into a block.
Has anyone an idea?
Stefan
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 CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: drupalreggie commentedComment #10
drupalreggie CreditAttribution: drupalreggie commentedgot the above code to work OK, I had to set the relationship with the flag up in views.
Comment #12
zilla CreditAttribution: zilla commentedany idea how to modify that code snippet above for D7 so that i don't get the php error?
Comment #13
maked1sky CreditAttribution: 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 CreditAttribution: 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) CreditAttribution: Anonymous as a volunteer 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