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 Answers
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:
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:)
-
-
I came to know about image_style_url in drupal.org.thanks. let me try all these :) Aug 5, 2013 at 10:18