hello i am hacking ApprovedRevs mediaWiki extension I am using mediaWiki 1.16
basically i need to know the name of current logged in us开发者_Go百科er in mediaWiki in a function which is executed when an UnknownAction hook is fired,
I know i can access the logged in user name $wgUser->mName; $wgUser being a global variable but what i get is an empty string
I did print_r in skin file (vector.php) and it contained all the info there but when i did the same in the function i am working on i got this:
StubUser Object
(
    [mGlobal] => wgUser
    [mClass] => 
    [mParams] => Array
        (
        )
)
i.e it was empty so can anyone tell me what should i do?
You should use the object's getName method (like $wgUser->getName()) instead of accessing the property directly.
This is because the object is initially a stub object. This means that the data aren't loaded until the first method call. You can see the reference documentation on StubObject.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论