In my example I have a search api index of content type. if I add flags related to that content type, and display them in a view, everything works fine.

The problem however is if I add a related flag to the index, such as the flags associated to the user who created the content, the user flags don’t function within views.

Comments

destinationsound created an issue. See original summary.

matio89’s picture

Component: Code » User interface
Category: Bug report » Support request
Priority: Major » Normal
Status: Active » Needs review

Hi @destinationsound,

This is not related to an issue in the module and I think that is related to missing configurations in your site.

Here are all necessary steps to use flags as content datasource (using Flag Search API) in the view and show content flags depends on the author of the content created:

1/ You should check Reindex Item on Flagged action in /admin/config/search/flag-search-api ( enable flag in Search API).
2/ You should have / create a new flag type ( via /admin/structure/flags/add) and choose content as flag type.
3/ You should go to the your content index (in /admin/config/search/search-api) -> Tab processors, make sure that Flag indexing is checked and Processor settings -> Enable these flags on this index -> make sure that your flag type content is enabled.
4/ You should return back to the Tab Fields of your "content" Index and add field Authored by of the content ( and that's maybe the trick), save changes and reindex your content index.
5/ When you create your page/block view which uses your "content index" as a source, in the contextual filter, you'll find Content datasource: Authored by available -> provide default value, choose User ID from logged in user.

Note that you should not forget to give flag/unflag permissions for roles who can create content and have the possibility to flag and unflag their content. ( and that's maybe also the trick).

tamerzg’s picture

Status: Needs review » Fixed
ws.agency’s picture

Status: Fixed » Reviewed & tested by the community
ws.agency’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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