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.
You may use
$username = $variables['name'];
Check if user blocked
$variables['name'] = 'anonymous';
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;?> </span> <?php endif; ?>