Flag Friend Add Friend Link with views. Flag friends shows a link to add friend in my account page but i want to display this link on in a field for a view.
views you have to go to
advanced setting and in
relationship you can add your flag.
After that you will be able to add your field.
If I understood you correctly you want to add flag link to the view (as a field).
- Install the Views PHP module and enable it. This will allow you to embed php into a view cell.
- Add a new nid/node id field to your View. Make sure to check the “Exclude from display” checkbox.
- Rearrange your fields so that your hidden nid field is at the top of all fields. This is important. It needs to be “available” as an element to the custom php field we are about to add, and if it’s after, the custom php field won’t see it.
- Add a new Global: PHP field. add the following code to the "Output Code" section of the field (in php):
<?php print flag_create_link("the_machine_name_of_your_flag", $row->nid); ?>
- Click the apply button