Roundcube Community Forum
Release Support => Pending Issues => Topic started by: jeffshead on November 08, 2013, 02:58:57 AM
-
The website for the 'Custom Logo' plugin that is listed in the repository (http://trac.roundcube.net/wiki/Plugin_Repository) has been down for a very long time.
Can someone share this plugin?
I want to use the same URL (https://www.mysite.com/webmail/) to login and check email for all of my domains. Then I can simply enter the full email address (e.g., me@mysite.com, me@mysite2.com) and the logo changes based on the domain part of the email address that is entered during login.
If the plugin is not available or will not work with RC 0.95, can someone please tell me how to have the logo change based on the domain part of the email address that is entered during login?
-
You can write PHP code in config file, e.g.:
if (strpos($_SESSION['username'], '@domain1.tld'))
$rcmail_config['skin_logo'] = 'path/to/logo/file1';
else if (strpos($_SESSION['username'], '@domain2.tld'))
$rcmail_config['skin_logo'] = 'path/to/logo/file2';
-
You don't Need the plugin. You can define various logos to RoundCube by default.
Look into your config:
// replace Roundcube logo with this image
// specify an URL relative to the document root of this Roundcube installation
// an array can be used to specify different logos for specific template files, '*' for default logo
// for example array("*" => "/images/roundcube_logo.png", "messageprint" => "/images/roundcube_logo_print.png")
$config['skin_logo'] = null;
And you can define special config files for every domain you have and set the right logo for all users.
-
You can write PHP code in config file, e.g.:
if (strpos($_SESSION['username'], '@domain1.tld'))
$rcmail_config['skin_logo'] = 'path/to/logo/file1';
else if (strpos($_SESSION['username'], '@domain2.tld'))
$rcmail_config['skin_logo'] = 'path/to/logo/file2';
Thanks for the code but it does not work. I did verify the paths for the other logos. The paths are correct. Any suggestions?
-
You don't Need the plugin. You can define various logos to RoundCube by default.
Look into your config:
// replace Roundcube logo with this image
// specify an URL relative to the document root of this Roundcube installation
// an array can be used to specify different logos for specific template files, '*' for default logo
// for example array("*" => "/images/roundcube_logo.png", "messageprint" => "/images/roundcube_logo_print.png")
$config['skin_logo'] = null;
And you can define special config files for every domain you have and set the right logo for all users.
As I stated in my original post, I'm using the same URL to access RC for all domains so I don't see how RC will know to include a domain specific config file. Maybe I'm not following you.
-
alec's code should work. Is the right logo showing in the HTML when you login and it's just not displaying, or is it not even getting the correct logo name?
I prefer using different webmail URL's for each site, That can be done with this:
// replace Roundcube logo with this image
// specify an URL relative to the document root of this Roundcube installation
if (strpos($_SERVER['HTTP_HOST'],'mydomain.com'))
$rcmail_config['skin_logo'] = 'des-rgb-small.png';
else {
$rcmail_config['skin_logo'] = 'roundcube_logo_print.png';
}
-
@genevish like jeffshead said, this is intended to a scenario where roundcube is being access from the same url, and as such can not be dependent on the url info.
alec's code does not seem to work, any suggestions ?
it looks like this line : (strpos($_SESSION['username'], '@domain1.tld')) does not yield the intended result.
-
Alec's code works unless you are talking about the login page where the user is not known.
-
@rosali,
can you help me figure out why it's not working for me?
i'm using cpanel, the path to the config file is : /usr/local/cpanel/base/3rdparty/roundcube/config/
and i'm placing Alec's code to the config.inc.php file:
if (strpos($_SESSION['username'], '@domain.com')) {
$config['skin_logo'] = 'logo.jpg';
} elseif (strpos($_SESSION['username'], '@domain.com')) {
$config['skin_logo'] = 'logo2.jpg';
} else {
$config['skin_logo'] = null;
}
when i'm changing the if condition to 0 == 0 then the logo changes, but with session it doesn't work.
any idea what am i doing wrong ?
thank you.
-
Whats in the $_SESSION['username'] variable? What is the name of the account you are trying to login as?
-
I thought the $_SESSION['username'] returns the current user who is logged in,
so in my previous example i was hoping that everyone who is logged in with ANY email ending with @domain.com will get logo.jpg.
so if i'm logging in with ninja@domain.com i should get be getting the new logo.... right ?
-
PHP basics ... As skaero said figure out what $_SESSION['username'] returns. To do so, login and then insert in the config file ...
var_dump($_SESSION['username']);
exit;
... and finally refresh the page to see what is assigned to $_SESSION['username'].
-
I'm getting NULL.
I appreciate you spending the time replying. usually i'm able to find my way around those things, but i cant figure this one out.
-
After login?
-
Yes, it returns NULL. It seems that one of the programmers of Roundcube - ALEC - missed a change and we all trapped in. Obviously Roundcube initiates the session AFTER including the main config. So, the answer is, you can't do that by inserting PHP code into the main configuration file. You have to code a plugin or to jump into the core code in a hacky way. Please don't ask how to do that. That's too complicate to explain in few posts. As a starting point you could examine existing plugins and Roundcube's trac (http://trac.roundcube.net/wiki/Plugin_Hooks).
-
I see. thank you,
i'll start working on that and will post a solution if i'm able to find one.
-
Hope this topic isn't too old to resurrect.
I suspect if anyone comes along looking for a solution to this it will be easier, instead of trying to find a configuration setting or PHP function that will work, to instead use the roundcube database.
All you would need to do to accomplish this goal is a) create a skin for each login domain, and b) create an entry in the roundcube database for each user as you create the user that adds the configuration setting for that user's skin. This is stored in the preferences column, which holds an array of all user preferences. If you add the row for a user when that user is created, then you don't need to try and parse that array to add to it, you can just set it with your initial user defaults. Like this, which sets the skin to "yourskin" and turns on the preview pane:
a:2:{s:4:"skin";s:8:"yourskin";s:12:"preview_pane";b:1;}
I, for one, use postfixadmin to create virtual domains, and the virtual domain admins use it to create users. It has a wonderful capability to have user scripts that are executed after a user is created. That can be used to insert the row into the roundcube automagically on user creation.
-
Hi, I managed to change the logo in login page but what I'am confusing it's not working in after login
what I do is by editing the skin template login.html :
<!-- <roundcube:object name="logo" src="/images/roundcube_logo.png" id="logo" /> -->
<roundcube:if condition="$_SERVER['HTTP_HOST'] == 'mail.domain-abc.co'" />
<roundcube:object name="logo" src="/images/roundcube_logo.png" id="logo" />
<roundcube:elseif condition="$_SERVER['HTTP_HOST'] == 'domain-abc.co'" />
<roundcube:object name="logo" src="/images/roundcube_logo.png" id="logo" />
<roundcube:else />
<roundcube:object name="logo" src="/images/logo-other.png" id="logo" />
<roundcube:endif />
above code doesn't work on header.html.
:'(
Regards,
MarzuQnx
-
I don't think you can use arbitrary PHP in Roundcube template conditions and in any case there is no need since the $config['skin_logo'] (as mentioned elsewhere in this thread) is the proper way of doing what you want.
-
I don't think you can use arbitrary PHP in Roundcube template conditions and in any case there is no need since the $config['skin_logo'] (as mentioned elsewhere in this thread) is the proper way of doing what you want.
please guide me there mate, I already try $config['skin_logo'] and not yet succeed :)
Regards,
-
Actually roundcube is very flexible to change many things. All the attributes are in the main config file to play over.
ref: https://vvcares.com/blog/post/how-to-change-roundcube-webmail-title-logo