A programmer question : how to retrieve the connected user

dsouvik215

Member
May 25, 2018
896
0
16
Hello,

I have a multiple user environment and
I would like to add the connected user in the document.title of the web page (in webui.js file, setStatusUpdate function) (rutorrent/js/webui.js)

I tried to make a webui.php (in same folder) with <?php $user = getUser(); ?> (getUser() function available in util.php)

And add something like this in webui.js:

document.title = "Server " + user;

But it doesn't work...

Im not a php/js programmer sad.gif

Thanks !

Kr,
ODB
 

jith45

Member
May 25, 2018
960
0
16
Try to write a plugin. In your case it must contain two files
1) plugin.info (you may copy it from plugin 'rpc' and correct)
2) init.php

Code
<?php

$jResult.=("document.title = ".quoteAndDeslashEachItem("Server: ".getUser()).";";
$theSettings->registerPlugin($plugin["name"],$pInfo["perms"]);

?>
 

dsouvik215

Member
May 25, 2018
896
0
16
got it working thanks !
There was a little mistake,

I wonder how your debug ?

Here the code that I used

Code:
<?php

$jResult .= "document.title = " . quoteAndDeslashEachItem("Server: ".getUser()) . ";";
$theSettings->registerPlugin("plugin_name");

?>