im having a hard time converting my rules to drupal 7 from my old drupal 6 site. this rule is working perfect on my old site with rules 6.x-1.4. Can someone please help me get this rule working on 7.x-2.2?

array (
  'rules' => 
  array (
    'rules_check_user_for_access' => 
    array (
      '#type' => 'rule',
      '#set' => 'event_node_view',
      '#label' => 'Check user for access',
      '#active' => 1,
      '#weight' => '0',
      '#categories' => 
      array (
      ),
      '#status' => 'custom',
      '#conditions' => 
      array (
        0 => 
        array (
          '#name' => 'user_relationships_rules_condition_users_are_related',
          '#info' => 
          array (
            'label' => 'Check if two users are related',
            'arguments' => 
            array (
              'user1' => 
              array (
                'type' => 'user',
                'label' => 'User A',
              ),
              'user2' => 
              array (
                'type' => 'user',
                'label' => 'User B',
              ),
            ),
            'module' => 'User Relationships',
          ),
          '#settings' => 
          array (
            'relationship_types' => 
            array (
            ),
            '#argument map' => 
            array (
              'user1' => 'user',
              'user2' => 'author',
            ),
          ),
          '#type' => 'condition',
          '#weight' => 0,
          '#negate' => 1,
        ),
        1 => 
        array (
          '#type' => 'condition',
          '#weight' => 0,
          '#negate' => 1,
          '#settings' => 
          array (
            'type' => 
            array (
              'blog' => 'blog',
              'diary_entry' => 'diary_entry',
              'faq' => 'faq',
              'groupdiscussion' => 'groupdiscussion',
              'groupnewsevent' => 'groupnewsevent',
              'locationgroup' => 'locationgroup',
              'simplenews' => 'simplenews',
              'page' => 'page',
              'situationgroup' => 'situationgroup',
              'webform' => 'webform',
            ),
            '#argument map' => 
            array (
              'node' => 'node',
            ),
          ),
          '#info' => 
          array (
            'label' => 'Viewed content is',
            'label callback' => false,
            'arguments' => 
            array (
              'node' => 
              array (
                'type' => 'node',
                'label' => 'Content',
              ),
            ),
            'module' => 'Node',
          ),
          '#name' => 'rules_condition_content_is_type',
        ),
        2 => 
        array (
          '#negate' => 1,
          '#weight' => 0,
          '#type' => 'condition',
          '#settings' => 
          array (
            '#argument map' => 
            array (
              'user1' => 'user',
              'user2' => 'author',
            ),
          ),
          '#name' => 'rules_condition_user_comparison',
          '#info' => 
          array (
            'label' => 'Compare two users',
            'arguments' => 
            array (
              'user1' => 
              array (
                'type' => 'user',
                'label' => 'User account 1',
              ),
              'user2' => 
              array (
                'type' => 'user',
                'label' => 'User account 2',
              ),
            ),
            'module' => 'User',
          ),
        ),
        3 => 
        array (
          '#negate' => 1,
          '#weight' => 0,
          '#info' => 
          array (
            'label' => 'User has role(s)',
            'arguments' => 
            array (
              'user' => 
              array (
                'type' => 'user',
                'label' => 'User',
              ),
            ),
            'module' => 'User',
          ),
          '#name' => 'rules_condition_user_hasrole',
          '#settings' => 
          array (
            'roles' => 
            array (
              0 => 3,
            ),
            'operation' => 'OR',
            '#argument map' => 
            array (
              'user' => 'user',
            ),
          ),
          '#type' => 'condition',
        ),
      ),
      '#actions' => 
      array (
        0 => 
        array (
          '#weight' => 0,
          '#info' => 
          array (
            'label' => 'Show a configurable message on the site',
            'module' => 'System',
            'eval input' => 
            array (
              0 => 'message',
            ),
          ),
          '#name' => 'rules_action_drupal_message',
          '#settings' => 
          array (
            'message' => 'You cannot view the page you were going to because you don\'t have a relationship with the author. Please login or request a relationship with the author.',
            'error' => 1,
            '#eval input' => 
            array (
              'token_rules_input_evaluator' => 
              array (
                'message' => 
                array (
                  0 => ':global',
                ),
              ),
            ),
          ),
          '#type' => 'action',
        ),
        1 => 
        array (
          '#weight' => 0,
          '#type' => 'action',
          '#settings' => 
          array (
            'path' => '',
            'query' => '',
            'fragment' => '',
            'force' => 1,
            'immediate' => 1,
            '#eval input' => 
            array (
              'token_rules_input_evaluator' => 
              array (
                'path' => 
                array (
                  0 => ':global',
                ),
                'query' => 
                array (
                  0 => ':global',
                ),
                'fragment' => 
                array (
                  0 => ':global',
                ),
              ),
            ),
          ),
          '#name' => 'rules_action_drupal_goto',
          '#info' => 
          array (
            'label' => 'Page redirect',
            'module' => 'System',
            'eval input' => 
            array (
              0 => 'path',
              1 => 'query',
              2 => 'fragment',
            ),
          ),
        ),
      ),
      '#version' => 6003,
    ),
  ),
)

Comments

TR’s picture

Status: Active » Closed (outdated)