diff --git a/src/acore-wp-plugin/src/Components/AdminPanel/Pages/ElunaSettings.php b/src/acore-wp-plugin/src/Components/AdminPanel/Pages/ElunaSettings.php index 9a6c9daf5..6ba0396cd 100644 --- a/src/acore-wp-plugin/src/Components/AdminPanel/Pages/ElunaSettings.php +++ b/src/acore-wp-plugin/src/Components/AdminPanel/Pages/ElunaSettings.php @@ -96,6 +96,17 @@ + eluna_recruit_a_friend != '1') echo 'style="display:none;"'?>> + + + + + + + diff --git a/src/acore-wp-plugin/src/Components/UserPanel/Pages/RafProgressPage.php b/src/acore-wp-plugin/src/Components/UserPanel/Pages/RafProgressPage.php index f7c5b8ea8..1fd3b765c 100644 --- a/src/acore-wp-plugin/src/Components/UserPanel/Pages/RafProgressPage.php +++ b/src/acore-wp-plugin/src/Components/UserPanel/Pages/RafProgressPage.php @@ -12,7 +12,11 @@ echo "

" . __('Recruit a Friend', Opts::I()->page_alias) . "

"; ?>

Recruit your friends, help them to level up and get very awesome unique prizes.

+ eluna_raf_config['end_raf_on_same_ip'] === '1') { ?>

Recruiting from the same IP address will cause the RAF to be automatically removed and no new RAF can be applied again.

+ +

Whilst you can recruit a friend who shares an IP address, you will only get the teleport & XP bonuses, no rewards will be given (these are provided only to those who recruit people not on their own IP address).

+
diff --git a/src/acore-wp-plugin/src/Components/UserPanel/UserController.php b/src/acore-wp-plugin/src/Components/UserPanel/UserController.php index d4a3c2c31..1199fb418 100644 --- a/src/acore-wp-plugin/src/Components/UserPanel/UserController.php +++ b/src/acore-wp-plugin/src/Components/UserPanel/UserController.php @@ -97,32 +97,40 @@ public function showRafProgress() { if (!isset($accId)) { wp_die("

An error ocurred while loading your account information, please try again later. If this errors continues, please ask for support.

"); } - $query = "SELECT `account_id`, `recruiter_account`, `time_stamp`, `ip_abuse_counter`, `kick_counter` - FROM `recruit_a_friend_links` - WHERE `account_id` = $accId - "; - $conn = $acServices->getElunaMgr()->getConnection(); - $queryResult = $conn->executeQuery($query); - $rafPersonalInfo = $queryResult->fetchAssociative(); - - $query = "SELECT COALESCE(`reward_level`, 0) as reward_level - FROM `recruit_a_friend_rewards` - WHERE `recruiter_account` = $accId - "; - $conn = $acServices->getElunaMgr()->getConnection(); - $queryResult = $conn->executeQuery($query); - $rafPersonalProgress = $queryResult->fetchAssociative(); - - if (!isset($rafPersonalProgress['reward_level'])) { - $rafPersonalProgress = ['reward_level' => 0]; - } - $query = "SELECT `account_id`, `recruiter_account`, `time_stamp`, `ip_abuse_counter`, `kick_counter` - FROM `recruit_a_friend_links` - WHERE `recruiter_account` = $accId - "; - $queryResult = $conn->executeQuery($query); - $rafRecruitedInfo = $queryResult->fetchAllAssociative(); + try { + $conn = $acServices->getElunaMgr()->getConnection(); + + $query = "SELECT `account_id`, `recruiter_account`, `time_stamp`, `ip_abuse_counter`, `kick_counter` + FROM `recruit_a_friend_links` + WHERE `account_id` = $accId + "; + $queryResult = $conn->executeQuery($query); + $rafPersonalInfo = $queryResult->fetchAssociative(); + + $query = "SELECT COALESCE(`reward_level`, 0) as reward_level + FROM `recruit_a_friend_rewards` + WHERE `recruiter_account` = $accId + "; + $queryResult = $conn->executeQuery($query); + $rafPersonalProgress = $queryResult->fetchAssociative(); + + if (!isset($rafPersonalProgress['reward_level'])) { + $rafPersonalProgress = ['reward_level' => 0]; + } + + $query = "SELECT `account_id`, `recruiter_account`, `time_stamp`, `ip_abuse_counter`, `kick_counter` + FROM `recruit_a_friend_links` + WHERE `recruiter_account` = $accId + "; + $queryResult = $conn->executeQuery($query); + $rafRecruitedInfo = $queryResult->fetchAllAssociative(); + } catch (\Exception $e) { + echo '

Recruit a Friend

' + . '

No Recruit-A-Friend installation was found. ' + . 'Please ensure the Eluna database is properly configured and the RAF module is installed on your server.

'; + return; + } echo $this->getView()->getRafProgressRender($rafPersonalInfo, $rafPersonalProgress, $rafRecruitedInfo); } diff --git a/src/acore-wp-plugin/src/Manager/Opts.php b/src/acore-wp-plugin/src/Manager/Opts.php index 5cea638bc..d94880216 100644 --- a/src/acore-wp-plugin/src/Manager/Opts.php +++ b/src/acore-wp-plugin/src/Manager/Opts.php @@ -36,7 +36,7 @@ class Opts { public $acore_db_eluna_pass=""; public $acore_db_eluna_name=""; public $eluna_recruit_a_friend=""; - public $eluna_raf_config=["check_ip" => '0']; + public $eluna_raf_config=["check_ip" => '0', "end_raf_on_same_ip" => '1']; public $acore_resurrection_scroll=""; public $acore_resurrection_scroll_days_inactive="180"; public $acore_item_restoration="";