Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-24-2002, 10:38 PM
BrAinZ's Avatar
BrAinZ BrAinZ is offline
 
Join Date: Dec 2001
Posts: 114
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Find "Inactive" Users

We use a flag in our database to show whether a user account has been made "inactive" (ie disabled so they cant access the board.. used when an emplyee leaves our company).

I am trying to add a line to the user.php file to add a link similar to the FIND ALL USERS that will list all the "inactive" accounts.

This is the SQL query that does what I want..
SELECT * FROM `user` where empactive=0 LIMIT 0, 30

Is there any way I can add this to a link so that user.php will run this query and show the results?

I was hoping that it would be a simple line like the "List visitors in the last 24 hours" link.

Any help would be appreciated!
Reply With Quote
  #2  
Old 07-24-2002, 10:44 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

in your user.php find this line:
PHP Code:
echo "<li><a href=\"user.php?s=$session[sessionhash]&action=find&coppauser=yes\">List all COPPA users</a></li>\n"
after that add this:
PHP Code:
echo "<li><a href=\"user.php?s=$session[sessionhash]&action=find&empactive=no\">List all inactive users</a></li>\n"
then find this
PHP Code:
if ($coppauser=="yes") {
    
$condition.=" AND coppauser=1";
  }
  if (
$coppauser=="no") {
    
$condition.=" AND coppauser=0";
  } 
below it add:
PHP Code:
if ($empactive=="no") {
    
$condition.=" AND empactive=0";
  } 
should be all
Reply With Quote
  #3  
Old 07-24-2002, 11:00 PM
BrAinZ's Avatar
BrAinZ BrAinZ is offline
 
Join Date: Dec 2001
Posts: 114
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Excellent it works.. THANKS! !!

I was half way there.. I already had...

PHP Code:
echo "<li><a href=\"user.php?s=$session[sessionhash]&action=find&empactive=0\">List Inactive Users</a></li>\n"
But why didn't that work ?
Reply With Quote
  #4  
Old 07-25-2002, 10:23 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

because all what you've done was just add a link to the cp, but you didn't tell the script what to do if you click on the link

this part
PHP Code:
if ($empactive=="no") {
    
$condition.=" AND empactive=0";
  } 
tells the script to search for inactive users
Reply With Quote
  #5  
Old 07-25-2002, 10:40 AM
BrAinZ's Avatar
BrAinZ BrAinZ is offline
 
Join Date: Dec 2001
Posts: 114
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ahh right.. got it - Thanks!
Reply With Quote
  #6  
Old 07-25-2002, 12:28 PM
BrAinZ's Avatar
BrAinZ BrAinZ is offline
 
Join Date: Dec 2001
Posts: 114
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok that works, but it's still a pain to trawl through each one to delete it.

I have tried to ammend the MASS PRUNE users search thing to give an option to find any users who show as inactive (as above)..

I've added..

PHP Code:
    if ($empactive) {

        
$sqlconds .= iif($sqlconds=="","WHERE","AND")." empactive = $empactive ";

    } 
and a couple of obvious bits, but it does not seem to work.. anything obvious I am missing?
Reply With Quote
  #7  
Old 07-25-2002, 12:37 PM
BrAinZ's Avatar
BrAinZ BrAinZ is offline
 
Join Date: Dec 2001
Posts: 114
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have also added:

PHP Code:
$empactive intval($empactive); 
and
PHP Code:
$query "SELECT DISTINCT user.userid,username,email,posts,lastvisit,joindate,empactive,user.usergroupid,moderator.moderatorid,usergroup.title 
and
PHP Code:
makehiddencode("empactive",$empactive); 
and
PHP Code:
makeinputcode("Is Ex-Employee (Inactive)","empactive",iif($empactive,$empactive,"1")); 
No idea what any of it does, but it looks logical

What have I missed?
Reply With Quote
  #8  
Old 07-25-2002, 01:56 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

"No idea what any of it does, but it looks logical"
Very good statement

as i see you sometimes change a 0 to 1:
if it is an Ex-Employe then empactive=0 you said in the code empactive=1...

so change
PHP Code:
 if ($empactive) {

        
$sqlconds .= iif($sqlconds=="","WHERE","AND")." empactive = $empactive ";

    } 
to
PHP Code:
if (!$empactive) {

        
$sqlconds .= iif($sqlconds=="","WHERE","AND")." empactive = $empactive ";

    } 
also this
PHP Code:
makeinputcode("Is Ex-Employee (Inactive)","empactive",iif($empactive,$empactive,"1")); 
should be this i think:
PHP Code:
makeyesnocode("Is Employee (Aactive)","empactive",iif($empactive,$empactive,"0")); 
Reply With Quote
  #9  
Old 07-25-2002, 06:44 PM
BrAinZ's Avatar
BrAinZ BrAinZ is offline
 
Join Date: Dec 2001
Posts: 114
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks.. I'm even more confused now

I think what I had actually worked except that the
PHP Code:
if ($empactive) { 
bit seemed to always be FALSE so it didn't do the next bit.

I've resolved it by taking out the IF statement and always running that bit of the query thing.

I'll be so pleased when I understand what I'm talking about

Thanks for your help!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:36 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.10673 seconds
  • Memory Usage 2,270KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (16)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete