By sarmiluv on
I am using following code for not to show block for administrators. I am using this for adsense blocks.
global $user;
if ($user->uid != 1)
return TRUE;
I do not want to show the block on following pages also. Please modify above code or suggest any alternative.
all pages if user is admin
all pages if user is user 5
user
user/register
user/password
user/*/edit
user/*/contact
node/add
node/add/*
Thank you.
Comments
How about
block management tools
also, if you don't want as many if statements in your block, try the block-configuration tool to designate which pages a block should not show up on.
Thank you. This is exactly
Thank you. This is exactly what I wanted. I have small addition to make on the above code. I do not want the blocks to be visible in following ip addresses types also.
12.34.56.789
34.56.78.***
56.34.**.***
78.**.**.***
* means it can be any number. Please suggest a code for the above numbers. I will modify according to my needs.
How about this $ip =
How about this
Sorry I have no knowledge
Sorry I have no knowledge with codes. Please combine the the two codes into one.
All together
Here is the code all together. (If you are going to use PHP code, you should at least learn the basics).
Thank you. I want to learn
Thank you. I want to learn php basics. If you know of any learning materials available online, please let me know. I have some knowledge on C programming. I hope that will be of some help.
Addition to the code
I do not want the block to be visible in following pages also. Please make the necessary additions on the code.
user
content/privacy-policy-wwwdomaincom
contact
Thank you.
I will let you make the
I will let you make the changes. Given a path like user/1, 'user' is arg(0), '1', is arg(1). So the new code goes along with
that sets up values for the first three parts of the path. You want to add code that checks $arg0, $arg1 and $arg2 as needed to see if the path is one you care about.
I can't make it work. Please
I can't make it work. Please help.
The === operator
I was just curious whether this is a type-o or it is correct in the following part of the code. Let me know if I should just use "==" instead of "===".
if ( $arg2 === 'edit' || $arg2 == 'contact' ) {
bookmarked!!
bookmarked!!
---~~~***~~~---
aac