I have a Content type Board. All authenticated users can add boards. when i displaying the Board's Nodes i am also showing the author name. All going good. But when a user delete his account i set his status as blocked. If a user has been blocked then i want to show Anonymous author on board's node created by that blocked user. I searched here and there but could not find solution. Any Help please Thanks in Advance.

2 Answers 2


You may use

function theme_username($variables)


$username = $variables['name'];

Check if user blocked

$variables['name'] = 'anonymous';
  • I could not solve by this. but it helped me a lot to fix my problem. thanks
    – Iqbal
    Oct 20, 2016 at 14:52

And finally, i solved it by following code:

    <?php $author= user_load($uid); ?>
<?php if ($display_submitted): ?>
<span class="submitted">

<!-- For blocked user set the user name as Anonymous -->
  <?php if(user_is_blocked($author->name)): ?>

    <span> <a href="#" title="" class="username" ><?php print t('Anonymous'); ?></a></span>

  <?php else: ?>

    <?php print($user_picture); ?>
    <?php print($submitted);?>

  <?php endif;?>
<?php endif; ?>


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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