FLASH MP3PLAYER IN PROFILE PAGE
FLASH MP3PLAYER IN PROFILE PAGE
This places a mp3player (with playlist) on the users profile page. MP3 are uploaded through any album (like pictures). When a mp3 is deleted it will also be removed from the playlist. When there are no mp3's found then the player will not be showing. ONLY limitation that you have to give the mp3 a name in the user_album_update page (at least save it once). Because it uses that name to show it on the playlist. Social engine renames all mp3 files to something stupid.
But here we go.
download flash player extract en place them in your uploads_user folder.
edit user_album_update.php around line 45 AFTER
CODE
// SHOW SUCCESS MESSAGE
$result = 1;
ADD
CODE
// START CREATE MP3 XML FILE
$TempID = $user->user_info[user_id];
$fn = "uploads_user/1000/".$user->user_info[user_id]."/playlist".".xspf";
$WriteHeader = False;
$MP3Found = False;
$sql_text = "SELECT * FROM se_albums WHERE album_user_id = '$TempID'";
if ($r1 = mysql_query($sql_text)){
while ($row1 = mysql_fetch_array($r1)) {
if ($row1['album_user_id'] == $TempID) {
$SearchID = $row1['album_id'];
$sql_text = "SELECT * FROM se_media WHERE media_album_id = '$SearchID'";
if ($r = mysql_query($sql_text)){
while ($row2 = mysql_fetch_array($r)) {
if ($row2['media_ext'] == "mp3") {
if ($WriteHeader === False) {
$file = fopen($fn,"w");
if($file===false) { echo '<font color="red">Cannot open file</font>'; } else {
if (fwrite($file, '') === FALSE) { echo '<font color="red">Cannot write to file, check your chmods</font>'; } else {
fwrite($file, '<?'."xml"." version=".'"'."1.0".'"'." encoding=".'"'."UTF-8".'"'.'?>'."\n");
fwrite($file, '<playlist version='.'"'."1".'"'." xmlns=".'"'.'http://xspf.org/ns/0/'.'">'."\n");
fwrite($file, "<title>WoW player</title>"."\n");
fwrite($file, "<trackList>"."\n");
$MP3Found = True;
$WriteHeader = True; }}
}
if ($WriteHeader === True) {
fwrite($file, "<track>"."\n");
fwrite($file, "<location>uploads_user/1000/".$user->user_info[user_id]."/"."\n");
fwrite($file, $row2['media_id'].".mp3</location>"."\n");
fwrite($file, "<image></image>"."\n");
fwrite($file, "<annotation>".$row2['media_title']."</annotation>"."\n");
fwrite($file, "</track>"."\n"); }
}}}}}}
if ($WriteHeader === True) {
fwrite($file, "</trackList>"."\n");
fwrite($file, "</playlist>"."\n");
fclose($file); }
if ($MP3Found === False) {
if (file_exists($fn)) {unlink($fn);}}
// END CREATE MP3 XML FILE
edit profile.tpl around line 211 AFTER
CODE
<img src='./images/icons/error48.gif' border='0' class='icon_big'>
<div class='page_header'>{$profile3}</div>
{$profile4}
{* DISPLAY ONLY IF PROFILE IS NOT PRIVATE TO VIEWING USER *}
{else}
ADD
CODE
{* START MP3 player *}
{if $xmlexist == TRUE}
<table cellpadding='0' cellspacing='0' width='100%' style='margin-bottom: 10px;'>
<tr>
<td align='center'>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/
flash/swflash.cab#version=7,0,0,0" width="190" height="70">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="uploads_user/xspf_player.swf?playlist_url=uploads_user/1000/{$owner->user_info.user_id}/playlist.xspf&autoplay=true&autoload=true" />
<param name="quality" value="high" />
<embed src="uploads_user/xspf_player.swf?playlist_url=uploads_user/1000/{$owner->user_info.user_id}/playlist.xspf&autoplay=true&autoload=true" quality="high" name="xspf_player" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="center" width="190" height="70">
</embed></object>
</td>
</tr>
</table>
{/if}
{* END MP3 player *}
edit profile.php around line 100 AFTER
CODE
// GET RECENT ACTIVITY (ACTIONS)
$actions = $actions->actions_display();
$actions_total = count($actions);
ADD
CODE
// CHECK MP3 XML FILE
$filename = "uploads_user/1000/".$owner->user_info[user_id]."/playlist".".xspf";
if (file_exists($filename)) {$XMLFound = false;
} else { $XMLFound = true; }
$smarty->assign('xmlexist', $XMLFound);
// CHECK MP3 XML FILE END
edit user_album_upload.tpl around line 38 CHANGE
CODE
<div>{$user_album_upload9} {$space_left} {$user_album_upload17} {$allowed_exts} {$user_album_upload18} {$max_filesize} {$user_album_upload19}</div>
TO
CODE
Код:
<div>{$user_album_upload9} {$space_left} {$user_album_upload17} {$allowed_exts} {$user_album_upload18} {$max_filesize} {$user_album_upload19}
<br>After Adding MP3 files you must give the files a name to let them show up on your profile page<br>
</div>
That's it. Good luck