Index: me.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/me/me.module,v retrieving revision 1.5.2.7.2.7 diff -u -p -r1.5.2.7.2.7 me.module --- me.module 1 May 2009 09:40:23 -0000 1.5.2.7.2.7 +++ me.module 1 Jul 2009 22:57:03 -0000 @@ -711,3 +711,14 @@ function me_user($op, &$edit, &$account, break; } } + +/** + * Implementation of CTools hook_ctools_plugin_dierctory(). + * + * See http://drupal.org/project/ctools for module and hook information. + */ +function me_ctools_plugin_directory($module, $plugin) { + if ($module == 'ctools' && $plugin == 'arguments') { + return 'plugins'; + } +} cvs diff: Diffing includes cvs diff: Diffing plugins Index: plugins/me_uid.inc =================================================================== RCS file: plugins/me_uid.inc diff -N plugins/me_uid.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ plugins/me_uid.inc 1 Jul 2009 22:57:03 -0000 @@ -0,0 +1,58 @@ + t("User ID (Me Supported)"), + // keyword to use for %substitution + 'keyword' => 'user', + 'description' => t('Creates a user context from a user ID argument or the %me alias.', array('%me' => _me_get_me_alias(TRUE))), + 'context' => 'me_argument_uid_context', + 'placeholder form' => array( + '#type' => 'textfield', + '#description' => t('Enter the user ID of a user for this argument or the %me alias.', array('%me' => _me_get_me_alias(TRUE))), + ), + ); + return $args; +} + +/** + * Discover if this argument gives us the user we crave. + */ +function me_argument_uid_context($arg = NULL, $conf = NULL, $empty = FALSE) { + // If unset it wants a generic, unfilled context. + if ($empty) { + return ctools_context_create_empty('user'); + } + + // We can accept either a user object or a pure uid. + if (is_object($arg)) { + return ctools_context_create('user', $arg); + } + + // Convert the argument if needed. + $arg = _me_check_arg($arg); + + if (!is_numeric($arg)) { + return NULL; + } + + $account = user_load(array('uid' => $arg)); + if (!$account) { + return NULL; + } + + return ctools_context_create('user', $account); +} +