buzzlair
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [user files] Can you change order files are displayed?in functions.php, create new function, list them in array.
########################## # My List User Files # ########################## function MyListUserFiles($files,$userID,$fl) { global $wpdb; global $post; $c = 1; //why c is created and defined as 1? // foreach is used to list file foreach($files as $Thefile) { $ext = pathinfo($Thefile['file'], PATHINFO_EXTENSION); $tExt = SetIcon($ext); // for the icon $rowClass = ($c++%2==1)?'odd_files':'even_files'; // what does this mean? echo '<td class="'.$rowClass.'" align="center"><img src="'. $tExt.'" width="20" style="margin-top: 5px; margin-bottom: -5px; -webkit-box-shadow: inset 0px 0px 10px 0px rgba(3, 156, 212, 0.14); box-shadow: inset 0px 0px 10px 0px rgba(3, 156, 212, 0.14);"></td>'; // Document Description echo '<td class="'.$rowClass.'" width="50%" style="font-weight: bold; font-size: 12px;">'.pathinfo($Thefile['file'], PATHINFO_FILENAME) .'</td>'; // Date Uploaded echo '<td class="'.$rowClass.'" align="center" width="60px">'. GetTimeStamp($Thefile['file'],$userID) .'</td>'; // Category echo '<td class="'.$rowClass.'" align="center" width="60px">'; $currOpts_defcat = get_option('file_manger_defaultcat'); $getCrntCat = $wpdb->get_var("SELECT category FROM ". $wpdb->prefix . "userfile_data WHERE filename = '".$Thefile['file'] ."' and user_id='" .$userID. "'"); if (!$getCrntCat) { echo $currOpts_defcat; }else{ echo $getCrntCat; } echo'</td>'; if (strpos(curPageName(),'?') ==false){ $dnlLink = curPageName().'?theDLfile='.$userID.'/'.$Thefile['file']; $DelLink = curPageName().'?deletefile='.$userID.'/'.$Thefile['file']; }else{ if(!$post->ID){ $DelLink = curPageName().'&deletefile='.$userID.'/'.$Thefile['file']; $dnlLink = curPageName().'&theDLfile='.$userID.'/'.$Thefile['file']; }else{ $DelLink = '?page_id='.$post->ID.'&deletefile='.$userID.'/'.$Thefile['file']; $dnlLink = '?page_id='.$post->ID.'&theDLfile='.$userID.'/'.$Thefile['file']; } } // Download echo '<td class="'.$rowClass.'" width="80px"><span class="user-files-download"><a href="'.$dnlLink.'">Download</a></span>'; // Delete if(get_option('file_manger_allow_del')=='yes') { echo '<td class="'.$rowClass.'" align="center"><a href="'.$DelLink.'" class="user-files-delete">Delete</a></td></tr>'; } else { echo '</td></tr>'; } } } function cmp($a, $b) { return $b["created_at"] - $a["created_at"]; }
In user-files.php, call them using this
MyListUserFiles($files,$current_user->ID,$count);
Viewing 1 replies (of 1 total)