Skip to content

Commit

Permalink
1.7.4
Browse files Browse the repository at this point in the history
Added task rewards underneath post title
  • Loading branch information
eballarin committed Jun 16, 2014
1 parent 894848b commit 5657a3a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
3 changes: 2 additions & 1 deletion game-on.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Description: Adds support for a point system and currency for your users.
Authors: Semar Yousif, Vincent Astolfi, Ezio Ballarin, Forest Hoffman, Austin Vuong, Spencer Nussbaum, Isaac Canada
Author URI: http://maclab.guhsd.net/
Version: 1.7.3
Version: 1.7.4
*/
include('go_datatable.php');
include('types/types.php');
Expand Down Expand Up @@ -44,6 +44,7 @@
add_action('go_return_minutes','go_return_minutes');
add_action('go_display_user_focuses', 'go_display_user_focuses');
add_action('go_return_task_amount_in_chain', 'go_return_task_amount_in_chain');
add_action('go_display_rewards', 'go_display_rewards');
add_action('admin_menu', 'go_ranks');
add_action('admin_menu', 'go_clipboard');
add_action('admin_menu', 'go_mail');
Expand Down
41 changes: 39 additions & 2 deletions types/tasks/task_shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ function go_task_shortcode($atts, $content = null) {

$test_active = $custom_fields['go_mta_test_lock'][0];

$number_of_stages = 4;

if ($test_active) {
$test_returns = $custom_fields['go_mta_test_lock_loot'][0];
$test_num = $custom_fields['go_mta_test_lock_num'][0];
Expand Down Expand Up @@ -163,6 +165,8 @@ function go_task_shortcode($atts, $content = null) {
}

$repeat_message = $custom_fields['go_mta_repeat_message'][0]; // Repeat Message
}else{
$number_of_stages = 3;
}

if($custom_fields['go_mta_time_filter'][0]){ // Checks if the task has a time filter
Expand Down Expand Up @@ -281,7 +285,6 @@ function go_task_shortcode($atts, $content = null) {
}
} else {

//Stage Stuff
global $wpdb;
$user_ID = get_current_user_id(); // User ID
$go_table_ind = $wpdb->prefix.'go';
Expand All @@ -303,6 +306,8 @@ function go_task_shortcode($atts, $content = null) {
if($category_names && $user_focus){
$go_ahead = array_intersect($user_focus, $category_names);
}
go_display_rewards($points_array, $currency_array,$number_of_stages);
echo '<script type="text/javascript">jQuery(".entry-title").after(jQuery(".go_task_rewards"));</script>';
?>

<div id="go_description"> <?php echo do_shortcode(wpautop($description));?> </div>
Expand Down Expand Up @@ -1986,4 +1991,36 @@ function task_change_stage() {

die();
}
?>
function go_display_rewards($points_array, $currency_array, $number_of_stages){
echo '<div class="go_task_rewards" style="margin: 6px 0px 6px 0px;"><strong>Rewards</strong><br/>';
for($i=0;$i<$number_of_stages;$i++){
if($points_array[$i] == 0){
$points_array[$i] = '';
$points_name = '';
}else{
$points_name = go_return_options('go_points_name');
}
if($currency_array[$i] == 0){
$currency_array[$i] = '';
$currency_name = '';
}else{
$currency_name = go_return_options('go_currency_name');
}
switch($i){
case 0:
echo go_return_options('go_first_stage_name').' - '.$points_array[$i].' '.$points_name.' '.$currency_array[$i].' '.$currency_name.'<br/>';
break;
case 1:
echo go_return_options('go_second_stage_name').' - '.$points_array[$i].' '.$points_name.' '.$currency_array[$i].' '.$currency_name.'<br/>';
break;
case 2:
echo go_return_options('go_third_stage_name').' - '.$points_array[$i].' '.$points_name.' '.$currency_array[$i].' '.$currency_name.'<br/>';
break;
case 3:
echo go_return_options('go_fourth_stage_name').' - '.$points_array[$i].' '.$points_name.' '.$currency_array[$i].' '.$currency_name.'<br/>';
break;
}
}
echo '</div>';
}
?>

0 comments on commit 5657a3a

Please sign in to comment.