How to get logged-in user?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to get logged-in user?

Jan Steinman
I would like to use Parser Functions together with the current logged  
in user to have conditional output from within <sql2wiki> tags, so  
that logged-in users get to see things that anonymous users can't see.

Ideally, I'd like to get the mw_user.user_id integer, as I'm using  
that as a primary key into an extended user information table.

I did crawl around meta.wikimedia.org (including Help:Variable, Help:Magic
, etc.) looking for this, to no avail.

Can someone point me in the right direction? Thanks!

:::: Political language -- and with variations this is true of all  
political parties, from Conservatives to Anarchists -- is designed to  
make lies sound truthful and murder respectable, and to give an  
appearance of solidity to pure wind. -- George Orwell ::::
:::: Jan Steinman http://www.EcoReality.org ::::



_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: How to get logged-in user?

K. Peachey
On Thu, Nov 19, 2009 at 11:00 AM, Jan Steinman <[hidden email]> wrote:
>
Are you using any sort of cahceing, because that would just plain break it?

-Peachey

_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: How to get logged-in user?

Jan Steinman
In reply to this post by Jan Steinman
> From: "K. Peachey" <[hidden email]>
>
> On Thu, Nov 19, 2009 at 11:00 AM, Jan Steinman <[hidden email]>  
> wrote:
>>
> Are you using any sort of cahceing, because that would just plain  
> break it?

No caching that I'm aware of beyond what MW does.


:::: The Earth isn't a pizza. You can't dial up and have one  
delivered! -- Alf ::::
:::: Jan Steinman <http://www.EcoReality.org> ::::



_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: How to get logged-in user?

Platonides
Jan Steinman wrote:

>> From: "K. Peachey" <[hidden email]>
>>
>> On Thu, Nov 19, 2009 at 11:00 AM, Jan Steinman <[hidden email]>  
>> wrote:
>> Are you using any sort of cahceing, because that would just plain  
>> break it?
>
> No caching that I'm aware of beyond what MW does.
>
>
> :::: The Earth isn't a pizza. You can't dial up and have one  
> delivered! -- Alf ::::
> :::: Jan Steinman <http://www.EcoReality.org> ::::

$wgUser->isLoggedIn() / $wgUser->getId()

Default mediawiki caching will give you problems. You need to disable
page caching on at least the pages which use your tag, by using
$parser->disableCache()
http://www.mediawiki.org/wiki/Extensions_FAQ#Recent_versions


_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: How to get logged-in user?

Jan Steinman
In reply to this post by Jan Steinman
On 19 Nov 09, at 13:34, [hidden email] wrote:

> From: Platonides <[hidden email]>
>
> Jan Steinman wrote:
>>> From: "K. Peachey" <[hidden email]>
>>>
>>> On Thu, Nov 19, 2009 at 11:00 AM, Jan Steinman <[hidden email]>
>>> wrote:
>>> Are you using any sort of cahceing, because that would just plain
>>> break it?
>>
>> No caching that I'm aware of beyond what MW does.
>>
>>
>> :::: The Earth isn't a pizza. You can't dial up and have one
>> delivered! -- Alf ::::
>> :::: Jan Steinman <http://www.EcoReality.org> ::::
>
> $wgUser->isLoggedIn() / $wgUser->getId()
>
> Default mediawiki caching will give you problems. You need to disable
> page caching on at least the pages which use your tag, by using
> $parser->disableCache()
> http://www.mediawiki.org/wiki/Extensions_FAQ#Recent_versions


Thanks, Platonides.

I do understand how to get the user from within PHP; I was hoping to  
get it from within wikitext.

I suppose I could write an extension that does nothing but answer the  
current user and their ID...

:::: Once a nation parts with the control of its curency and credit,  
it matters not who makes that nation's laws. — Mackenzie King ::::
:::: Jan Steinman, EcoReality <http://www.EcoReality.org> ::::




_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: How to get logged-in user?

Jan Steinman

On 19 Nov 09, at 16:50, Jan Steinman wrote:

> On 19 Nov 09, at 13:34, [hidden email] wrote:
>
>> From: Platonides <[hidden email]>
>>
>> Jan Steinman wrote:
>>>> From: "K. Peachey" <[hidden email]>
>>>>
>>>> On Thu, Nov 19, 2009 at 11:00 AM, Jan Steinman <[hidden email]>
>>>> wrote:
>>>> Are you using any sort of cahceing, because that would just plain
>>>> break it?
>>>
>>> No caching that I'm aware of beyond what MW does.
>>>
>>>
>>> :::: The Earth isn't a pizza. You can't dial up and have one
>>> delivered! -- Alf ::::
>>> :::: Jan Steinman <http://www.EcoReality.org> ::::
>>
>> $wgUser->isLoggedIn() / $wgUser->getId()
>>
>> Default mediawiki caching will give you problems. You need to disable
>> page caching on at least the pages which use your tag, by using
>> $parser->disableCache()
>> http://www.mediawiki.org/wiki/Extensions_FAQ#Recent_versions
>
>
> Thanks, Platonides.
>
> I do understand how to get the user from within PHP; I was hoping to  
> get it from within wikitext.
>
> I suppose I could write an extension that does nothing but answer  
> the current user and their ID...


Thanks again, and I found a perfect place to put this stuff so I don't  
have to cobble up an extension from scratch.
        http://www.mediawiki.org/wiki/Extension:Variables

This extension is pretty cool. It will basically let you define new  
"magic words" as needed from anything that is available in the PHP  
environment.
        http://www.mediawiki.org/wiki/Help:Magic_words

:::: Having the last word is the final refuge for those who never had  
a good point in the first place. ::::
:::: Jan Steinman http://www.VeggieVanGogh.com ::::



_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l