Of course! "Dede memberlist" refers to the member list functionality in the DedeCMS (织梦内容管理系统), a very popular open-source PHP content management system in China, especially popular in its heyday (roughly 2005-2025).

Here’s a comprehensive breakdown of what the "memberlist" is, how it works, and how to use or modify it.
What is the Dede Memberlist?
The memberlist is a core feature of DedeCMS that allows website administrators to display a list of all registered users on their site. It's typically found at a URL like:
http://www.yourdomain.com/memberlist.php
This page serves several purposes:

- Community Building: It shows visitors that the site has an active user base.
- User Discovery: Members can find and connect with other users.
- Transparency: It provides a public-facing directory of the community.
Core Components of the Memberlist
The memberlist functionality is primarily built from three files:
-
memberlist.php: The main PHP script that handles the logic.- It connects to the database.
- It retrieves user data from the
dede_member(and oftendede_member_space) tables. - It processes pagination to display users across multiple pages.
- It handles search and filtering parameters (e.g., searching by username).
- It includes the template file for display.
-
templets/memberlist.htm: The HTML template file that controls the visual layout.- This is an HTML file embedded with DedeCMS's specific template tags (like
{dede:...}). - It defines the structure of the page, including the table headers, the loop that displays each user, and the pagination controls.
- You can edit this file to change the appearance, add new columns, or remove existing ones without touching the PHP code.
- This is an HTML file embedded with DedeCMS's specific template tags (like
-
Database Tables:
(图片来源网络,侵删)dede_member: Stores the core user information likemtype(member type),userid(username),pwd(password),email,sex,uptime(registration time), etc.dede_member_space: Stores extended user profile information likeuname,annex,spacesta,sign(signature),face(avatar), etc.- The PHP script usually joins these two tables to get a complete profile for each user listed.
How to Customize the Memberlist
The most common reason for looking into the memberlist is to customize it. Here are the most frequent customizations and how to perform them.
Customization A: Change the Displayed Fields (e.g., Add Signature)
Let's say you want to add the user's signature to the list.
-
Edit the Template (
templets/memberlist.htm):- Find the table header row (
<tr>...</tr>). Add a new header for your column. - Find the loop that displays the user data. It usually looks something like this:
{dede:memberlist} <tr> <td><a href='[field:spaceurl/]' target='_blank'><img src='[field:face/]' width='32' height='32' border='0'/></a></td> <td><a href='[field:spaceurl/]' target='_blank'>[field:userid/]</a></td> <td>[field:sex/]</td> <!-- ... other fields ... --> </tr> {/dede:memberlist} - Add a new
<td>inside the<tr>for the signature. Use the DedeCMS tag[field:sign/].{dede:memberlist} <tr> <td><a href='[field:spaceurl/]' target='_blank'><img src='[field:face/]' width='32' height='32' border='0'/></a></td> <td><a href='[field:spaceurl/]' target='_blank'>[field:userid/]</a></td> <td>[field:sex/]</td> <!-- ... other fields ... --> <td>[field:sign/]</td> <!-- NEW COLUMN ADDED HERE --> </tr> {/dede:memberlist}
- Find the table header row (
-
Edit the PHP Logic (
memberlist.php):- Open
memberlist.php. - Find the SQL query that selects the data. It will be a
SELECTstatement from the database. - You need to add the
signfield to the list of selected columns. For example, if the query looks like this:$dsql->SetQuery("SELECT m.mid, m.userid, m.sex, m.face, s.uname, s.spacesta FROM `dede_member` m LEFT JOIN `dede_member_space` s ON m.mid = s.mid ORDER BY m.mid DESC"); - You should modify it to include
s.sign:$dsql->SetQuery("SELECT m.mid, m.userid, m.sex, m.face, s.uname, s.spacesta, s.sign FROM `dede_member` m LEFT JOIN `dede_member_space` s ON m.mid = s.mid ORDER BY m.mid DESC"); - Now, the
[field:sign/]tag in your template will have data to display.
- Open
Customization B: Change the Number of Users Per Page
This is controlled by a variable in memberlist.php.
- Open
memberlist.php. - Look for a line that defines the list size. It will likely be:
$ListNum = 20; // 每页显示多少条记录
- Simply change the value
20to the number you want (e.g.,50or10).
Customization C: Add a Search Feature (by User Group)
By default, the memberlist might only search by username. You can add a filter for user groups (mtype).
-
Edit the Template (
templets/memberlist.htm):- In the search form (
<form>), add a dropdown menu for the user group.<select name='mtype'> <option value=''>所有会员</option> <option value='个人'>个人</option> <option value='企业'>企业</option> <!-- Add more groups as they exist in your system --> </select>
- In the search form (
-
Edit the PHP Logic (
memberlist.php):- Find the part of the code that builds the
WHEREclause of the SQL query. It usually checks ifkeyword(for username search) is set. - Add a new condition to also check for
mtype. - Look for code like this:
if($keyword!='') { $wheres[] = " (m.userid like '%$keyword%' or m.email like '%$keyword%') "; } - Add a new
ifblock for themtypeparameter:if($keyword!='') { $wheres[] = " (m.userid like '%$keyword%' or m.email like '%$keyword%') "; } if($mtype != '') // Check if the mtype parameter is sent from the form { $wheres[] = " m.mtype = '$mtype' "; } - The code that joins the
wheresarray into the final query will automatically include your new filter.
- Find the part of the code that builds the
Common Issues and Troubleshooting
- "Template Not Found" Error: This means DedeCMS cannot locate
templets/memberlist.htm. Make sure the file exists in the correct directory and that the permissions are readable by the web server. - Blank Page or White Screen of Death (WSOD): This is a PHP error. Check for syntax errors in your modified
memberlist.php. Enable error reporting in yourphp.inior check your server's error logs to see the specific error message. - Database Error: The SQL query is likely incorrect. Double-check your
SELECTstatement inmemberlist.phpto ensure you are selecting from the correct tables and that the column names exist. - Pagination Not Working: This is almost always due to an incorrect SQL query or missing variables related to pagination. Ensure your
SELECTquery is correct and that the pagination logic in the PHP file is intact.
Modern Alternatives
While DedeCMS was once dominant, it is now considered legacy software. It has security vulnerabilities, is not mobile-friendly by default, and its codebase is difficult to maintain.
For any new project, consider modern alternatives:
- WordPress: With plugins like "User Profiles" or "Members List," it can easily create a member directory.
- Discourse: A modern, powerful forum platform with excellent member directory features.
- Bolt CMS: A modern, flat-file CMS that is more secure and easier to extend than DedeCMS.
- Custom PHP/MySQL: For full control, building a simple member list from scratch with modern PHP (using PDO/MySQLi) and a front-end framework like Bootstrap is a much better approach.
