开发者

"Show block on specific pages" drupal can tokens be used?

开发者 https://www.devze.com 2023-04-10 18:53 出处:网络
I want to limit a block to only being on the a users account page.In the section \"Show block on specific pages\" I u开发者_如何学编程sed users/[user-name](did not work) then I tried users/[user-id](d

I want to limit a block to only being on the a users account page. In the section "Show block on specific pages" I u开发者_如何学编程sed users/[user-name] (did not work) then I tried users/[user-id] (did not work).

Are tokens allowed here? Is there a way to do this?

TIA


You can use PHP to get the result you want. I dont know if tokens are allowed here. If you have PHP filter enabled you may use the following:

<?php
global $user;
if (arg(0) == 'user' && $user->uid == arg(1)){
    return True;
}else{
    return False;
}
?>

Get the current user with global $user, than get the url arguments with arg():

The first argument should be "user", so arg(0) == 'user'.

The second should be the current user uid, so arg(1) == $user->uid.

Everything else returns false.

Hope it helps.


Try using the * wildcard in place of a token. So you would have:

users/*
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号