diff --git a/conditional_flags.module b/conditional_flags.module
index 1a7cff9..127ac34 100644
--- a/conditional_flags.module
+++ b/conditional_flags.module
@@ -17,7 +17,7 @@ function conditional_flags_get($name) {
       $conditions = $cache->data;
     }
   }
-  
+
   // Get from hook_conditional_flags_conditions().
   if (empty($conditions)) {
     $conditions_hook = 'conditional_flags_conditions';
@@ -47,23 +47,37 @@ function conditional_flags_flag_alter(&$flag) {
 }
 
 /**
- * Implements hook_flag().
- * 
+ * Implements hook_flag_flag().
+ *
  * Act on a flagging.
  */
-function conditional_flags_flag($op, $flag, $content_id, $account, $fcid) {
-  // dd(array($op, $flag, $content_id, $fcid));
-  
-  // Check if exist a conditions for the Flag
+function conditional_flags_flag_flag($flag, $entity_id, $account, $flagging) {
+  conditional_flags_flag('flag', $flag, $entity_id, $account, $flagging);
+}
+
+/**
+ * Implements hook_flag_unflag().
+ *
+ * Act on an unflagging.
+ */
+function conditional_flags_flag_unflag($flag, $entity_id, $account, $flagging) {
+  conditional_flags_flag('unflag', $flag, $entity_id, $account, $flagging);
+}
+
+/**
+ * Implements pseudo-hook_flag().
+ *
+ * hook_flag no longer exists, but we simulate and call it from the new hooks.
+ */
+function conditional_flags_flag($op, $flag, $entity_id, $account, $flagging) {
+  // Check if a flag condition exists.
   if (!empty($flag->conditions)) {
     foreach ($flag->conditions as $action => $reactions) {
-      
-      // Check if the action of the Flag is the $op action
+      // Check if the action of the flag is to flag.
       if ($action == $op && !empty($reactions)) {
         foreach ($reactions as $target_name => $target_action) {
-
-          // Execute the reactions for the action
-          flag($target_action, $target_name, $content_id, $account);
+          // Execute the reactions for the action.
+          flag($target_action, $target_name, $entity_id, $account);
         }
       }
     }
@@ -76,17 +90,17 @@ function conditional_flags_flag($op, $flag, $content_id, $account, $fcid) {
 function conditional_flags_preprocess_flag(&$vars, $hook) {
   // Avoid duplication of conditions on settings
   $conditional_flags = &drupal_static(__FUNCTION__, array());
-  
+
   if (!empty($vars['flag']->conditions) && empty($conditional_flags[$vars['flag']->name])) {
-    
+
     drupal_add_js(array(
       'FlagConditions' => array(
         $vars['flag']->name => $vars['flag']->conditions,
       ),
     ), 'setting');
-    
+
     $conditional_flags[$vars['flag']->name] = $vars['flag']->conditions;
-    
+
     drupal_add_js(drupal_get_path('module', 'conditional_flags') . '/js/conditional_flags.js');
   }
 
