View Single Post
  #144  
Old 12-22-2001, 03:30 PM
the_sisko's Avatar
the_sisko the_sisko is offline
 
Join Date: Oct 2001
Location: Hamburg,Germany
Posts: 132
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just a small add on I created and want to share with you:
It's just a small CP add on which shows all away users.

To add it do the following:
In admin/index.php
FIND:
PHP Code:
makenavselect("Users"); 
Add above:
PHP Code:
makenavoption("Find away user","user.php?action=findaway"); 
In admin/user.php
FIND:
PHP Code:
cpfooter(); 
Add above:
PHP Code:
// ###################### Start findaway #######################
if ($action=="findaway") {

  if (
$orderby=="") {
    
$orderby="awaydate";
  }
  if (
$limitstart=="") {
    
$limitstart=0;
  } else {
    
$limitstart--;
  }
  if (
$limitnumber=="") {
    
$limitnumber=99999999;
  }

  
$users=$DB_site->query("SELECT user.userid,username,FROM_UNIXTIME(awaydate) AS awaydate,returndate,awayreason,away FROM user WHERE away = 1 ORDER BY $orderby $direction LIMIT $limitstart,$limitnumber");
  
$countusers=$DB_site->query_first("SELECT COUNT(*) AS users FROM user WHERE away=1");
  
$limitfinish=$limitstart+$limitnumber;

    echo 
"<p>Showing records ".($limitstart+1)." to ".iif($limitfinish>$countusers[users],$countusers[users],$limitfinish)." of $countusers[users]. Click username to view forum profile.</p>";
  
doformheader("","");

  echo 
"<tr class='tblhead'>";
    echo 
"<td><p><b><span class='tblhead'>Name</span></b></p></td>";
    echo 
"<td><p><b><span class='tblhead'>Options</span></b></p></td>";
    echo 
"<td><p><b><span class='tblhead'>Away reason</span></b></p></td>";
    echo 
"<td><p><b><span class='tblhead'>Away date</span></b></p></td>";
    echo 
"<td><p><b><span class='tblhead'>Return date</span></b></p></td>";
  echo 
"</tr>\n";

  while (
$user=$DB_site->fetch_array($users)) {

    echo 
"<tr class='".getrowbg()."'>";
      echo 
"<td><p><a href='../member.php?s=$session[sessionhash]&action=getinfo&userid=$user[userid]' target='_blank'>$user[username]</a>&nbsp;</p></td>";
      echo 
"<td><p>".
                
makelinkcode("edit","user.php?s=$session[sessionhash]&action=edit&userid=$user[userid]")."
                </p></td>"
;
      echo 
"<td><p>$user[awayreason]&nbsp;</p></td>";
      echo 
"<td><p>$user[awaydate]&nbsp;</p></td>";
      echo 
"<td><p>$user[returndate]</p></td>";
    echo 
"</tr>\n";
  } 
// end while
    
  
echo "</table></td></tr></table></form>";

  if (
$limitnumber!=99999999 AND $limitfinish<$countusers[users]) {
    
doformheader("user","findaway");
    
makehiddencode("ausername",$ausername);
    
makehiddencode("awaydate",$awaydate);
    
makehiddencode("returndate",$returndate);
    
makehiddencode("awayreason",$awayreason);
    
makehiddencode("orderby",$orderby);
    
makehiddencode("direction",$direction);
    
makehiddencode("limitstart",$limitstart+$limitnumber+1);
    
makehiddencode("limitnumber",$limitnumber);
   echo 
"<input type=submit value=\"Show Next Page\">";
  }



Upload the two files and you will find a new link under Users: "Find away user ".

Thats all
Not the best, but it works
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01184 seconds
  • Memory Usage 1,818KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete