]> git.mxchange.org Git - mailer.git/blobdiff - inc/filter/user_filter.php
Renamed function, used more "pool functions":
[mailer.git] / inc / filter / user_filter.php
index de3ce0efc26ef7ba329ef07d3df8acd4584b8f43..ebc2ef5a3f1858c1d614ee04b1c2da5213407b0e 100644 (file)
@@ -131,7 +131,7 @@ function FILTER_TESTER_USER_REGISTRATION_ADD_SQL_COLUMNS ($filterData) {
 
        // Return filter data
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
-       //* NOISY-DEBUG: */ print __FUNCTION__.':filterData=<pre>'.print_r($filterData,true).'</pre>';
+       //* NOISY-DEBUG: */ print __FUNCTION__.':filterData=<pre>'.print_r($filterData,TRUE).'</pre>';
        return $filterData;
 }
 
@@ -153,7 +153,7 @@ function FILTER_HANDLE_USER_SUBID ($filterData) {
 
        // Return filter data
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
-       //* NOISY-DEBUG: */ print __FUNCTION__.':filterData=<pre>'.print_r($filterData,true).'</pre>';
+       //* NOISY-DEBUG: */ print __FUNCTION__.':filterData=<pre>'.print_r($filterData,TRUE).'</pre>';
        return $filterData;
 }
 
@@ -194,7 +194,7 @@ function FILTER_UPDATE_USER_SUBID ($filterData) {
        $subId = SQL_ESCAPE(getRequestElement('subid'));
 
        // Is the sub id available and registered with referral id?
-       if (countSumTotalData(getReferralId(), 'user_subids', 'id', 'userid', true, sprintf(" AND `subid`='%s'", $subId)) == 1) {
+       if (countSumTotalData(getReferralId(), 'user_subids', 'id', 'userid', TRUE, sprintf(" AND `subid`='%s'", $subId)) == 1) {
                // Sub id is assigned to referral id, so add a record
                SQL_QUERY_ESC("INSERT INTO
        `{?_MYSQL_PREFIX?}_subid_log`
@@ -217,7 +217,7 @@ function FILTER_UPDATE_USER_SUBID ($filterData) {
                        ), __FUNCTION__, __LINE__);
 
                // Add insert id for other filters
-               $filterData['insert_id'] = SQL_INSERTID();
+               $filterData['insert_id'] = SQL_INSERT_ID();
 
                // Register sub id in filter
                setSession('subid', $subId);
@@ -227,5 +227,50 @@ function FILTER_UPDATE_USER_SUBID ($filterData) {
        return $filterData;
 }
 
+// Filter for adding member action
+function FILTER_ADD_USER_SUBID_MEMBER_ACTION ($filterData) {
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
+       // Add entry
+       array_push($filterData, 'list_user_subid');
+
+       // Return data
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
+       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]
 ?>