show logged in authors / smarty question
show logged in authors / smarty question
Hey there,
I'm looking for a sidebar plugin which shows the currently logged authors.
It seems that there's no such plugin available yet..
Furthermore I've got a question regarding the index.tpl file.
I want to hide the sidebar on a subpage ([subpage]=forum here). Therefore I need to know how smarty can check for the opened url.
Thanks in advance
Greetings Andi
I'm looking for a sidebar plugin which shows the currently logged authors.
It seems that there's no such plugin available yet..
Furthermore I've got a question regarding the index.tpl file.
I want to hide the sidebar on a subpage ([subpage]=forum here). Therefore I need to know how smarty can check for the opened url.
Thanks in advance
Greetings Andi
I don't know about a "currently logged in" plugin. If we've got one, Garvin will direct you to it as soon as he sees this post.
You could use the Sidebar Hider event plugin to hide the sidebar.
If you really want to modify your Smarty, I don't think we keep the current page around. Bulletproof addresses that by setting {$currpage} in its config.inc.php:
You could put the same thing in your template's config.inc.php, creating it if necessary.
You could use the Sidebar Hider event plugin to hide the sidebar.
If you really want to modify your Smarty, I don't think we keep the current page around. Bulletproof addresses that by setting {$currpage} in its config.inc.php:
Code: Select all
$serendipity['smarty']->assign(array('currpage'=> "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']));
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: show logged in authors / smarty question
Hi!
You can use the "Active visitors" plugin though and patch it to add another DB table row with which you indicate if a visitor is an author or not...?
Regards,
Garvin
There is no functionality for that because Serendipity does not keep track of logged in authors.I'm looking for a sidebar plugin which shows the currently logged authors.
You can use the "Active visitors" plugin though and patch it to add another DB table row with which you indicate if a visitor is an author or not...?
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Hi Garvin,
now I got time
But I'm not sure what plugin the "Active visitors" is neither how to determine if a visitor is an author...
I looked over the code and this is what I think how I could implement it:
Create a new function which saves the authorid and a bool if logged in db. Add a call to it in the login and logout function of config.inc to store the actual state of the author.
Add a new SidebarItem printing the authornames which are logged into s9y...
This is just how I would do it - but I would not change s9ys core functions if there is another way to do this....
Kind regards
now I got time
But I'm not sure what plugin the "Active visitors" is neither how to determine if a visitor is an author...
I looked over the code and this is what I think how I could implement it:
Create a new function which saves the authorid and a bool if logged in db. Add a call to it in the login and logout function of config.inc to store the actual state of the author.
Add a new SidebarItem printing the authornames which are logged into s9y...
This is just how I would do it - but I would not change s9ys core functions if there is another way to do this....
Kind regards
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Regards,
Garvin
I believe serendipity_plugin_statistics (bundled with s9y) does that. I think this one already stores the information in a DB, so you'd just need to add that boolean flag?Linus wrote:Hi Garvin,
now I got time
But I'm not sure what plugin the "Active visitors" is neither how to determine if a visitor is an author...
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Okay I already thought that this is the plugin you suggested to patch and yes it already stores it's data in the visitors table...
But how can I determine who is logged in and who is only a visitor?
Do I have to modify the login & logout functions or is there another way to get the information?
Instead of storing a boolean flag I'm planning to store the authorid.
I could easily fetch the rows from the visitors table which got the authorid set and get the realnames to display them in the sidebar...
But how can I determine who is logged in and who is only a visitor?
Do I have to modify the login & logout functions or is there another way to get the information?
Instead of storing a boolean flag I'm planning to store the authorid.
I could easily fetch the rows from the visitors table which got the authorid set and get the realnames to display them in the sidebar...
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
The author id is containde in $serendipity['authorid'].
Regards,
Garvin
You can use the serendipity_authorLoggedIn() PHP function, it returns true if a user is logged in.But how can I determine who is logged in and who is only a visitor?
Do I have to modify the login & logout functions or is there another way to get the information?
The author id is containde in $serendipity['authorid'].
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Sorry maybe I'm a bit dumb today but I don't understand what your talking about...
I want to display ALL users which are currently logged in on the sidebar..
I can't use this function imho because I can't supply an argument.
Doing something like fetchUsers() and then a loop:
won't work or am I wrong?
I want to display ALL users which are currently logged in on the sidebar..
I think you mean serendipity_userLoggedIn().You can use the serendipity_authorLoggedIn() PHP function, it returns true if a user is logged in.
I can't use this function imho because I can't supply an argument.
Doing something like fetchUsers() and then a loop:
Code: Select all
foreach user {
if(serendipity_userLoggedIn()) {
print authorname...
}
}
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
You need two things:
1. The code that inserts the current authorid in your DB table. This is done through serendipity_userloggedin() and $serendipity['authorid']
2. To display the list of logged in users, you need your own custom DB query that evalutes the table you filled in 1.)
Regards,
Garvin
You need two things:
1. The code that inserts the current authorid in your DB table. This is done through serendipity_userloggedin() and $serendipity['authorid']
2. To display the list of logged in users, you need your own custom DB query that evalutes the table you filled in 1.)
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Hi Garvin
Thats the function:
First I added global $serendipity to access the authorid. Putting simple db_queries (to insert and delete) in the if and else statement isn't working...
So I tried to find another place to put the code in which I found in the loginform plugin. I've put a line for inserting the authorid in db before serendipity_login() and to delete the authorid from db before serendipity_logout().
Well it´s working if the user logs in and out via the loginform.
But if a user is inactive and gets disconnected without logging out he is certainly shown as online.
Regards,
Andi
Mmh i ran into problems putting db_queries into serendipity_userLoggedIn() function.1. The code that inserts the current authorid in your DB table. This is done through serendipity_userloggedin() and $serendipity['authorid']
Thats the function:
Code: Select all
function serendipity_userLoggedIn() {
if ($_SESSION['serendipityAuthedUser'] === true && IS_installed) {
return true;
} else {
return false;
}
}
So I tried to find another place to put the code in which I found in the loginform plugin. I've put a line for inserting the authorid in db before serendipity_login() and to delete the authorid from db before serendipity_logout().
Well it´s working if the user logs in and out via the loginform.
But if a user is inactive and gets disconnected without logging out he is certainly shown as online.
I got this part already working - simply copied userprofiles_birthdays and edited it to get a new sidebox...2. To display the list of logged in users, you need your own custom DB query that evalutes the table you filled in 1.)
Regards,
Andi
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Don't modify core code, you can do it all in your plugin. First check for if user_loggedIn() and then issue a db query within your plugin to update the DB table accordingly.
Regards,
Garvin
Don't modify core code, you can do it all in your plugin. First check for if user_loggedIn() and then issue a db query within your plugin to update the DB table accordingly.
sure, that's the same with anonymous visitors. You can only show a list of authors who "have logged in over the last past 5 minutes" or so.But if a user is inactive and gets disconnected without logging out he is certainly shown as online.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Hi Garv!
Well I got it working at the moment without any changes to the core.
I`ve created a new table with only on field (authorid).
Everytime a user logs in/out with the sidebarplugin I insert/delete the authorid in the table. I put that code in the serendipity_event_loginform.php.
As I mentioned before I copied serendipity_plugin_userprofiles_birthday changed it to display the realnames from the currently logged authors.
I know that this is _very_ dirty (and yes I feel ashamed) but it´s working and I got no further motiviation right now, to write it the way it should be.
I`ll see how it behaves...
Anyway thanks a lot
Well I got it working at the moment without any changes to the core.
I`ve created a new table with only on field (authorid).
Everytime a user logs in/out with the sidebarplugin I insert/delete the authorid in the table. I put that code in the serendipity_event_loginform.php.
As I mentioned before I copied serendipity_plugin_userprofiles_birthday changed it to display the realnames from the currently logged authors.
I know that this is _very_ dirty (and yes I feel ashamed) but it´s working and I got no further motiviation right now, to write it the way it should be.
I`ll see how it behaves...
Anyway thanks a lot
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Hm. I personally never log out of my s9y installations, how will you track if an author really is logged out?
You should at least save a timestamp together with the authorid, and then purge old DB entries that are older than X minutes/hours to eradicate this.
Regards,
Garvin
Hm. I personally never log out of my s9y installations, how will you track if an author really is logged out?
You should at least save a timestamp together with the authorid, and then purge old DB entries that are older than X minutes/hours to eradicate this.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Thank you Garvin,
I did what you told me. When a user logs in I save the time.
The user will be removed from the list after 600sec. I change the color (green,yellow,red) of an image every 200 sec to indicate how much time is left. Furthermore I added a button that the user can manually update his state...
The result looks like this:
Regards Andi
I did what you told me. When a user logs in I save the time.
The user will be removed from the list after 600sec. I change the color (green,yellow,red) of an image every 200 sec to indicate how much time is left. Furthermore I added a button that the user can manually update his state...
The result looks like this:
Regards Andi