vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   while + conditional problem (https://vborg.vbsupport.ru/showthread.php?t=80481)

sabret00the 04-24-2005 05:06 PM

while + conditional problem
 
Pretty sure i had this working perfectly, hence why no ones moaned about it not working, but it's actually stopped working for me
PHP Code:

    // Get all users who have applied.
    
$userArray=$DB_site->query("
        SELECT AVG(maf_ratings.rating) AS avgrating, maf_application.*, user.username
        FROM maf_application
        LEFT JOIN maf_ratings ON ( maf_ratings.appid = maf_application.appid )
        LEFT JOIN " 
TABLE_PREFIX "user AS user ON (user.userid = maf_application.userid)
        GROUP BY maf_application.appid
    "
);

    
$threadstuff $DB_site->query_first("
        SELECT *
        FROM " 
TABLE_PREFIX "user
        WHERE username = '" 
.$vboptions[maf_username] . "'
    "
);

    while (
$user=$DB_site->fetch_array($userArray))
    {
        
// Calculate days since joining
        
$currentday time();
        
$daytemp = ($currentday $user[application_time]) / 86400;
        
$day ceil($daytemp);
        
$username $user[username];
        
$userid $user[userid];
        
$avg $user[avgrating];
        
$auto_mailed $user[auto_mailed];
        
$fullname $user[fullname];
       
        
// Email users who we're declining.
        
if ($day >= 14 AND $avg 7)
        {
            
vbmail($user[email],"Moderator Application Feedback""Dear " $fullname ",\n\nThank you for your application for the above post of moderator, unfortunately you were unsuccessful at this time.\n\nHowever you\'re presence and input are appreciated, so please try again in the future.\n\nRegards\n\nThe " $vboptions[bbtitle] . " Team.","From: \"$vboptions[bbtitle] Mailer\" <$vboptions[webmasteremail]>");
            echo(
"Declination Email Sent To  "$user[username] ."<br />");

            
$declinationemail .= ""$user[username]." ";

            if (
$declinationemail)
            {
                
$declinationemail .= ", ";
            }

            
$DB_site->query("DELETE FROM maf_application WHERE userid = $userid");
            
$DB_site->query("DELETE FROM maf_ratings WHERE userid = $userid");
        }
        
// Email users who we're shortlisting.
        
else
        {
            if (
$day >= 14 AND $avg AND $auto_mailed != "")
            {
            
//    $shorlistemail = $user[username];
                
vbmail($user[email],"Moderator Application Feedback""Dear " $fullname ",\n\nThank you for your application for the above post of moderator, congratulations you were successfully shortlisted for the role of moderator.\n\nHowever at this time we're unable to directly instate you, your application was exempt and we're short listing you for the next opening, at which point you'll be further contacted by an administrator to let you know if you were successful or not in your application.\n\nYou\'re presence and input are greatly appreciated, so please try keep up the good work.\n\nRegards\n\nThe " $vboptions[bbtitle] . " Team.","From: \"$vboptions[bbtitle] Mailer\" <$vboptions[webmasteremail]>");
                echo(
"Shortlisting Email Sent To  "$user[username] ."<br />");

                
$shorlistemail .= ""$user[username]." ";

                if (
$shorlistemail)
                {
                    
$shorlistemail .= ", ";
                }

                
$DB_site->query("UPDATE maf_application
                    SET auto_mailed = 1
                    WHERE userid = 
$userid
                "
);
            }
        } 

it hasn't been sending out the shortlisting emails for some reason :( i tried to fix it but i'm not getting any joy :(

Colin F 04-24-2005 08:14 PM

If you're expecting that loop to run through a few users, you could surround it with vbmail_start(); and vbmail_end();

I don't really expect that to fix your problem though :/

sabret00the 04-25-2005 08:19 PM

thanks, though it's likely to just be one or two emails :)

sabret00the 04-26-2005 09:05 PM

*bump*


All times are GMT. The time now is 06:55 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.01089 seconds
  • Memory Usage 1,756KB
  • 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
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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