2

I want each user to create their own site-logo. This is not multi-site, this is a single site only. How can I do it?

2
  • if this is not for multisite, then why would you need that?
    – pown
    Aug 5, 2013 at 10:02
  • I just want each user to have their own logos :) Aug 5, 2013 at 10:04

2 Answers 2

6

Add a field to the user profile and use this as a replacement for the logo. Use the page_preprocessor to add the user logo to the page template. Replace the logo by the one the user provided or show a default one.

Read more about this:

0
5

If you want each user to have their own logo, then in the account settings of admin section you can create a logo field of type image. Then in edit section of account page you can upload the image.

Then with this custom code you can able to assign logo based on each user logged in :

So in the page.tpl.php of your theme folder you can make this modifications:

<?php if ($logo): ?>    
        <?php global $user; ?>
    <?php if($user->uid == 1 || $user->uid == 0)?>              
       <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" id="logo">
       <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>">                                  
       </a>            
    <?php else :?>
    <?php 
         $uid = $user->uid;
         $userDetails = user_load($uid);                
         $filename = $userDetails->field_site_logo['und'][0]['uri'];?>              
         <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" id="logo">
           <img src="<?php print image_style_url('sitelogo',$filename);?>" />   
         </a>                                      
    <?php endif; ?>
<?php endif; ?>

Hope this helps you and saves time:)

2
  • Thanks for the reply. Can i know what is that sitelogo? Aug 5, 2013 at 10:13
  • I came to know about image_style_url in drupal.org.thanks. let me try all these :) Aug 5, 2013 at 10:18

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.