Currently have this module enabled on a forum to close topics, open topics and add tags such as [Resources] with the help of custom PHP code.

Now the flag module works fine as I need it to however, after a certain period, the buttons disappear which require me to restart the module by disabling and enabling it again.

Any possible reasons why this happens?

UPDATE: Sorry but I should have been more clear by what i mean by the buttons. (see attached image)

CommentFileSizeAuthor
#2 Capture.PNG2.12 KBbash247
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim’s picture

What do you mean by 'buttons'?

Have you tried clearing your caches?

> to close topics, open topics and add tags such as [Resources] with the help of custom PHP code.

It sounds like you're not actually flagging anything, you're just using Flag's UI. In which case, you'd be better off with https://drupal.org/project/fasttoggle.

bash247’s picture

Issue summary: View changes
FileSize
2.12 KB
joachim’s picture

Status: Active » Postponed (maintainer needs more info)

Sorry, I don't know what you're showing me. Are those views fields, or links on full entities, or something else?

Have you tried clearing your cache when it happens?

bash247’s picture

Clearing the cache doesn't solve my issue.

I am flagging nodes that trigger a certain action such as turning off commenting for a certain node and altering the title of a node.

I would also like to mention that I'm running the module in two different environments, A dev server where the module doesn't have this issue and a live server where the module is having problems. Could this possibly be server related?

bash247’s picture

Those are the "buttons" that are created by the flag module. They are links on full entities.

joachim’s picture

> I am flagging nodes that trigger a certain action such as turning off commenting for a certain node and altering the title of a node.

It really sounds like you're not actually using Flag for its intended purpose, but just the UI element.

bash247’s picture

>It really sounds like you're not actually using Flag for its intended purpose, but just the UI element.

It was the only module that got the result I needed. I'm using the api within a PHP snippet that adds relevant tags to a node title when an administrator selects one of flags/buttons shown in the image I uploaded earlier.

joachim’s picture

> I'm using the api within a PHP snippet that adds relevant tags to a node title when an administrator selects one of flags/buttons shown in the image I uploaded earlier.

Where's the PHP snippet?

bash247’s picture

>Where's the PHP snippet?

The PHP snippet is located within a view field. It's excluded from display and then is added to the Title fields as a rewrite rule. This then displays the relevant tag to the title. Below is the PHP code.

<?php 
$flag_solved = flag_get_flag('solved');
$flag_resource = flag_get_flag('resource');
$flag_close= flag_get_flag('close');
if ($flag_solved->is_flagged($row->nid))
{
  print '[Solved]';
}
if ($flag_resource->is_flagged($row->nid))
{
  print '[Resource]';
}
if ($flag_close->is_flagged($row->nid))
{
  print '[Closed]';
}
?>