Just discovered the 7.3.x series of Flag that is the current version of Flag that is actively developing at the moment. The module itself bring me the correct apply implementation to the two default flags that comes with Statuses and here there are.

$flags['like'] = array(
    'entity_type' => 'statuses',
    'title' => 'Like',
    'global' => '0',
    'types' =>
    array(
      0 => 'page',
    ),
    'flag_short' => 'Like',
    'flag_long' => '',
    'flag_message' => '',
    'unflag_short' => 'Un-like',
    'unflag_long' => '',
    'unflag_message' => '',
    'unflag_denied_text' => '',
    'link_type' => 'toggle',
    'weight' => 0,
    'show_on_page' => false,
    'show_on_teaser' => false,
    'show_on_form' => false,
    'status' => false,
    'locked' =>
    array(
      'name' => 'name',
      'global' => 'global',
      'types' => 'types',
      'show_on_teaser' => 'show_on_teaser',
      'show_on_form' => 'show_on_form',
      'status' => 'status',
    ),
    'module' => 'fbss_flag',
    'api_version' => 3,
    'import_roles' =>
    array(
      'flag' =>
      array(
        0 => '2',
      ),
      'unflag' =>
      array(
        0 => '2',
      ),
    ),
  );
$flags['follow'] = array(
    'entity_type' => 'user',
    'title' => 'Follow',
    'global' => '0',
    'types' =>
    array(
      0 => '-',
    ),
    'flag_short' => 'Follow',
    'flag_long' => '',
    'flag_message' => 'Following',
    'unflag_short' => 'Unfollow',
    'unflag_long' => '',
    'unflag_message' => '',
    'unflag_denied_text' => '',
    'link_type' => 'toggle',
    'weight' => 0,
    'show_on_profile' => 'true',
    'access_uid' => '',
    'show_on_page' => true,
    'show_on_teaser' => false,
    'show_on_form' => false,
    'status' => false,
    'locked' =>
    array(
      'name' => 'name',
      'global' => 'global',
      'types' => 'types',
      'show_on_teaser' => 'show_on_teaser',
      'show_on_form' => 'show_on_form',
      'status' => 'status',
    ),
    'module' => 'fbss_flag',
    'api_version' => 3,
    'import_roles' =>
    array(
      'flag' =>
      array(
        0 => '2',
      ),
      'unflag' =>
      array(
        0 => '2',
      ),
    ),
  );

I don't know if is a good aproach to detect the Flag API installed and then conditionally select the correct definition of flags. Anyway if someone needs just pasting the code on fbss_flag.module works for me.

Comments

eidoscom’s picture

Ooops!!!

Sorry, the "Follow" flag is working but not the Statuses one as seems to require to Status be an entity :S

eidoscom’s picture

I installed Flag 7.x.2-0 and the default flags doesn't work because of API changes I think...

eidoscom’s picture

New Flag implementations are focused on entities so I think is a must to Statuses become entities and has no sense to patch te fbss_flag module in order to work with the new versions of Flag. What you think?

eidoscom’s picture

Category: task » bug
eidoscom’s picture

In don't know how but flags are working with statuses and Flag 2.0 sorry for this weird issue :S

mathankumarc’s picture

Assigned: Unassigned » icecreamyou

Thanks for letting us know. I think flag changed a lot in 3.x

Holding on this until Statuses 2.x would be better.

Assigning to Isaac for getting inputs from him.

icecreamyou’s picture

Title: New Flag 7.3.x API » Support Flag 7x-.3.x
Assigned: icecreamyou » Unassigned
Category: bug » feature

My policy has always been that I will support the non-recommended versions of integrated modules as long as the recommended version is also supported. No reason to push this off to Statuses 2.x necessarily -- happy to accept patches -- but this shouldn't be a priority for Statuses maintainers relative to issues that actually block release of Statuses 7.x-1.0. (We can always get it in 1.1 or later though.) Additionally, I usually defer supporting new versions of modules until the API documentation catches up, although in this case we should be okay since the changes from Flag 2.x are documented in change requests.

Obviously this is assuming that no major API changes would be necessary for Flag 3.x support. (Making Statuses entities is probably not an API change because all it does is make some core functions work on statuses, but making Statuses fieldable would definitely need to wait for Statuses 2.x if we decide to do that. If we do make Statuses entities we should address that separately.)

@eidoscom: in the future, if you need to paste a lot of text into an issue (e.g. an export) please attach it in a text file to make it easier to scroll down the issue and read responses. Thanks.

icecreamyou’s picture

Title: Support Flag 7x-.3.x » Support Flag 7.x-3.x

[title]

eidoscom’s picture

@eidoscom: in the future, if you need to paste a lot of text into an issue (e.g. an export) please attach it in a text file to make it easier to scroll down the issue and read responses. Thanks.

Ok I will take in account ;)

lifeinpoetry’s picture

StatusFileSize
new4.25 KB

I've created a patch but it doesn't work with Rules because what is flagged in Flags 7.3.x needs to be an entity to be added to Rules by Flags and even when I worked around that there were issues with statuses not being an entity in Rules since Rules relies on the Entity API. I couldn't get tokens working at all and I tracked down where flagged_statuses was being changed into something unusable (an array instead of the status sid) and couldn't figure out a way beyond it.

I managed to get it to work on my configuration by making statuses an entity through a separate custom module but that seems to be beyond the scope of the current Statuses 7.1.x.

Also, hook_link seems to have been removed in Drupal 7 so flags weren't showing up for me without using fbss_flag_statuses_link() but I'm not certain if this is an issue with people using an earlier version of Flags so I didn't touch it. Could open an issue and put in a separate patch, if necessary.

icecreamyou’s picture

@lifeinpoetry: Thanks for the patch. There is some initial work on statuses-as-entities here.

Unfortunately I have been really busy lately and have not had time to work on Statuses in a few weeks. It may be awhile until I can review this patch, although maybe mathankumarc will be able to take a look. In the mean time, testers welcome. :)

flags weren't showing up for me without using fbss_flag_statuses_link() but I'm not certain if this is an issue with people using an earlier version of Flags so I didn't touch it.

The best way to handle this is to find a function that is in one branch of the module and not the other, and use that to test which version is being run.

icecreamyou’s picture

Status: Active » Needs review
mathankumarc’s picture

Thanks for the awesome work :)

I think its better to postpone this until we have 2.x branch in place with statuses as an entity.

I'm yet to look into the changes made in Flag 3.x

I'm eager to work on converting statuses as entity, however as Isaac mentioned in earlier issues having a stable branch would be the high priority as of now.

I managed to get it to work on my configuration by making statuses an entity through a separate custom module but that seems to be beyond the scope of the current Statuses 7.1.x.

@lifeinpoetry could you please upload those files in a new issue, that will help us in the progress.

adamtong’s picture

Hi, maybe i should not ask this question as i know you are very busy in daily life. However, could you kindly just give me a rough roadmap for the 2.x branch?

As i am really looking forward to the great 2.x branch. But at the moment, I would like to decide whether I use the 1.x branch in development first OR just wait for the 2.x branch if no need to wait too long.

As I think there may not be upgrade path for 1.x to 2.x, right?

Thank you very much!!!

adamtong’s picture

I have tested the above patch #10. It doesn't work for "fbss_comment". It shows the following error when edit:

The module providing this flag wasn't found, or this flag type, fbss_comment, isn't valid.

Also, there will be no "role" assigned to the flag for both statuses and fbss_comment flags.

Also, the "follow" flag also has problem. The Views of "statuses_followed" will not show followed users' status.

For status flag, I cannot choose any "Flaggable types" so I cannot save the flag successfully.

I have tried to apply the patch of "https://drupal.org/node/1311468#comment-5619252" to make the status to entity. However, it still not working.

Thank you.

icecreamyou’s picture

I don't think this needs to wait for the 2.x branch. I don't know if there will be a 2.x branch given the rate of development lately.

mathankumarc’s picture

I don't know if there will be a 2.x branch given the rate of development lately.

I'm really feel bad to hear this, however I accept the fact that the development rate is very low as of now. Lets try to find out the solution.

When we had a Drupal meetup in our City, I got to know that lot of peoples are using our module(both FBSS and Statuses) and they waiting for the Statuses 2.x branch(Sad thing is none of them contributing to the module), So the development will help lot of people.

Let me know your thoughts on this.

adamtong’s picture

I also really looking forward to the 2.x Branch too.

icecreamyou’s picture

Posted my thoughts in #1311468: Thoughts on 7.x-2.x

fruitsalad’s picture

Hi all,

just wanted to ask if there is a solution for this problem? I took the code from the updated flags and put it into the module files but the above error still occurs.

thank you all for your help.

jweirather’s picture

Following up just to clarify:

  • Flag 7.x-3.x requires entities, and Statuses 7.x-1.x are not entities, so Statuses 7.x-1.x won't work with Flag 7.x-3.x
  • If Statuses 7.x-2.x comes to be, then statuses will be entities, and will likely have support/integration with Flag 7.x-3.x
  • But for now, if we want to use Flags with Statuses, we need to use Flag 7.x-2.x, and the instructions provided here: https://www.drupal.org/node/1135266

Is that about right?

apoc1’s picture

So, I followed the instructions in the module and pasted the update code, found on admin/structure/flags/manage/like/update into fbss_flag.module inside the fbss_flag_flag_default_flags() function. When I did so, on the flag overview page, the flag became enableable, but when I click on enable I get this message:

"The module providing this flag wasn't found, or this flag type, statuses, isn't valid."

I use flag 7.x-3.6 and statuses flag 7.x-1.0-beta2.

What am I doing wrong?

Gaurav.Singh’s picture

I have the same issue, "The module providing this flag wasn't found, or this flag type, statuses, isn't valid." also after applying patch
https://www.drupal.org/files/statuses-add-flag-3-support-1787930.patch
if I enable like, everything starts to work..but with an issue.. every status starts repeating multiple times as soon I flag it.

Help me out on this.

Regards

madhavimalgaonkar’s picture

I have the same issue, "The module providing this flag wasn't found, or this flag type, statuses, isn't valid." After applying patch
https://www.drupal.org/files/statuses-add-flag-3-support-1787930.patch it works absolutely fine.
Thank You