0

I have users with the role "authors" and a block in /user showing publications so that visitors can see the publications of every "author". The problem is that the block is showing at every user profile page even if the user has not an "author" role. How can i set this block to show only to user profile pages that have a role "author"?

1

On the configure block page, at the bottom in the vertical tab menu, click on the roles tab, and select which user role you want it to display for.

enter image description here

0

Call this function for visiblity settings: block visiblity settings > Pages > 'Pages on which this PHP code returns TRUE (experts only)'

function _user_block_visiblity() {
  if (arg(0) === 'user') {
    global $user;
    if(in_array('authors', $user->roles){
        return TRUE;
    }    
  } 
  // Default is to not show the block
  return FALSE;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.