function menu_position_menu_position_condition_user_page in Menu Position 7
Checks if the current pageload is a user account page.
Parameters
$variables: An array containing each of the variables saved in the database necessary to evaluate this condition of the rule.
Return value
TRUE if condition applies successfully. Otherwise FALSE.
File
- plugins/
menu_position.user_page.inc, line 16 - Provides the User rule plugin for the Menu Position module.
Code
function menu_position_menu_position_condition_user_page($variables) {
if (empty($variables['user_page_enable'])) {
// Short-circuit if this rule is not enabled.
return FALSE;
}
// There's probably a better way to figure out the current page context.
$args = arg();
if ($args[0] != 'user') {
// Short-circuit if we're not looking at a user account page.
return FALSE;
}
if (!empty($args[1]) && !is_numeric($args[1])) {
// Short circuit if arg1 is non-empty and non-numeric.
return FALSE;
}
if (!empty($args[2]) && ($args[2] == 'add' || $args[2] == 'edit')) {
// Short circuit if we are on the add or edit page.
return FALSE;
}
// All good!
return TRUE;
}