By jasonwhat on
I'd like to have some custom blocks which only show to particular user groups. Is there a way to do this? I'm using cvs version.
I'd like to have some custom blocks which only show to particular user groups. Is there a way to do this? I'm using cvs version.
Comments
Sure. Just make you output de
Sure. Just make you output depend on the permissions given to your user group (or 'role'). If there is no output returned, the block will not be displayed.
--
Drupal services
My Drupal services
How?
Sorry, but I'm not sure where I control output. I'm pretty new at this. thanks.
If you write the code for a p
If you write the code for a php based block, Drupal expects you to return the text for the block in a variable. If this variable is empty, then no block will be output.
--
Drupal services
My Drupal services
could you give an example?
I'm not very good with php. what type of if/else statement would I use if I wanted a block to show only for say a group called "board?"
thanks
Put this inside the block def
Put this inside the block definition (omit the php tags for Drupal 4.4.):
Users with the board role will now see "foo" in the block.
--
Drupal services
My Drupal services
This works great, but I
This works great, but I noticed an error that is created when blocks like this are turned on, and a user tries to login to the site, but uses an incorrect username and password...the error created is this:
warning: in_array(): Wrong datatype for second argument in /xxxxx/xxxxx/includes/common.inc(1822) : eval()'d code on line 4.
I searched a bit for errors of similar type in other modules but did not find much to try and solve it...any ideas?
The line in common is the drupal_eval function:
function drupal_eval($code) {
ob_start();
print eval('?>'. $code);
$output = ob_get_contents();
ob_end_clean();
return $output;
}
cheers, ian.
User Activated Block
Hi killes:
I'm not sure if this is the "most Drupal" way to this, but it's the first idea I had. I want to include an off-site db query in a block to the side of the main content. I only want the block to show up after the user clicks a link. Is this possible?
Off-site db queries are a bit
Off-site db queries are a bit difficult. Search Drupal.org for more info.
Showing blocks after a user clicks a link might be possible by checking a referrer in the block function or some other tricks. There is also the adc theme that hides blocks with some JS.
--
Drupal services
My Drupal services
How?...
Hi,
Just wondering. How to grant permission for blocks now? Can this be done? How to hide blocks when not logged in? With other words: hide for anonymous users? See my other posting about this.
I mean without hacking the code, but just fille in the right option. Possible already?
Grtz. Henk
permission based blocks with tables
I've created a user dashboard using tables. I only want this block to show up for logged in users. I know how to do this if I'm just displaying some text, but how do I do it for a whole table?
Also, does anybody know the link I need so users can view "my blog" with the link recognizing the user?
Some of your questions are
Some of your questions are answered here, I guess: http://drupal.org/node/13266
Uwe.
--
http://www.hermann-uwe.de