vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Find "Inactive" Users (https://vborg.vbsupport.ru/showthread.php?t=41485)

BrAinZ 07-24-2002 10:38 PM

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!

Xenon 07-24-2002 10:44 PM

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 ;)

BrAinZ 07-24-2002 11:00 PM

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 ?

Xenon 07-25-2002 10:23 AM

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

BrAinZ 07-25-2002 10:40 AM

Ahh right.. got it :) - Thanks!

BrAinZ 07-25-2002 12:28 PM

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?

BrAinZ 07-25-2002 12:37 PM

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?

Xenon 07-25-2002 01:56 PM

"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")); 


BrAinZ 07-25-2002 06:44 PM

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!


All times are GMT. The time now is 10:05 AM.

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.02468 seconds
  • Memory Usage 1,752KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (16)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete