Topic on Project talk:Support desk/Archive

By any way(through extensions or writing some script) is it possible to set site logo depending on user who is signing in?

8
182.69.127.211 (talkcontribs)

We have partnered with various other companies who sells our product by their own name for example our actual product name is ABC, but our one partner is selling it with name XYZ and another is selling it with name MNO.

What we are looking for is to show site logo depending on the person who is signing in. So if person signing is from partner 1 then we show logo of XYZ and so on.

Florianschmidtwelzow (talkcontribs)

If you want to change it depending on the person who _is_ logged in, and not who currently is _logging in_, you could to that diretly in LocalSettings.php:

if ( RequestContext::getMain()->getUser()->isLoggedIn() ) {
  $wgLogo = 'the/one/logo.png';
} else {
  $wgLogo = 'another/logo.png';
}

However, I would strongly suggest to not use that, as the wiki configuration shouldn't be user/request dependant as this could result in problems, e.g. with caching or something else. This is also not guaranteed to work or will still work in future versions of MediaWiki. You also need to have a way to distinguish users by the company or whatever you want, so you need to group users, and from your question you don't say how you plan to do that. It's also more complicated if one user can be associated with two companies, what do you do then?

You probably should setup a wiki for each brand you want to create. Probably you can explore a way to share _all_ contents with Manual:$wgSharedTable?

182.69.127.211 (talkcontribs)

Hi,

Thanks for reply!

On how we will distinguish users, our plan was to have user names such that we can know to which partner that user belongs too. For example if user name is Partner1_Peter then we will show logo of partner1. In our case one user will be associated with one company only always.

Can you please elaborate on "This is also not guaranteed to work or will still work in future versions of MediaWiki", in what scenarios it is not guaranteed to work?.

"You probably should setup a wiki for each brand you want to create. Probably you can explore a way to share _all_ contents with Manual:$wgSharedTable?"

Yes! That is one option but in that too there is an issue. As our product name is different for every brand the content of every brand will have different brand name. I read that it is possible to substitute variables in Mediawiki, can that be done on basis of site where the page is hosted? For example if page is hosted on brand1 site then in content we should use brand 1.

Florianschmidtwelzow (talkcontribs)

> Can you please elaborate on "This is also not guaranteed to work or will still work in future versions of MediaWiki", in what scenarios it is not guaranteed to work?.

The problem is, that the LocalSettings.php file is evaluated while MediaWiki is setup, so even if the User object is already available and fully working in the current version of MediaWiki, no one can guarantee, that it will work in a future release of MediaWiki, because, maybe, the initialization process changed or something else. That's why I wouldn't suggest to rely on this.

Btw.: From what you write, I would think it will be better to have different wikis for each of your brand. I'm not sure, how you want to substitute variables in MediaWiki, and even if it's possible I'm pretty sure, it will not work as you expect because of the internal caching of parsed wikitext, which is integrated in MediaWiki for performance reasons. I also would say: Different site logo + different content = different site, so you should use one MediaWiki installation for each wiki.

182.69.127.211 (talkcontribs)

Our content is same, just some keywords will change. For example, one site will say "Product 1 offers an easy integration of tools" while another site will say "Product 2 offers an easy integration of tools"

It will be error prone and too much maintenance to keep multiple sites and make any change in document at all the sites manually.

Florianschmidtwelzow (talkcontribs)

Having two different sites with the same content (except some little keywords) is, just for the record, probably the worst idea you can do, but it sounds you don't want to deliver to "different" sites, just one site with different flavours, if I can say it in this way. I can say, that you'll probably have some problems with implementing this with MediaWiki. Firstly, the Parser Cache is not built to be dependant on the request or user basis, just on the wikitext (if wikitext changes -> re-parse, if user or request changes -> deliver pre-parsed text). Turning off the parser cache is, in general, a very bad idea from a performance point of view. The same with the site logo: The MediaWiki infrastructure is, as far as I know, not built to provide a different site-logo depending on the user. What you could do is to have a copy of your skin for each company and "hard-code" the skin in it and set the skin setting for the user, or something in this way.

182.69.127.211 (talkcontribs)

Also, Mediawiki document says that sharing pages across wikis is not recommended :(

Commander1987 (talkcontribs)
Reply to "By any way(through extensions or writing some script) is it possible to set site logo depending on user who is signing in?"