Firefox PHP

Module: User List

Posted by Ravenswood 
All files from this thread

File Name File Size   Posted by Date  
userlist-pic.png 46.8 KB open | download Ravenswood 07/14/2009 Read message
user_list_1_0_2.zip 16.1 KB open | download Ravenswood 08/28/2009 Read message
Module: User List
July 14, 2009 12:43AM
This module creates a separate page which lists all registered users. The list gives the following information:

User Number
Username
PM link
Add Buddy Link
No. of Posts
Date Joined
Last Seen

At the moment, there is not a way to change what information is displayed short of hacking the code. In the next version I intend to make fields optional, as well as add support for the "User Tagging" module.

Scriptmonkey templates all have built-in support for this module. For other templates, a line of code must be added to the header template file for a link to the user list to show up. Typically this would be added to the upper right of the page, but the link can be placed in the Control Center, footer, or anywhere else you like.

With the appropriate code inserted, this module has also been tested and works on Emerald and on the following templates available in the download section:

Aeriel Boundaries
Eastlink
Generic Integration
Black/Grey

The generated user list can be sorted by user-number and user-name. Also, there is the ability to search by letter, which makes it much easier when you have a very large member base.

For more screen shots and information, click here.

-------------------------------------------------------------------
"When given a choice, always choose monkeys."



Edited 1 time(s). Last edit at 07/14/2009 12:52AM by Ravenswood.


Attachments:
open | download - user_list_1_0_2.zip (16.1 KB)
Re: Module: User List
July 16, 2009 09:13PM
Thanks for writing this module. A user list has been a recurring request, so I am sure that you have made some administrators happy with this one!


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: User List
July 24, 2009 12:58PM
Hello, it's a great module but sadly I've found a flaw :-(

I've a restricted forum, so you must be logged to see content (and users) but with the addon you can see the user list when you're not identified !

[somewhere]
Re: Module: User List
July 24, 2009 01:58PM
there is no user-view permission in phorum at all.
you can go to each profile.php-url anyway.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Module: User List
July 24, 2009 04:45PM
The module displays users by username or user number. Could it be modified to sort users by REAL NAME? My phorum settings use peoples real names rather than usernames.

- Bob
Re: Module: User List
July 24, 2009 05:33PM
Quote
bilbonsacquet
Hello, it's a great module but sadly I've found a flaw :-(

I've a restricted forum, so you must be logged to see content (and users) but with the addon you can see the user list when you're not identified !

There's several ways you could handle this.

1) You could prevent the link to the User List from appearing unless the user is logged in. In the template file, place
{IF LOGGEDIN}
before the link, and
{/IF}
after it.

2) You could do what we did on my wife's forum. Instead of placing the link to the User List in the header, we put it in the Control Center. Since users can only access the Control Center when they're logged in, this takes care of that problem.

3) Since it's possible for a person to bookmark the page and access it without having a link, you could protect the page itself. Edit the templates in /mods/user_list/templates/emerald/ (There are 8 of them), and on each one, add this at the beginning:
{IF LOGGEDIN}
and this at the end:
{ELSE}
You must be logged in to view this page.
{/IF}

Let me know how that works for you. Thanks.

-------------------------------------------------------------------
"When given a choice, always choose monkeys."
Re: Module: User List
July 24, 2009 06:19PM
Quote
Dismal_Bliss
The module displays users by username or user number. Could it be modified to sort users by REAL NAME? My phorum settings use peoples real names rather than usernames.

- Bob

You could hack the module to do this. I've tested this and it works. If you're not comfortable altering the code, let me know and I can send you the altered file via PM.

Here's how to edit the module to display (and sort by) real name instead of display name. First, download the file (phorum)/mods/user_list/user_list.php .

Edit that file, and look for this code:
    if ($user["real_name"] == $user["display_name"]) {
        unset($user["real_name"]);
    }

Remove that and replace it with this:
    if ($user["real_name"] != '') {
        $user["display_name"] = $user["real_name"];
    }


Find this section:
    // first, count how many there are total
    $select    = 'SELECT COUNT(user_id)';
    $from      = ' FROM ' . $PHORUM['user_table'];
    $use_index = ' USE INDEX (username)';
    $where     = ' WHERE active = ' . PHORUM_USER_ACTIVE;
    if ( isset($letter) ):
        $where .= ' AND username ' . $pattern;
    endif;

In that section, repalce this line:
        $where .= ' AND username ' . $pattern;

with this:
        $where .= ' AND concat( real_name, username ) ' . $pattern;


Now, look for this section:
    // now get a list of everybody we want to display
    $start = $offset * $display_per_page;

    if ( $sort === 'membernumber'):
        $select    = 'SELECT user_id, username';
        $from      = ' FROM ' . $PHORUM['user_table'];
        $use_index = '';
        $where     = ' WHERE active = ' . PHORUM_USER_ACTIVE;
        $order_by  = ' ORDER BY user_id ASC';
        $limit     = " LIMIT $start, $display_per_page";
    else:
        $select    = 'SELECT user_id, username';
        $from      = ' FROM ' . $PHORUM['user_table'];
        $use_index = ' USE INDEX (username)';
        $where     = ' WHERE active = ' . PHORUM_USER_ACTIVE;
        if ( isset($letter) ):
            $where .= ' AND username ' . $pattern;
        endif;
        $order_by  = ' ORDER BY username ASC';
        $limit     = " LIMIT $start, $display_per_page";
    endif;

In that section, replace
            $where .= ' AND username ' . $pattern;
        endif;
        $order_by  = ' ORDER BY username ASC';

with
            $where .= ' AND concat( real_name, username ) ' . $pattern;
        endif;
        $order_by  = ' ORDER BY concat( real_name, username ) ASC';


Save your edited file and upload it back to its original location.

Let me know how this works for you. Thanks.

-------------------------------------------------------------------
"When given a choice, always choose monkeys."



Edited 1 time(s). Last edit at 07/24/2009 06:20PM by Ravenswood.
Re: Module: User List
July 28, 2009 10:41AM
Quote
Ravenswood
Let me know how that works for you. Thanks.
It works !

I've seen that the module is not easily translatable, can you add language files support ? I can do the French translation !
Re: Module: User List
July 28, 2009 02:53PM
I haven't done that before, but I'll give it a try.

Of course, Maurice will be there to help if I have any problems. Right, Maurice? ;)

-------------------------------------------------------------------
"When given a choice, always choose monkeys."
Re: Module: User List
July 28, 2009 04:52PM
Uhuh

Also check out what I did to your module to make profiles accessible for authenticated users only. Key elements: hook:lang| in info.txt, lang/ dir in the mod and the use of {LANG->mod_yourmod->string} strings in the templates.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Sorry, only registered users may post in this forum.

Click here to login