3

By default, it just available to flag or unflag an item, reference here. I want to add a link to unflag all flagged node of current user, is there any way to do that?

At this moment, I get the code to clean all flagged node, but I don't know how to make this snippet as a link

db_query("DELETE FROM {flag_content} WHERE sid = %d", flag_get_sid());
2

Create a custom module that implements hook_menu(). Use that to create a path and a custom callback function that will run your query. Something like:

/**
 * Implementation of hook_menu()
 */
function MYMODULE_menu() {
  $items = array();

  $items['flags/remove/%user'] = array(
    'page callback' => 'MYMODULE_remove_flags',
    'page arguments' => array(2),
    'access callback' => 'MYMODULE_check_access',
    'access arguments' => array(2),
    'type' => MENU_CALLBACK,
  );

  return $items;
}

// Adding custom functions, etc

To get started on creating a custom module, the Module developer's guide

1

I used this workaround to implement an "unflag spam" feature. Basically, I created a second (global) flag "no spam" that moderators can use in a few to now show nodes that have been flagged for spam.

Screenshots (right click and open in new window for full size): view that shows content flagged for spam

flag_spam counter settings: spam flag

flag_nospam setting flag_nospam setting

The "flag link" fields will set the "nospam" flag to suppress those nodes from the view. I didn't see a choice for which flag the flag links applies to. I assume you'll have to add the "flag_spam counter" relationship.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.