2
// $Id: views_plugin_argument_default_user.inc,v 1.1 2008/09/03 19:21:30 merlinofchaos Exp $
5
* Contains the user from URL argument default plugin.
9
* Default argument plugin to extract a user via menu_get_object
11
class views_plugin_argument_default_user extends views_plugin_argument_default {
12
var $option_name = 'default_argument_user';
14
function argument_form(&$form, &$form_state) {
15
$form[$this->option_name] = array(
16
'#type' => 'checkbox',
17
'#title' => t('Also look for a node and use the node author'),
18
'#default_value' => !empty($this->argument->options[$this->option_name]),
19
'#process' => array('views_process_dependency'),
20
'#dependency' => array(
21
'radio:options[default_action]' => array('default'),
22
'radio:options[default_argument_type]' => array($this->id)
24
'#dependency_count' => 2,
28
function get_argument() {
29
foreach (range(1, 3) as $i) {
30
$user = menu_get_object('user', $i);
36
foreach (range(1, 3) as $i) {
37
$user = menu_get_object('user_uid_optional', $i);
43
if (!empty($this->argument->options[$this->option_name])) {
44
foreach (range(1, 3) as $i) {
45
$node = menu_get_object('node', $i);
52
if (arg(0) == 'user' && is_numeric(arg(1))) {
56
if (arg(0) == 'node' && is_numeric(arg(1))) {
57
$node = node_load(arg(1));