From c15eee48f9da1469cf3cdca3a48ba2d3c382a7c9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 17 Oct 2012 20:30:23 +0000 Subject: [PATCH] Added listing of sub id enhanced referral links in member area + used sub id in referral list --- .gitattributes | 2 ++ inc/extensions/ext-user.php | 13 +++++-- inc/filter/user_filter.php | 34 +++++++++++++++++++ inc/language/user_de.php | 3 ++ inc/libs/user_functions.php | 18 ++++++++++ inc/modules/member/what-reflinks.php | 3 ++ inc/referral-functions.php | 12 +++++-- .../member/member_list_referral_level.tpl | 9 +++-- .../html/member/member_list_referral_row.tpl | 3 ++ .../member_list_reflink_user_subids.tpl | 15 ++++++++ .../member_list_reflink_user_subids_row.tpl | 4 +++ templates/de/html/member/member_reflink.tpl | 4 +++ 12 files changed, 112 insertions(+), 8 deletions(-) create mode 100644 templates/de/html/member/member_list_reflink_user_subids.tpl create mode 100644 templates/de/html/member/member_list_reflink_user_subids_row.tpl diff --git a/.gitattributes b/.gitattributes index 85ea562c34..02f544e0e1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1997,6 +1997,8 @@ templates/de/html/member/member_list_referal_row.tpl svneol=native#text/plain templates/de/html/member/member_list_referral.tpl svneol=native#text/plain templates/de/html/member/member_list_referral_level.tpl svneol=native#text/plain templates/de/html/member/member_list_referral_row.tpl svneol=native#text/plain +templates/de/html/member/member_list_reflink_user_subids.tpl svneol=native#text/plain +templates/de/html/member/member_list_reflink_user_subids_row.tpl svneol=native#text/plain templates/de/html/member/member_list_reflinks.tpl svneol=native#text/plain templates/de/html/member/member_list_reflinks_row.tpl svneol=native#text/plain templates/de/html/member/member_list_subid_stats.tpl svneol=native#text/plain diff --git a/inc/extensions/ext-user.php b/inc/extensions/ext-user.php index af69d72851..5436f59e6a 100644 --- a/inc/extensions/ext-user.php +++ b/inc/extensions/ext-user.php @@ -41,10 +41,10 @@ if (!defined('__SECURITY')) { } // END - if // Version number -setThisExtensionVersion('0.5.5'); +setThisExtensionVersion('0.5.6'); // Version history array (add more with , '0.0.1' and so on) -setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5')); +setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6')); // Keep this extension always active! setExtensionAlwaysActive('Y'); @@ -199,6 +199,7 @@ INDEX (`stats_type`)", unregisterFilter(__FILE__, __LINE__, 'update_referral_data', 'GENERIC_UPDATE_USER_REFERRAL', true, isExtensionDryRun()); unregisterFilter(__FILE__, __LINE__, 'update_referral_data', 'UPDATE_USER_SUBID', true, isExtensionDryRun()); unregisterFilter(__FILE__, __LINE__, 'member_admin_actions', 'ADD_USER_SUBID_MEMBER_ACTION', true, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'member_reflink_extra_content', 'MEMBER_REFLINK_USER_SUBIDS_CONTENT', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension @@ -643,6 +644,14 @@ INDEX (`subid`)", // Register filter registerFilter(__FILE__, __LINE__, 'member_admin_actions', 'ADD_USER_SUBID_MEMBER_ACTION', false, true, isExtensionDryRun()); + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Weiteren Filter für Mitglieder-Aktionen im Adminbereich hinzugefügt."); + break; + + case '0.5.6': // SQL queries for v0.5.6 + // Register filter + registerFilter(__FILE__, __LINE__, 'member_reflink_extra_content', 'MEMBER_REFLINK_USER_SUBIDS_CONTENT', false, true, isExtensionDryRun()); + // Update notes (these will be set as task text!) setExtensionUpdateNotes("Weiteren Filter für Mitglieder-Aktionen im Adminbereich hinzugefügt."); break; diff --git a/inc/filter/user_filter.php b/inc/filter/user_filter.php index 27980937c2..150568dbdf 100644 --- a/inc/filter/user_filter.php +++ b/inc/filter/user_filter.php @@ -238,5 +238,39 @@ function FILTER_ADD_USER_SUBID_MEMBER_ACTION ($filterData) { return $filterData; } +// Filter for rendering content for sub id listing in what=reflinks +function FILTER_MEMBER_REFLINK_USER_SUBIDS_CONTENT ($content = '') { + // Do this only for members + assert(isMember()); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + + // Does the current user have sub ids? + if (getTotalMemberSubIds() > 0) { + // Then Load all + $result = SQL_QUERY_ESC('SELECT `id`, `subid` FROM `{?_MYSQL_PREFIX?}_user_subids` WHERE `userid`=%s ORDER BY `subid` ASC', + array(getMemberId()), __FUNCTION__, __LINE__); + + // There should be entries left + assert(!SQL_HASZERONUMS($result)); + + // Load all + $out = ''; + while ($row = SQL_FETCHARRAY($result)) { + // Load row template + $out .= loadTemplate('member_list_reflink_user_subids_row', true, $row); + } // END - while + + // Load main template + $content .= loadTemplate('member_list_reflink_user_subids', true, $out); + + // Free result + SQL_FREERESULT($result); + } // END - if + + // Return data + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + return $content; +} + // [EOF] ?> diff --git a/inc/language/user_de.php b/inc/language/user_de.php index 99dce95edb..ba353ef6a1 100644 --- a/inc/language/user_de.php +++ b/inc/language/user_de.php @@ -128,6 +128,8 @@ addMessages(array( 'MEMBER_CHANGE_USER_SUBID' => "Geben Sie eine neue ein:", 'MEMBER_INVALID_DO_USER_SUBID' => "Ungültiges Sub-Modul aufgerufen! Sollten Sie der Meinung sein, dies ist ein Fehler, so teilen Sie bitte dem Support mit, wie es zu dieser Meldung gekommen ist.", 'MEMBER_BACK_SUBIDS_OVERVIEW_LINK' => "Zurück zur Sub-Id-Übersicht ...", + 'MEMBER_REFLINK_USER_SUBIDS_HEADER' => "Hier sehen Sie alle Ihre Sub-Ids, die Sie eingegeben haben. Sie können anstelle der User-Id auch Ihren Nicknamen verwenden.", + 'MEMBER_REFLINK_USER_SUBIDS_NOTICE' => "Hinweis: Tipp! Legen Sie sich z.B. pro Besuchertausch und Mailtausch je eine Sub-Ids zum genaueren Tracking an. Somit können Sie genauer feststellen, worüber das geworbene Mitglied sich angemeldet hat.", // Member - sub ids - submit buttons 'MEMBER_USER_SUBIDS_ADD_SUBMIT' => "Sub-Id hinzufügen", @@ -154,6 +156,7 @@ addMessages(array( 'MEMBER_EDIT_USER_SUBIDS_TITLE' => "Ausgewählte Sub-Ids editieren", 'MEMBER_DELETE_USER_SUBIDS_TITLE' => "Ausgewählte Sub-Ids löschen", 'MEMBER_SUBID_STATS_TITLE' => "Aufrufstatistik für Ihre Sub-Ids", + 'MEMBER_REFLINK_USER_SUBIDS_TITLE' => "Ihr Referral-Link mit Sub-Ids zusammen benutzen", // Admin - sub ids - titles 'ADMIN_EDIT_USER_SUBID_TITLE' => "Ausgewählte Sub-Ids ändern", diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index d0b5379881..bce9fc7579 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -798,6 +798,9 @@ function createTesterUserAccount () { // Checks whether the given sub id is fused by current member function isMemberSubIdFree ($subId) { + // Only do this for logged-in members + assert(isMember()); + // Check it $isFree = (countSumTotalData(getMemberId(), 'user_subids', 'id', 'userid', true, sprintf(" AND `subid`='%s'", $subId)) == 0); @@ -872,6 +875,21 @@ function getSubId ($id) { return $GLOBALS[__FUNCTION__][$id]; } +// "Getter for total count of current user's sub ids +function getTotalMemberSubIds () { + // Only do this for logged-in members + assert(isMember()); + + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = countSumTotalData(getMemberId(), 'user_subids', 'id', 'userid', true); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + //----------------------------------------------------------------------------- // EL code functions //----------------------------------------------------------------------------- diff --git a/inc/modules/member/what-reflinks.php b/inc/modules/member/what-reflinks.php index eef4ea8fe0..82a9d43786 100644 --- a/inc/modules/member/what-reflinks.php +++ b/inc/modules/member/what-reflinks.php @@ -116,6 +116,9 @@ if (!SQL_HASZERONUMS($result)) { // Free result SQL_FREERESULT($result); +// Add extra content through filter +$content['extra_content'] = runFilterChain('member_reflink_extra_content'); + // Load main template loadTemplate('member_reflink', false, $content); diff --git a/inc/referral-functions.php b/inc/referral-functions.php index ad4b3f9fee..fc628b3daa 100644 --- a/inc/referral-functions.php +++ b/inc/referral-functions.php @@ -388,8 +388,14 @@ function getUserReferralPoints ($userid, $level) { $refs = array(); // Get refs from database - $result = SQL_QUERY_ESC("SELECT - ur.`id`, ur.`refid`, ud.`status`, ud.`last_online`, ud.`mails_confirmed`, ud.`emails_received` + $result = SQL_QUERY_ESC('SELECT + ur.`id`, + ur.`refid`, + ud.`status`, + ud.`last_online`, + ud.`mails_confirmed`, + ud.`emails_received`, + ud.`subid` FROM `{?_MYSQL_PREFIX?}_user_refs` AS `ur` LEFT JOIN @@ -405,7 +411,7 @@ WHERE ur.`userid`=%s AND ur.`level`=%s ORDER BY - ur.`refid` ASC", + ur.`refid` ASC', array( bigintval($userid), bigintval($level) diff --git a/templates/de/html/member/member_list_referral_level.tpl b/templates/de/html/member/member_list_referral_level.tpl index 00d94b74e8..4310c01b28 100644 --- a/templates/de/html/member/member_list_referral_level.tpl +++ b/templates/de/html/member/member_list_referral_level.tpl @@ -2,7 +2,7 @@ - @@ -22,13 +22,16 @@ - + $content[rows] - diff --git a/templates/de/html/member/member_list_referral_row.tpl b/templates/de/html/member/member_list_referral_row.tpl index 556b7579ac..4458928f36 100644 --- a/templates/de/html/member/member_list_referral_row.tpl +++ b/templates/de/html/member/member_list_referral_row.tpl @@ -17,4 +17,7 @@ + diff --git a/templates/de/html/member/member_list_reflink_user_subids.tpl b/templates/de/html/member/member_list_reflink_user_subids.tpl new file mode 100644 index 0000000000..de0b898d25 --- /dev/null +++ b/templates/de/html/member/member_list_reflink_user_subids.tpl @@ -0,0 +1,15 @@ +
+
+
+ {--MEMBER_REFLINK_USER_SUBIDS_TITLE--} +
+{--MEMBER_REFLINK_USER_SUBIDS_HEADER--} +
    +$content +
+
+ +
+ {--MEMBER_REFLINK_USER_SUBIDS_NOTICE--} +
+
diff --git a/templates/de/html/member/member_list_reflink_user_subids_row.tpl b/templates/de/html/member/member_list_reflink_user_subids_row.tpl new file mode 100644 index 0000000000..56c602bdcd --- /dev/null +++ b/templates/de/html/member/member_list_reflink_user_subids_row.tpl @@ -0,0 +1,4 @@ +
  • + {?URL?}/ref.php?refid={%pipe,getMemberId%}&subid=$content[subid]
    + {--MEMBER_USER_SUBID_STATS_LINK--} +
  • diff --git a/templates/de/html/member/member_reflink.tpl b/templates/de/html/member/member_reflink.tpl index cf9926c9a7..153caa15cc 100644 --- a/templates/de/html/member/member_reflink.tpl +++ b/templates/de/html/member/member_reflink.tpl @@ -28,6 +28,10 @@ $content[nickname_content] +
    + $content[extra_content] +
    +
    $content[refbanner_content]
    -- 2.39.5
    + {--MEMBER_REFLIST_LIST_TITLE_1--}$content[level]{--MEMBER_REFLIST_LIST_TITLE_2--}$content[percents]{--MEMBER_REFLIST_LIST_TITLE_3--}
    {--MEMBER_CLICK_RATE--} + {--MEMBER_REFLIST_ACTIVITY--} + {--SUBID_VALUE--} +
    $content[activity] + {%pipe,fixEmptyContentToDashes=$content[subid]%} +