Author Topic: Request: Last 20 registred user ???  (Read 7455 times)

0 Members and 1 Guest are viewing this topic.

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Request: Last 20 registred user ???
« on: August 25, 2006, 10:27:23 PM »
i've installed a mod before for i lost it, and i can't find it !!

how can i (or find) it ??? show the last 5 or 20 registred users at my site ??  :|

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Request: Last 20 registred user ???
« Reply #1 on: August 26, 2006, 01:54:28 AM »
show where?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: Request: Last 20 registred user ???
« Reply #2 on: August 26, 2006, 03:17:01 AM »

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Request: Last 20 registred user ???
« Reply #3 on: February 04, 2008, 04:28:51 PM »
This is old post but here:

// Step 1

In index.php file,

find:

Code: [Select]
//-----------------------------------------------------
//--- Show last registered users ----------------------
//-----------------------------------------------------
if (defined('SHOW_LAST_REGISTERED_USERS') && SHOW_LAST_REGISTERED_USERS == 1) {

if (isset($additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
    $additional_sql = "";
    foreach ($additional_user_fields as $key => $val) {
        $additional_sql .= ", " . $key;
    }
}

$sql = "

SELECT " . get_user_table_field("", "user_id") . get_user_table_field(", ", "user_name") . get_user_table_field(", ", "user_joindate") . ((isset($additional_sql)) ? $additional_sql  : "") . "
FROM " . USERS_TABLE . "
WHERE " . get_user_table_field("", "user_level") . " >= '" . USER . "'
ORDER BY " . get_user_table_field("", "user_joindate") . " DESC
LIMIT " . ((defined('SHOW_LAST_REGISTERED_USERS_LIMIT')) ? SHOW_LAST_REGISTERED_USERS_LIMIT : 20) . "

";

$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);

$last_registered_users_content = "";
$bgcounter = 0;
while ($user_row = $site_db->fetch_array($result)) {
    $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;   
   
    $user_id = $user_row[$user_table_fields['user_id']];
    $user_name = format_text(trim($user_row[$user_table_fields['user_name']]), 2);
    $user_joindate = (function_exists('get_universal_field_date')) ? get_universal_field_date($user_row[$user_table_fields['user_joindate']]) : format_date($config['date_format'] . " " . $config['time_format'], $user_row[$user_table_fields['user_joindate']]);   
   
    $site_template->register_vars(array(   
    "user_name" => $user_name,
    "user_url" => $site_sess->url(ROOT_PATH . "member.php?action=showprofile&" . URL_USER_ID . "=" . $user_id),
    "user_joindate" => $user_joindate,
    "count" => $row_bg_number
    ));
    if (isset($additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
      $additional_field_array = array();
      foreach ($additional_user_fields as $key => $val) {
        $additional_field_array[$key] = (isset($user_row[$key]) && !empty($user_row[$key])) ? format_text(trim($user_row[$key]), 1) : REPLACE_EMPTY;
        $additional_field_array['lang_'.$key] = $val[0];
      }
      if (isset($additional_field_array) && is_array($additional_field_array) && !empty($additional_field_array)) {
        $site_template->register_vars($additional_field_array);
      }
      unset ($additional_field_array);
    }
    $last_registered_users_content .= $site_template->parse_template("member_last_registered_content");   
}

$site_template->register_vars(array(
"lang_last_registered_users_title" => $lang['last_registered_users_title'],
"lang_last_registered_users_user_name" => $lang['last_registered_users_user_name'],
"lang_last_registered_users_user_joindate" => $lang['last_registered_users_user_joindate'],
"lang_last_registered_users_count" => (defined('SHOW_LAST_REGISTERED_USERS_LIMIT')) ? preg_replace("/" . $site_template->start . "show_last_registered_users_count" . $site_template->end . "/siU", $num_rows, $lang['last_registered_users_limit']) : "",
"show_last_registered_users_content" => $last_registered_users_content
));
unset ($last_registered_users_content);
unset ($additional_sql);
}

// Step 2

In includes/constants.php file,

add in top ?>:

Code: [Select]
// Show last registered users.
define('SHOW_LAST_REGISTERED_USERS', 1); // 1 for active. 0 for inactive.
define('SHOW_LAST_REGISTERED_USERS_LIMIT', 20); // Set limit.

For active and set limit.

// Step 3

In lang/english/main.php file,

add in top ?>:

Code: [Select]
// Show last registered users.
$lang['last_registered_users_title'] = "Last registered users";
$lang['last_registered_users_user_name'] = "Username";
$lang['last_registered_users_user_joindate'] = "Join date";
$lang['last_registered_users_limit'] = "There are: <b>{show_last_registered_users_count}</b> user(s) found.";

//Step 4

In templates/your_template/home.html file,

add this where you want for show:

Code: [Select]
{if show_last_registered_users_content}
                 <br />
                 <table width="450" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="100%" class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="4">
                          <tr>
                            <td width="100%" class="head1" valign="top">{lang_last_registered_users_title}</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                    </table>
                    <table width="100%" border="0" cellspacing="0" cellpadding="4">
                    <tr>
   <td width="100%" class="row2" align="right" valign="top">{lang_last_registered_users_count}&nbsp;&nbsp;</td>
                    </tr>
                    </table>
                    <table width="100%" border="0" cellspacing="0" cellpadding="4">
                    <tr>
   <td width="50%" class="head1" align="center" valign="top">{lang_last_registered_users_user_name}</td>
   <td width="50%" class="head1" align="center" valign="top">{lang_last_registered_users_user_joindate}</td>
                    </tr>
                    </table>
                    <table width="100%" border="1" cellspacing="0" cellpadding="4" class="tablebottom" />
                    {show_last_registered_users_content}
                  </table>
                 {endif show_last_registered_users_content}

// Step 5

In templates/your_template - create new file: member_last_registered_content.html .

Add:

Code: [Select]
<tr>
   <td width="50%" align="center" valign="top" class="row{count}"><a href="{user_url}">{user_name}</a></td>
   <td width="50%" align="center" valign="top" class="row{count}">{user_joindate}</td>
</tr>

Finish.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Bob

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
Re: Request: Last 20 registred user ???
« Reply #4 on: May 26, 2008, 03:17:56 PM »
This is old post but here:

//Step 4

In templates/your_template/home.html file,

add this where you want for show:

Code: [Select]
{if show_last_registered_users_content}
                 <br />
                 <table width="450" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="100%" class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="4">
                          <tr>
                            <td width="100%" class="head1" valign="top">{lang_last_registered_users_title}</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                    </table>
                    <table width="100%" border="0" cellspacing="0" cellpadding="4">
                    <tr>
   <td width="100%" class="row2" align="right" valign="top">{lang_last_registered_users_count}&nbsp;&nbsp;</td>
                    </tr>
                    </table>
                    <table width="100%" border="0" cellspacing="0" cellpadding="4">
                    <tr>
   <td width="50%" class="head1" align="center" valign="top">{lang_last_registered_users_user_name}</td>
   <td width="50%" class="head1" align="center" valign="top">{lang_last_registered_users_user_joindate}</td>
                    </tr>
                    </table>
                    <table width="100%" border="1" cellspacing="0" cellpadding="4" class="tablebottom" />
                    {show_last_registered_users_content}
                  </table>
                 {endif show_last_registered_users_content}

Finish.

Hi thunderstrike,

i need it in user_logininfo.html and in user_loginform.html but it not works!

there no text and links can u pls help?
« Last Edit: May 26, 2008, 03:37:57 PM by Bob »