Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #21  
Old 06-29-2009, 04:38 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cono1717 View Post
Basically I want to make the following

HTML Code:
<if condition="$auinfo[field7] <(is less than) $conditional">
Post count not met
</if>
PHP Code:
if ($auinfo['field7'] == "I don\'t have a package")
{
    
$conditional 0;
} else if (
$auinfo['field7'] == "SHARED A")
{
    
$conditional 5;
} else if (
$auinfo['field7'] == "SHARED B")
{
    
$conditional 15;
} else if (
$auinfo['field7'] == "SHARED C")
{
    
$conditional 20;
} else if (
$auinfo['field7'] == "SHARED D")
{
    
$conditional 20;
} else if (
$auinfo['field7'] == "RESELLER A")
{
    
$conditional 25;
}
 else if (
$auinfo['field7'] == "RESELLER B")
{
    
$conditional 75;
} else if (
$auinfo['field7'] == "RESELLER C")
{
    
$conditional 200;
}
 else if (
$auinfo['field7'] == "RESELLER D")
{
    
$conditional 200;
} else if (
$auinfo['field7'] == "Custom/Other")
{
    
$conditional 00;

You're trying to do a comparison with a text field and a numeric field?
Reply With Quote
  #22  
Old 06-29-2009, 06:37 PM
cono1717 cono1717 is offline
 
Join Date: Sep 2008
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No in the php file I was trying to set a number to the variable $conditional then use the HTML code to see if the number is lessthan the required number
Reply With Quote
  #23  
Old 06-30-2009, 04:50 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And the problem is that $conditional currently does not contain anything, right?
Reply With Quote
  #24  
Old 06-30-2009, 10:45 AM
cono1717 cono1717 is offline
 
Join Date: Sep 2008
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think so, if you go to http://www.geekstep.com/activity.php?styleid=19 you will see that the column "posts required" is not showing any numbers which means that the action required field cannot function.

@Cryo :- Your suggestion did not work since it is a custom template not the postbit.
Reply With Quote
  #25  
Old 07-01-2009, 11:45 AM
cono1717 cono1717 is offline
 
Join Date: Sep 2008
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anymore suggestions please?
Reply With Quote
  #26  
Old 07-02-2009, 11:58 AM
cono1717 cono1717 is offline
 
Join Date: Sep 2008
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry will have to bump again I really need this please.
Reply With Quote
  #27  
Old 07-02-2009, 02:19 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cono1717 View Post
Sorry will have to bump again I really need this please.
You've made several changes since you first posted your code. Why don't you post exactly what your code and template currently is now so we don't have to look back and try to figure it out.
Reply With Quote
  #28  
Old 07-02-2009, 04:04 PM
cono1717 cono1717 is offline
 
Join Date: Sep 2008
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok here is the activity.php file.

PHP Code:
<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT''activity');

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array('ACTIVITY','ACTIVITY_bits''ACTIVITY_mbits''ACTIVITY_ybits''MEMBERINFO''memberinfo_profilefield');

// pre-cache templates used by specific actions
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

if(empty($_REQUEST['do']))
{

    
// sanitize the variables myself
    
if(empty($_REQUEST['m']))
    {
        
$month vbdate('n');
        
$monthliteral vbdate('F');
    }
    else
    {
        
$month intval($_REQUEST['m']);
        
$monthliteral $months["$_REQUEST[m]"];
    }
    
    if(empty(
$_REQUEST['y']))
    {
        
$year vbdate('Y');
    }
    else
    {
        
$year intval($_REQUEST['y']);
    }

    
// generate months dropdown
    
$months = array(
        
=> 'January',
        
=> 'February',
        
=> 'March',
        
=> 'April',
        
=> 'May',
        
=> 'June',
        
=> 'July',
        
=> 'August',
        
=> 'September',
        
10 => 'October',
        
11 => 'November',
        
12 => 'December'
    
);
    
    foreach(
$months AS $mkey => $mval)
    {
        if(
$mkey == $month)
        {
            
$checked ' selected="selected"';
        }
        eval(
'$mbits .= "' fetch_template('ACTIVITY_mbits') . '";');
        unset(
$checked);
    }
    
    
// generate years dropdown
    
for($i intval(vbdate('Y')); $i intval(vbdate('Y')) + 4$i++)
    {
        if(
$i == $year)
        {
            
$checked2 ' selected="selected"';
        }
        eval(
'$ybits .= "' fetch_template('ACTIVITY_ybits') . '";');
        unset(
$checked2);
    }            
    
    
// important cutoff data
    
$cutoffstart gmmktime(000$month1$year);
    
$cutoffend gmmktime(000$monthvbdate('t'$cutoffstart), $year);
    
    
//echo $cutoffstart . '=' . TIMENOW;
    
    
if($cutoffstart TIMENOW)
    {
        eval(
standard_error('This date is in the future. You cannot select it. Go back and select antoher.'));    
    }
    
    
// limit our records
    
$limit 30000;    

    
// run query
$getusers $vbulletin->db->query("
    SELECT COUNT(p.postid) AS total, p.userid, u.username, u.joindate, f.field7
    FROM " 
TABLE_PREFIX "post AS p
    LEFT JOIN " 
TABLE_PREFIX "user AS u USING (userid)
    LEFT JOIN " 
TABLE_PREFIX "userfield AS f USING (userid)
    WHERE p.dateline > 
$cutoffstart
        AND p.dateline < 
$cutoffend
    GROUP BY userid
    ORDER BY total DESC
    LIMIT 
$limit
"
);  
    
    
$c 0;
    while(
$auinfo $db->fetch_array($getusers))
    {
        
$c++;
        
$auinfo['joindate'] = vbdate($vbulletin->options['dateformat'], $auinfo['joindate'], true);
        eval(
'$userbits .= "' fetch_template('ACTIVITY_bits') . '";');    

    }

    
$navbits construct_navbits(array('' => 'Activity Statistics'));
    eval(
'$navbar = "' fetch_template('navbar') . '";');
    eval(
'$aufield7 = "' fetch_template('postbit') . '";');
    eval(
'print_output("' fetch_template('ACTIVITY') . '");');    
}


if (
$auinfo['field7'] == "I don\'t have a package")
{
    
$conditional 0;
} else if (
$auinfo['field7'] == "SHARED A")
{
    
$conditional 5;
} else if (
$auinfo['field7'] == "SHARED B")
{
    
$conditional 15;
} else if (
$auinfo['field7'] == "SHARED C")
{
    
$conditional 20;
} else if (
$auinfo['field7'] == "SHARED D")
{
    
$conditional 20;
} else if (
$auinfo['field7'] == "RESELLER A")
{
    
$conditional 25;
}
 else if (
$auinfo['field7'] == "RESELLER B")
{
    
$conditional == 75;
} else if (
$auinfo['field7'] == "RESELLER C")
{
    
$conditional == 200;
}
 else if (
$auinfo['field7'] == "RESELLER D")
{
    
$conditional 200;
} else if (
$auinfo['field7'] == "Custom/Other")
{
    
$conditional 00;
}

?>
Here is the ACTIVITY template

HTML Code:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>$vboptions[bbtitle] - Activity Statistics</title>
</head>
<body>
$header
$navbar
<div align="center">
<form action="activity.php" method="get">
<strong>Choose another timeframe:</strong><br />
<select name="m">$mbits</select> <select name="y">$ybits</select> <input type="submit" name="submit" value="Go" />
</form>
</div>
<br />

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="tcat" colspan="6">
		Activity Statistics for $monthliteral
	</td>
</tr>
<tbody>
	<tr>
		<td class="thead">Rank</td>
		<td class="thead">Username</td>
                <td class="thead">Current Package</td>
		<td class="thead">Posts This Month</td>
		<td class="thead">Posts Required</td>
		<td class="thead">Action Needed?</td>

	</tr>
$userbits
</tbody>


</table>
<br /><center>
$vbphrase[accopy]
</center><br />
$footer

</body>
</html>
Here is the ACTIVITY_bits template (incase you need it)

HTML Code:
<tr>
		<td class="alt1">$c</td>
		<td class="alt2"><a href="member.php?$session[sessionurl]u=$auinfo[userid]">$auinfo[username]</a>
		<td class="alt1">$auinfo[field7]</td>
		<td class="alt2">$auinfo[total]</td>
	        <td class="alt1">$conditional</td>
</tr>
They are the only templates that I use in the whole system.
Reply With Quote
  #29  
Old 07-02-2009, 10:08 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You've evaled your ACTIVITY_bits template before you've done all the php to define the variable $conditional. You need to define $conditional before you eval the template otherwise the information isn't available to you in that template.
Reply With Quote
  #30  
Old 07-03-2009, 12:11 PM
cono1717 cono1717 is offline
 
Join Date: Sep 2008
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok I have moved the code and still nothing, here is the new activity.php file

PHP Code:
<?php



// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT''activity');

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array('ACTIVITY','ACTIVITY_bits''ACTIVITY_mbits''ACTIVITY_ybits''MEMBERINFO''memberinfo_profilefield');

// pre-cache templates used by specific actions
$actiontemplates = array();


// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################


if(empty($_REQUEST['do']))
{

    
// sanitize the variables myself
    
if(empty($_REQUEST['m']))
    {
        
$month vbdate('n');
        
$monthliteral vbdate('F');
    }
    else
    {
        
$month intval($_REQUEST['m']);
        
$monthliteral $months["$_REQUEST[m]"];
    }
    
    if(empty(
$_REQUEST['y']))
    {
        
$year vbdate('Y');
    }
    else
    {
        
$year intval($_REQUEST['y']);
    }

    
// generate months dropdown
    
$months = array(
        
=> 'January',
        
=> 'February',
        
=> 'March',
        
=> 'April',
        
=> 'May',
        
=> 'June',
        
=> 'July',
        
=> 'August',
        
=> 'September',
        
10 => 'October',
        
11 => 'November',
        
12 => 'December'
    
);
    
    foreach(
$months AS $mkey => $mval)
    {
        if(
$mkey == $month)
        {
            
$checked ' selected="selected"';
        }
        eval(
'$mbits .= "' fetch_template('ACTIVITY_mbits') . '";');
        unset(
$checked);
    }
    
    
// generate years dropdown
    
for($i intval(vbdate('Y')); $i intval(vbdate('Y')) + 4$i++)
    {
        if(
$i == $year)
        {
            
$checked2 ' selected="selected"';
        }
        eval(
'$ybits .= "' fetch_template('ACTIVITY_ybits') . '";');
        unset(
$checked2);
    }            
    
    
// important cutoff data
    
$cutoffstart gmmktime(000$month1$year);
    
$cutoffend gmmktime(000$monthvbdate('t'$cutoffstart), $year);
    
    
//echo $cutoffstart . '=' . TIMENOW;
    
    
if($cutoffstart TIMENOW)
    {
        eval(
standard_error('This date is in the future. You cannot select it. Go back and select antoher.'));    
    }
    
    
// limit our records
    
$limit 30000;    

    
// run query
$getusers $vbulletin->db->query("
    SELECT COUNT(p.postid) AS total, p.userid, u.username, u.joindate, f.field7
    FROM " 
TABLE_PREFIX "post AS p
    LEFT JOIN " 
TABLE_PREFIX "user AS u USING (userid)
    LEFT JOIN " 
TABLE_PREFIX "userfield AS f USING (userid)
    WHERE p.dateline > 
$cutoffstart
        AND p.dateline < 
$cutoffend
    GROUP BY userid
    ORDER BY total DESC
    LIMIT 
$limit
"
);  
//Let's define those variables

if ($auinfo['field7'] == "I don\'t have a package")
{
    
$conditional 0;
} else if (
$auinfo['field7'] == "SHARED A")
{
    
$conditional 5;
} else if (
$auinfo['field7'] == "SHARED B")
{
    
$conditional 15;
} else if (
$auinfo['field7'] == "SHARED C")
{
    
$conditional 20;
} else if (
$auinfo['field7'] == "SHARED D")
{
    
$conditional 20;
} else if (
$auinfo['field7'] == "RESELLER A")
{
    
$conditional 25;
}
 else if (
$auinfo['field7'] == "RESELLER B")
{
    
$conditional == 75;
} else if (
$auinfo['field7'] == "RESELLER C")
{
    
$conditional == 200;
}
 else if (
$auinfo['field7'] == "RESELLER D")
{
    
$conditional 200;
} else if (
$auinfo['field7'] == "Custom/Other")
{
    
$conditional 00;
}
    
    
$c 0;
    while(
$auinfo $db->fetch_array($getusers))
    {
        
$c++;
        
$auinfo['joindate'] = vbdate($vbulletin->options['dateformat'], $auinfo['joindate'], true);
        eval(
'$userbits .= "' fetch_template('ACTIVITY_bits') . '";');    

    }

    
$navbits construct_navbits(array('' => 'Activity Statistics'));
    eval(
'$navbar = "' fetch_template('navbar') . '";');
    eval(
'$aufield7 = "' fetch_template('postbit') . '";');
    eval(
'print_output("' fetch_template('ACTIVITY') . '");');    
}




?>
--------------- Added [DATE]1246626817[/DATE] at [TIME]1246626817[/TIME] ---------------

If it is easier I could do it in the template system but I don't know if that would be possible
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 05:58 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.05475 seconds
  • Memory Usage 2,399KB
  • Queries Executed 12 (?)
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
  • (3)bbcode_html
  • (3)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete