Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Nathaniel on August 09, 2008, 06:02:03 AM

Title: Last Active On MemberList
Post by: Nathaniel on August 09, 2008, 06:02:03 AM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=1324)

Last Active On MemberList 1.4 by Nathaniel
Overview

This mod adds a "Last Active" column to the MemberList, allowing you to view the last time that your members were active. It also allows you to sort the MemberList by the last active time of every member, meaning that you can view your members in order of when they were last active.

SMF Version Support
Official support for SMF 2 RC4 and above only. You can use the 1.02 package for SMF 1.1.x and versions of SMF 2 below SMF 2 RC2. Use the 1.03 package for SMF 2 RC2 and SMF 2 RC3.

Donate
If this mod has helped you, then feel free to support the developer by Donating (https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=VCFQ7MJNVXLLA&lc=AU&item_name=Donation&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted). Any amount of money is welcome.

Themes/Templates
This mod only edits a single template file, the 'Memberlist.template.php' file which is not used in most custom themes. If your custom theme doesn't contain this file then it should work automatically. Otherwise refer to the information below to make this mod work in your custom theme.

Default template install problems
If you want to install this mod for a custom theme (that has its own 'Memberlist.template.php' file), then find the relevant edits in this section for your version of SMF.

If you are having problem with this mod installing for the default theme with SMF 1.1.x and you are only receiving errors for the 'Memberlist.template.php edit, then you can install the mod normally and then perform the steps set out in the 'Troubleshooting' section for the default theme. Its likely that you have installed another mod which edits the same parts of that template file.

Custom theme edit for SMF 2 RC4 and above
Code ("Find (Memberlist.template.php - curve themes)") Select
               <td class="windowbg lefttext">', $member['registered_date'], '</td>

Code ("Replace") Select
                <td class="windowbg lefttext">', $member['registered_date'], '</td>
               <td class="windowbg lefttext">', $member['last_login'], '</td>


Code ("Find (Memberlist.template.php - core themes)") Select
               <td align="center" class="windowbg">', $member['registered_date'], '</td>

Code ("Replace") Select
               <td align="center" class="windowbg">', $member['registered_date'], '</td>
               <td align="center" class="windowbg">', $member['last_login'], '</td>


Custom theme edit for SMF 2 RC2 and SMF 2 RC3
Code ("Find (Memberlist.template.php - curve themes)") Select
               <td class="windowbg" align="', $context['right_to_left'] ? 'right' : 'left', '">', $member['registered_date'], '</td>

Code ("Replace") Select
               <td class="windowbg" align="', $context['right_to_left'] ? 'right' : 'left', '">', $member['registered_date'], '</td>
               <td class="windowbg" align="', $context['right_to_left'] ? 'right' : 'left', '">', $member['last_login'], '</td>


Code ("Find (Memberlist.template.php - core themes)") Select
               <td align="center" class="windowbg">', $member['registered_date'], '</td>

Code ("Replace") Select
               <td align="center" class="windowbg">', $member['registered_date'], '</td>
               <td align="center" class="windowbg">', $member['last_login'], '</td>


Custom theme edit for SMF 1.1.x and SMF 2 (only versions below SMF 2 RC2)
Code ("Find (Memberlist.template.php)") Select
            <td class="windowbg" align="left">', $member['registered_date'], '</td>

Code ("Replace") Select
            <td class="windowbg" align="left">', $member['registered_date'], '</td>
            <td class="windowbg" align="left">', $member['last_login'], '</td>


Custom theme edit For SMF 1.1.x only
Code ("Find all occurrences  (Memberlist.template.php)") Select
colspan="12"

Code ("Replace") Select
colspan="13"

Troubleshooting (SMF 1.1.x only)
If the final edit for SMF 1.1.x failed, the one that changes the 'colspan' value, then its possible that you have already installed another mod that adds columns to this list. If that is the case, then you can try to find all cases of this code, where x is greater than 12.
colspan="x"

Replace with this code.
colspan="x+1"

So if the code was like this.
colspan="13"

You would change it to this.
colspan="14"

Remember that you will have to perform that edit four times in the 'Memberlist.template.php' file.

If you need any help with edits for custom themes, then you can ask for it in the support topic for this mod (http://www.simplemachines.org/community/index.php?topic=254470.0), remember that you will have to post the 'Memberlist.template.php' file from your custom theme, otherwise I will not be able to perform the edits.

Version changes
v1.4 - 5 November 2010
Updated for SMF 2 RC4.

v1.03 - 27 May 2010
Changed package info to work with SMF 2 RC3.
Removed official support for SMF versions below SMF 2 RC2.

v1.02 - 19 November 2009
Added support for SMF 2 RC2 and curve. Also updated mod description.

v1.01
Added support for SMF 1.1.6 and SMF 2 Beta 4.0.

v1.0 - 07 August 2008
Original Mod release.
Title: Re: Last Active On MemberList
Post by: edi67 on August 10, 2008, 06:57:24 AM
intersting
Title: Re: Last Active On MemberList
Post by: Kimmie on August 11, 2008, 04:04:34 AM
this is already a default feature on the admins member list. (column heading is "Last Online")
Title: Re: Last Active On MemberList
Post by: DSollick on August 12, 2008, 02:36:52 AM
When installing on SMF 1.1.4 and 1.1.5, it glitches the Members page [It said that there was an error while trying to modify './Themes/default/Memberlist.template.php'], which I'm assuming is the issue I'm seeing in the following image.  Uninstalling the package does not fix the glitch :(
Title: Re: Last Active On MemberList
Post by: Nathaniel on August 12, 2008, 03:46:12 AM
@DSollick,
The error you are experiencing only occurs if you have installed another mod which adds something to the memberlist page. It happens because the title of the list has a property called colspan, which defines how many columns that it takes up, when you add new columns with a mod and multiple mods try to do this, then the title won't cover all of the columns.

To fix this this problem you can try to find all instances (there should be exactly four that you need to edit) in that file with the code : colspan="

And add one to the number that you find afterwards, but be careful. Not all of them need to be changed, only the ones that have a value of about 12, 13 or 14. I can do the edits for you, if you post your Memberlist.template.php file.

Please note, this is not a bug with the mod, if anything its a bug with SMF that makes it harder for mods to be compatible, its fixed in SMF 2 Beta.... ;)
Title: Re: Last Active On MemberList
Post by: DSollick on August 12, 2008, 04:37:15 AM
Thanks for explaining that  :D

Seeing as though I don't trust myself to do the edits myself, I've attached by Memberlist.template.php file.  If you would be so kind as to tell me what line-number the modifications have to be done on, so I can look for myself and edit it if I run into this problem again, that would be awesome :)
Title: Re: Last Active On MemberList
Post by: Nathaniel on August 12, 2008, 05:16:02 AM
Okay, the issue was being caused by a compatiblity problem between the "Gender on the Memberlist" mod and this mod. Basically, they both want to add their own column to the Member List page and this causes errors with SMF 1.1.5 (not with SMF 2 Beta). I have fixed this for your 'Memberlist.template.php' file, these edits appeared on lines 52, 64, 137 and 143 for your file.

I replaced this code:
colspan="13"

With this code:
colspan="14"

If you have to add another column then you could change that value to 15, or if you have to remove one then you could change it to 13. ;)

I have also re-attached your 'Memberlist.template.php' file so that you can use it if you wish.
Title: Re: Last Active On MemberList
Post by: DSollick on August 12, 2008, 05:20:26 AM
Thank you muchly, kind sir :)
Title: Re: Last Active On MemberList
Post by: Simplemachines Cowboy on August 12, 2008, 06:09:24 PM
And it's even sortable.
Nice one.
Title: Re: Last Active On MemberList
Post by: Maliante on August 13, 2008, 02:07:03 PM
i use a dilber mc theme and this theme not have Memberlist.template.php is possible this mod work in this theme or only in default??

Maliante
Title: Re: Last Active On MemberList
Post by: Nathaniel on August 13, 2008, 05:12:20 PM
@Maliante,
It should work automatically for your theme, as long as it doesn't have its own Memberlist.template.php file.

Update:
I have now updated the Downloads page so that it includes instructions for getting this mod to work with custom themes, and the default theme.
Title: Re: Last Active On MemberList
Post by: Nathaniel on September 09, 2008, 10:32:24 PM
Version 1.01
Added support for SMF 1.1.6 and SMF 2 Beta 4.0.
Title: Re: Last Active On MemberList
Post by: David2376 on October 20, 2008, 08:22:55 PM
I have got this mod to properly work BUT I am not showing "Last Login" in the column heading. Is there a way to correct this?
Title: Re: Last Active On MemberList
Post by: Nathaniel on October 21, 2008, 01:05:49 AM
I am not sure what you mean by 'correct', that is an intended part of this mod. Although you can change the 'Last Active' language string to 'Last Login', with the edit below.

Find this code ('Memberlist.php'):
'label' => $txt['lastLoggedIn']

Replace with this code:
'label' => 'Last Login'
Title: Re: Last Active On MemberList
Post by: Jhez on November 12, 2008, 07:09:24 AM
New installation of SMF 1.1.7 yesterday, using existing database. After installing SMF, I have applied a number of very useful packages - lots of love to all of you who make them. After each package, I have carefully gone back to the forum to check that it still worked as intended, not really being interested in having to do another reinstall.

I now find myself with one bug. When I go to my Member list, then use the Member List Position Filter to get only a sublist of members in a specific group, I get an error when I try to sort that group by the field Last Active (from the package Last Active on Memberlist).

The issue does not appear when I sort by any other column visible.




You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0, 30' at line 6
File: /customers/jhez.dk/jhez.dk/httpd.www/eve/dgaf/forum/Sources/Memberlist.php
Line: 662

Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 1.1.7, while your database is at version 1.1.5. The above error might possibly go away if you execute the latest version of upgrade.php.




I so appreciate both features. Can someone get these two excellent persons to work together on making their mods accept each other? Would be immensely useful.

OK, and while this is a bugreport, I do want to recommend the Auto Email Inactive Users feature. As an admin, these three packages has really made my life much easier.

:)
Jhez




My installed mods are

   Mod Name       Version     
1.    Select Admin for Notifications    1.2
2.    RemoveQuotedImages    1.0
3.    Simple Award System    2.0.0.4b
4.    Table From CSV    1.30
5.    Auto Email Inactive Users    1.7
6.    Order Stickied Topics    1.01
7.    Default Membergroup on Registration    1.1
8.    Ellow yellow christmas edition smiley set    1.1.0.1
9.    SMF Chat - by Joseph Szenasi    1.0
10.    Group Moderators    1.4
11.    Manage Members Membergroups    1.0.0
12.    Registration redirection    0.1
13.    Display Age and Location next to posts    1.0
14.    Last Active On MemberList    1.01
15.    Member List Position Filter    1.1.0
16.    Registration - Show Gender mod    1.0.0
17.    No More Ugly Avatar Scrollbars    1.0
18.    AvatarSelect    1.1.2
19.    EmailValidator    1.0
20.    Force Topic Read On Login Mod    1.0
21.    Member Awards    1.0.2
22.    RateThatTopic    1.0

Avatar Packages

   Mod Name    Version    
1.    Sci-Fi Avatars    1.0
2.    Country Flags
Title: Re: Last Active On MemberList
Post by: Nathaniel on December 21, 2008, 03:31:55 AM
@Jhez,
I am only answering your questions that relate to this mod, any other questions can be asked separately in the relevant boards on this forum.

Fixing compatibility issues with the "Member List Position Filter" Mod:
Find the second occurrence of this code from your 'Memberlist.php' file:
      'registered' => array(
         'down' => 'mem.dateRegistered ASC',
         'up' => 'mem.dateRegistered DESC'
      ),


Replace with this code:
      'registered' => array(
         'down' => 'mem.dateRegistered ASC',
         'up' => 'mem.dateRegistered DESC'
      ),
      //   Add the last online column, for the Last Active On MemberList Mod.
      'last_active' => array(
         'down' => 'mem.lastLogin DESC',
         'up' => 'mem.lastLogin ASC'
      ),


I won't be updating this mod to fix this compatibility issue, as its an issue with the other mod adding a new array for the memberlist sorting methods which causes the error (instead of making use of the current/normal list).

@Everyone,
I have tested the "Last Active On MemberList" mod for SMF 1.1.7, and updated the mod site page accordingly.
Title: Re: Last Active On MemberList
Post by: Morp on July 20, 2009, 06:22:24 PM
Could you make this compatible with 1.0.10?
Title: Re: Last Active On MemberList
Post by: Nathaniel on July 21, 2009, 02:24:20 AM
Quote from: Morp on July 20, 2009, 06:22:24 PM
Could you make this compatible with 1.0.10?

I have no intention of making this mod compatible with the SMF 1.0.x line, although I think you are referring to SMF 1.1.10. While I haven't tested this mod for SMF 1.1.10 it should work with it, as there weren't many changes (only security fixes I believe).
Title: Re: Last Active On MemberList
Post by: Morp on July 21, 2009, 07:26:13 AM
Quote from: Nathaniel on July 21, 2009, 02:24:20 AM
Quote from: Morp on July 20, 2009, 06:22:24 PM
Could you make this compatible with 1.0.10?

I have no intention of making this mod compatible with the SMF 1.0.x line, although I think you are referring to SMF 1.1.10. While I haven't tested this mod for SMF 1.1.10 it should work with it, as there weren't many changes (only security fixes I believe).

Yes I meant the 1.1.10, sorry was a bit tired yesterday

__________________

I hope you don't mind.. I made the auto installer compatible with the new version.
Just edit the package-info.xml
you had it compatible with 1.1.4-1.99.99 the new version is at 1.1.1 so you have to lower the 1.1.4 to 1.1.1 or 1.1.10

Cheers
Title: Re: Last Active On MemberList
Post by: ohioreef on October 15, 2009, 10:04:12 PM
I tried installing this on 1.1.10 and I get an error stating the package is either corrupt or incompatible with my version of SMF.
Title: Re: Last Active On MemberList
Post by: ohioreef on October 15, 2009, 10:35:20 PM
I see the issue Morp mentioned, but how do I go about making that change in the package-info.xml file so I can install on 1.1.10?
Title: Re: Last Active On MemberList
Post by: Nathaniel on November 18, 2009, 07:08:40 PM
Version 1.02:
Added support for SMF 2 RC2 and curve. Also updated mod description.

Quote from: ohioreef on October 15, 2009, 10:35:20 PM
I see the issue Morp mentioned, but how do I go about making that change in the package-info.xml file so I can install on 1.1.10?
The issue with the installation for this mod and 1.1.10 was a bug with the SMF package manager. The newest version has a workaround for this issue.
Title: Re: Last Active On MemberList
Post by: ohioreef on November 19, 2009, 09:34:00 AM
Thanks. I ended up getting it installed by dropping back to 1.1.09, installing this mod and then "reupgrading" my SMF.
Title: Re: Last Active On MemberList
Post by: thezkitten on November 19, 2009, 09:34:58 PM
i love this mod, but i was having a buttload of issues!
the last active was really long, too long to fit comfortable in the memberlist, and i had sql errors when i tried to sort by date, this may be due to all the mods i've done to my members list (lots of custom tweeking) and i have a pile of mods as well.
so, i tweeked it to the specs i liked myself!

if anyone else had the same problems i did, you may want to try this (image of final result attached)

With this way, no need to add and type of thing to load,
and your date format will be like this  "2009-11-16"
instead of like this "November 19, 2009, 12:56:34 AM"
and sort without any sql errors


./Sources/Memberlist.php

Find:
'registered' => array(
'label' => $txt[233]
),

Add After:
//last active thingy
'last_login' => array(
'label' => $txt[12399221]
),

      

Find:
'registered' => array(
'down' => 'mem.dateRegistered ASC',
'up' => 'mem.dateRegistered DESC'
),

Add After:
//last acative thingy
'last_login' => array(
'down' => 'mem.lastLogin ASC',
'up' => 'mem.lastLogin DESC'
),

now, i added an extra definition to the language file,
./Themes/default/languages/index.english.php
$txt[12399221] = 'Last Active';
to make it easier on yourself, you can just define it in this file if you want by changing the 'label'
'label' => 'Your Words Here'




-----------------------
      
./Themes/default/Memberlist.template.php

Find:
<td class="windowbg" align="left">', $member['registered_date'], '</td>

Add After:
//last active thingy
<td class="windowbg2" align="left">', $member['last_login_date'], '</td>


If this is your only memberlist mod, in memberlist.template.phpjust change all
colspan="12"
to
colspan="13"

if this is one of many, just add one to your colspan. (there's only 4 you need to change)
Title: Re: Last Active On MemberList
Post by: Nathaniel on May 27, 2010, 06:29:06 AM
v1.03 - 27 May 2010
Changed package info to work with SMF 2 RC3.
Removed official support for SMF versions below SMF 2 RC2.
Title: Re: Last Active On MemberList
Post by: FireDitto on November 05, 2010, 06:17:07 AM
Will this be made RC4 friendly??
Title: Re: Last Active On MemberList
Post by: Nathaniel on November 06, 2010, 07:17:56 AM
v1.4 - 5 November 2010
Updated for SMF 2 RC4.

Quote from: FireDitto on November 05, 2010, 06:17:07 AM
Will this be made RC4 friendly??

Yes. It is now. :D
Title: Re: Last Active On MemberList
Post by: FireDitto on November 06, 2010, 07:06:17 PM
Thank you! This is a very useful mod =D
Title: Re: Last Active On MemberList
Post by: FireDitto on November 06, 2010, 07:12:59 PM
Ah, you called the "Last Active" file "Last Post".

It installed the "Last Active", but was a little confusing trying to find the right file to upload.

=)
Title: Re: Last Active On MemberList
Post by: Nathaniel on November 06, 2010, 09:25:13 PM
Apologies for the confusion caused, I updated a lot of mods last night, looks like I got that name wrong for that package. :S

Its the right mod though, which is a good. ;) I've updated it so that the package has the correct name.
Title: Re: Last Active On MemberList
Post by: FireDitto on November 07, 2010, 01:23:39 AM
That's fine =)
Title: Re: Last Active On MemberList
Post by: GhostHunter on April 23, 2011, 01:03:36 PM
This is a great mod, thanks to Nathaniel for creating it!

I am having a persistent problem that I am unable to solve. I get the following error when I try to sort the memberlist by the Last Active column:

DATABASE ERROR

Unknown column 'mem.last_login' in 'order clause'
File: /public_html/smf/Sources/Memberlist.php
Line: 360

I am using SMF 1.1.13, DilberMC theme. There are no other mods that alter the memberlist installed (that I know of). The mod works fine when sorting by other columns, and patches specific to 1.1.xx have been done. I have tried the tweaks posted by thezkitten in reply #23 of this thread, no joy.

Any clues?

Made the following changes:

./Sources/Memberlist.php

Find:
      'registered' => array(
         'label' => $txt['date_registered']
      ),

Replace with:
      'registered' => array(
         'label' => $txt[233]
      ),

(Fixed missing "Date Registered" text in column header)

./Themes/default/languages/index.english.php
Find:
$txt[233] = 'Date Registered';
Add after:
$txt['lastLoggedIn'] = 'Last Active';

This changed the error message when trying to sort on Last Active to:

Database Error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0, 30' at line 5
File: /home/jimnu0c/public_html/NEBRASKAGHOSTS/smf/Sources/Memberlist.php
Line: 351

I also get this error when I try to sort on Date Registered:

Database Error
Unknown column 'mem.date_registered' in 'order clause'
File: /home/jimnu0c/public_html/NEBRASKAGHOSTS/smf/Sources/Memberlist.php
Line: 351

Other columns sort normally.

This one is a little beyond me at this point. Any help would be appreciated.

TIA

Jim
Title: Re: Last Active On MemberList
Post by: Markco on June 21, 2011, 04:47:02 AM
Please i would like to change the format of date "30-01-2011" in version 2.0Gold

Thank's

++
Title: Re: Last Active On MemberList
Post by: Nathaniel on June 21, 2011, 06:43:03 AM
Quote from: Markco on June 21, 2011, 04:47:02 AM
Please i would like to change the format of date "30-01-2011" in version 2.0Gold

Thank's

++

This mod depends only on SMF's date format, if you want to change the format then you will need to change the overall forum setting.
Title: Re: Last Active On MemberList
Post by: Markco on June 23, 2011, 02:05:04 AM
Ok Thank's
Title: Re: Last Active On MemberList
Post by: Senkusha on January 12, 2023, 01:36:38 PM
I suppose since this MOD is quite old, that there's very little hope of having it updated for SMF 2.1.x?
Title: Re: Last Active On MemberList
Post by: Steve on January 12, 2023, 06:22:01 PM
You never know unless you ask. The @Nathaniel was here today so he should see your post on his next visit.