'check', 'thankyou_receive' => 'check', 'latest_thankyou_given' => 'check', 'latest_thankyou_given_output' => 'select', 'latest_thankyou_receive' => 'check', 'latest_thankyou_receive_output' => 'select', 'thankyou_most_thanked_post' => 'check', ); if ($return_parameters) return $block_parameters; // Check Thank-O-Matic is installed if (!file_exists($sourcedir . '/ThankYouPost.php')) { echo $context['user']['is_admin'] ? $txt['sp_thankomatic_no_exist'] : $txt['sp_thankomatic_no_stats']; return; } // Guest Output elseif ($context['user']['is_guest']) { echo $txt['sp_thankomatic_no_stats']; return; } // Setup the parameter :D $latest_given = !empty($parameters['latest_thankyou_given']); $latest_given_output = empty($parameters['latest_thankyou_given_output']) || $parameters['latest_thankyou_given_output'] > 2 ? 0 : (int) $parameters['latest_thankyou_given_output']; $latest_receive = !empty($parameters['latest_thankyou_receive']); $latest_receive_output = empty($parameters['latest_thankyou_receive_output']) || $parameters['latest_thankyou_receive_output'] > 2 ? 0 : (int) $parameters['latest_thankyou_receive_output']; $given = !empty($parameters['thankyou_given']); $receive = !empty($parameters['thankyou_receive']); $most_thanked_post = !empty($parameters['thankyou_most_thanked_post']); if (!$given && !$receive && !$latest_given && !$latest_receive && !$most_thanked_post) { echo $txt['sp_thankomatic_no_stats']; return; } $data = array(); $users_ids = array(); // Load Member Data if (empty($user_profile[$context['user']['id']])) loadMemberData($context['user']['id']); $data['given'] = $user_profile[$context['user']['id']]['thank_you_post_made']; $data['receive'] = $user_profile[$context['user']['id']]['thank_you_post_became']; if ($given || $receive) $users_ids[] = $context['user']['id']; if ($latest_given && !empty($data['given'])) { $request = $smcFunc['db_query']('', ' SELECT ty.thx_time as thx_time, ty.id_msg as id_msg, ty.id_topic as id_topic' . ($latest_given_output != 1 ? ', msg.id_member as id_poster, msg.poster_name as posterName, msg.subject as subject' : '') . ' FROM {db_prefix}thank_you_post as ty' . ($latest_given_output != 1 ? ' INNER JOIN {db_prefix}messages AS msg ON (ty.id_msg = msg.id_msg)' : '') . ' WHERE ty.id_member = {int:id_member} ORDER BY ty.id_thx_post DESC LIMIT 1', array( 'id_member' => $context['user']['id'], ) ); $data['lastest_given'] = $smcFunc['db_fetch_assoc']($request); $smcFunc['db_free_result']($request); // Aditional Data to prepare :) if (!empty($data['lastest_given']['id_poster'])) $users_ids[] = $data['lastest_given']['id_poster']; } if ($latest_receive && !empty($data['receive'])) { $request = $smcFunc['db_query']('', ' SELECT ty.id_member as id_given, ty.thx_time as thx_time' . ($latest_receive_output != 1 ? ', ty.id_msg as id_msg, ty.id_topic as id_topic, ty.member_name as thxName, msg.subject as subject' : '') . ' FROM {db_prefix}messages AS msg INNER JOIN {db_prefix}thank_you_post as ty ON (ty.id_msg = msg.id_msg) WHERE msg.id_member = {int:id_member} ORDER BY ty.id_thx_post DESC LIMIT 1', array( 'id_member' => $context['user']['id'], ) ); $data['latest_receive'] = $smcFunc['db_fetch_assoc']($request); $smcFunc['db_free_result']($request); // Aditional Data to prepare :) if (!empty($data['latest_receive']['id_given'])) $users_ids[] = $data['latest_receive']['id_given']; } if ($most_thanked_post) { $request = $smcFunc['db_query']('', ' SELECT id_msg, id_topic, subject, thank_you_post_counter FROM {db_prefix}messages WHERE id_member = {int:id_member} ORDER BY thank_you_post_counter DESC LIMIT 1', array( 'id_member' => $context['user']['id'], ) ); $data['most_thanked_post'] = $smcFunc['db_fetch_assoc']($request); $smcFunc['db_free_result']($request); // Okay it will find evertime one, but this is the faste way :) if (empty($data['most_thanked_post']['thank_you_post_counter'])) $data['most_thanked_post'] = array(); } // Load color datas and links if (!empty($users_ids)) sp_loadColors($users_ids); // HR Line add $add_hr = false; // Output given and receive counter if ($given || $receive) { echo ' ', $txt['thank_you_post_thx_display'], ''; echo '