Hi,

I have 2 mysql tables called 'xperiences_nodes' and 'xperiences_users'.
I am building a module where i can give nodes a xperiencelevel and on the other side calculates drupal a user xperiencelevel based on the watched nodes.
As you can imagine, the node levels are stored in xperiences_nodes and the user levels are stored in xperiences_users.
Now i made a view-filter where i can filter the nodes to a particular nodelevel, tis works fine.
But now i'm stuck. I want to make a views-filter that filters nodes to the logged in xperience level.

So first drupal has to check with the logged in uid in xperiences_users what his level is and then show every node that has the same node level stored in xperiences_nodes.

I hope you understand what i'm trying to say, its difficult to explain...

This is the module code that i already have for the simple manual nodexperience filter.

function nodexperience_views_tables() {
  $tables['xperiences_nodes'] = array(
    "name" => "xperiences_nodes",
    "join" => array(
     "type" => "inner",
      "left" => array(
        "table" => "node",
        "field" => "nid"
      ),
      "right" => array(
        "field" => "nid"
      ),
    ),

    "fields" => array(
      'nxv' => array(
        'name' => t('NodeXperience: Experience Value'),
        'sortable' => TRUE,
        'help' => t('Display the node experience value'),
      ),
    ),

    "filters" => array(
      'nxv' => array(
        'name' => t('Node Experience: Experience Value'),
        'help' => t('Display the node experience value'),
        'operator' => array('<' => t('<'), '>' => t('>'), '=' => t('=')),
        'value' => array(
          '#type' => 'textfield',
          '#default_value' => $object['foo'],
          '#size' => 5,
          '#maxlength' => 2,
        )
      ),
    ),

    "sorts" => array(
      'nxv' => array(
        'name' => t('Nodexperience: Experience value'),
        'sortable' => TRUE,
        'help' => t('Sort by node experience value'),
      ),
    ),
  );

  return $tables;
}

many thanx!

Comments

betz’s picture

bump