MyBB Community Forums

Full Version: User Blog Systems On Their Profiles [REQUEST]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If this is a repeat...am sorry...

Is it possible for users to have a blog system on their profiles??? Where they can post blog entries and have comments...and their buddylist can show up in the sidebars or something...or maybe set the permissions to buddies only or registered members only or for everyone to comment or view or both?

I mean is it possible for users to have some sort of blog system on their profiles or even on the forum itself?
I know there's a 'guest book' mod... That should suffice for the comments. I don't know of a plugin that puts a blog in each profile...
i havent seen one so far which is why am requestin it here...Smile
(2008-02-24, 09:36 PM)LadyAngelique Wrote: [ -> ]i havent seen one so far which is why am requestin it here...Smile
Blog & Profile Wink
Include customize css (background, color), background music.
If you want Blog & Profile, I will share my code for you.

Demo my profile & blog (mybb 1.4.2). It isn't a blog, but it's same a blog.
http://www.vnsay.com/hoctienganh/user-1.html
That layout is pretty bad.
Been asking, hoping and praying here for a profile blog mod for years. There's very little interest in developing one.
(2008-10-24, 03:10 AM)IMPAQ Wrote: [ -> ]Been asking, hoping and praying here for a profile blog mod for years. There's very little interest in developing one.

Well I talked to nickman about his profile mod(not blogs) and he said there is a problem with it.

If you change it to much plugins for profiles won't work any more. As well it's how MyBB works Toungue.
Yeah, I hear ya. Doesn't seem like there's much interest in expanding on the user profile with MyBB, though. Been like that since I started using the software. I think it's a missed opportunity, but that's just me. I see a lot of modifications that add user info in the postbit, but don't duplicate that same info in the profile, which is completely beyond me as to why they don't.

Anyways, a user profile blog system has been done with different other forum software, so it's doable, but I do recognize that it must be insanely difficult to code and maintain since many of the free options for vb and the like have been abandoned since.
I'd also like some sort of blog for the members...

Just not sure how it should look like Wink

myb123- will you share your code? Smile
It isn't difficult, but you need connect database and query table. You should back up database before do it, event error, you can backup again. Not harmful!
Note:
1.This code for SEO forum, if you turn off SEO, you need fix some url yourself and translate Vietnamese to your language.
2.Your TABLE_PREFIX is mybb_

Install:
1. Edit your file member.php in root forum.

Find code:
$plugins->run_hooks("member_profile_end");
Add before this code:
// blog vnsay $memprofile['uid']          $mybb->user['uid']
			// default blog css
			$css_default="
   body {background: #5FCBEF url(http://i219.photobucket.com/albums/cc76/babyskill2/360/pain_bottom.jpg) bottom no-repeat;

   color:#000000;

   font:11px verdana, arial, helvetica, sans serif;

   margin:0px 0px 0px 0px;

   padding:0px;

   scrollbar-face-color:#ffffff;

   scrollbar-arrow-color:#666666;

   scrollbar-track-color:#ffffff;

   scrollbar-shadow-color:#000000;

   scrollbar-highlight-color:#cccccc;

   scrollbar-3dlight-color:#999999;

   scrollbar-darkshadow-Color:#333333;

     }

a:link {
	color: #026CB1;
	text-decoration: none;
}

a:visited {
	color: #026CB1;
	text-decoration: none;
}

a:hover, a:active {
	color: #000;
	text-decoration: underline;
}

 #header {
background-image: url(http://i219.photobucket.com/albums/cc76/babyskill2/360/pain_top.jpg) ; 
 background-repeat:no-repeat;
 background-position-x: left; 
 background-position-y:top;
 width:100%;
 height:100%;
}

.main_table {
	background: #FFFFFF;
	width:100%;
	padding: 10px;
}

.tborder {
	background: #81A2C4;
	width: 100%;
	margin: auto auto;
	border: 1px solid #0F5C8E;
}

.trow1 {
	background: #f5f5f5;
}

.trow2 {
	background: #EFEFEF;
}

.thead {
	background: rgb(140, 182, 231);
	color: #000000;
	font-style:italic;
	font-weight:bold;
}

.comment{
background-color: #ececec;
width: 460px;
padding: 10px;
}

.commentfooter{
background: url(images/blog/arrow.gif) 20px 0 no-repeat;
padding-left: 58px;
padding-top: 1px;
margin-bottom: 2em;
font-size: 90%;
color: #4A4A4A;
}

.height_header{
        height:300px;
	padding: 10px;
}

.height_footer{
	height: 700px;
	padding: 10px;
}

";

			// edit blog
			if($memprofile['uid']==$mybb->user['uid'])
			{
			$css_edit=$_POST["css"];
			$bg_music_edit=$_POST["bg_music"];
			$change_bg_music=$_POST["change_bg_music"];
			$change_css=$_POST["change_css"];
			if($change_bg_music=="")
				{
				$uid=$mybb->user['uid'];
				$result=mysql_query("SELECT * FROM mybb_users WHERE uid='$uid' ");
				$row = mysql_fetch_array($result);
				$bg_music_edit=$row['blog_bg_music'];
				}
				else
				{
				mysql_query("UPDATE mybb_users SET blog_bg_music='$bg_music_edit' WHERE uid='$uid' ");
				}
			if($change_css=="")
			{
			$uid=$mybb->user['uid'];
			$result=mysql_query("SELECT * FROM mybb_users WHERE uid='$uid' ");
			$row = mysql_fetch_array($result);
			$css_edit=$row['blog_css'];
			}
			else
			{
			mysql_query("UPDATE mybb_users SET blog_css='$css_edit' WHERE uid='$uid' ");
			}
			$blog_bg_music_edit="
			<form action='user-".$uid.".html' method='post'>
			<input type='hidden' value='1' name='change_bg_music'>
			Edit Link Background Music:<br> <textarea cols=65 rows=3 name='bg_music'/>".$bg_music_edit."</textarea><br>
			<input type='submit' value= 'Apply Background Music'/><br><small>Chú ý: Link nhạc nền là các link trực tiếp các file nhạc (không trợ giúp nhạc flash)</small>
			</form>
			";
			$blog_css_edit.="
			<form action='user-".$uid.".html' method='post'>
			Change CSS".$change_css."<br>
			<input type='hidden' value='1' name='change_css'>
			Edit Blog Css:<br> <textarea cols=65 rows=15 name='css'/>".$css_edit."</textarea><br>
			<input type='submit' value= 'Apply'/><br><small>Nếu bạn muốn dùng CSS default hãy để trống. Nếu bạn muốn sửa theo ý của bạn, hãy copy đoạn mã bên dưới và paste vào bên trên và sửa:</small><br>
			<textarea READONLY cols=65 rows=7 />".$css_default."</textarea><br>
			</form>
			";
			}


			// option background
			if($change_css=="")
			{
			 if($memprofile['blog_css']=="")
			  {
			   $css=$css_default;
			  }
			  else
			  {
			  $css=$memprofile['blog_css'];
			  }
			}
			 else
			{
			 if($css_edit=="")
			  {
			  $css=$css_default;
			  }
			  else
			  {
			  $css=$css_edit;
			  }
			}
			if($change_bg_music=="") $bg_music=$memprofile['blog_bg_music']; else $bg_music=$bg_music_edit;

			// entry menu new
			if($memprofile['uid']==$mybb->user['uid']) $entry_menu_new="<a href='newthread.php?fid=261'>Click here to write your new entry</a>";

			// buddy list
			$user_buddylist="";
			$fix="fixed";
			$uid=$memprofile['uid'];
			$result=mysql_query("SELECT * FROM mybb_users WHERE uid='$uid' ");
			$row = mysql_fetch_array($result);
			$buddylist=$row['buddylist'];
			$user_first=0;
			$user_length=strlen($buddylist);
			$i=1;
			$j=0;
			$j_max=10;// gioi han so nguoi hien len trong list nay.
			$avatar_default="http://www.sideshowtoy.com/img/icon-person.gif";
			if($user_length!=0)
			  {
				$user_buddylist.="<table cellspacing=5>";
				while(stripos($buddylist,",",$user_first)!="" && $j<=$j_max)
				{
					$user_end=stripos($buddylist,",",$user_first);
					$user_length=$user_end-$user_first;
					$uid=substr($buddylist,$user_first,$user_length);
					$result=mysql_query("SELECT * FROM mybb_users WHERE uid='$uid' ");
					$row = mysql_fetch_array($result);
					$username=$row['username'];
					$usergroup=$row['usergroup'];
					$displaygroup=$row['displaygroup'];
					$username_no_format=$username;
					if(strlen($username)>=6) $username=substr($username,0,6)."..";
					$username=format_name($username, $usergroup, $displaygroup);
					if($row['avatar']=="") $avatar_list="http://www.sideshowtoy.com/img/icon-person.gif"; else $avatar_list=$row['avatar'];
					if($i%3==0)
						{
						$user_buddylist.="<td valign=bottom><a href='user-".$uid.".html' title='".$username_no_format."'><img src='".$avatar_list."' width=50px height=50px><br>".$username."</a></td></tr>";
						}
					else
						{
							if($i%2==0)
							$user_buddylist.="<td valign=bottom><a href='user-".$uid.".html' title='".$username_no_format."'><img src='".$avatar_list."' width=50px height=50px><br>".$username."</a></td>";
							else
							$user_buddylist.="<tr><td valign=bottom><a href='user-".$uid.".html' title='".$username_no_format."'><img src='".$avatar_list."' width=50px height=50px><br>".$username."</a></td>";
						}
					$j++;
					$user_first=$user_end+1;
					$i++;
					if($i==4) $i=1;
				}
				$user_length=strlen($buddylist)-$user_first;
					$uid=substr($buddylist,$user_first,$user_length);
					$result=mysql_query("SELECT * FROM mybb_users WHERE uid='$uid' ");
					$row = mysql_fetch_array($result);
					$username=$row['username'];
					$usergroup=$row['usergroup'];
					$displaygroup=$row['displaygroup'];
					$username_no_format=$username;
					if(strlen($username)>=6) $username=substr($username,0,6)."..";
					$username=format_name($username, $usergroup, $displaygroup);
					if($row['avatar']=="") $avatar_list="http://www.sideshowtoy.com/img/icon-person.gif"; else $avatar_list=$row['avatar'];
					if($i%3==0)
						{
						$user_buddylist.="<td valign=bottom><a href='user-".$uid.".html' title='".$username_no_format."'><img src='".$avatar_list."' width=50px height=50px><br>".$username."</a></td></tr><tr><td valign=bottom>";
						if($memprofile['uid']==$mybb->user['uid']) $user_buddylist.="<a href='usercp.php?action=editlists' title='Add household & budd'><img src='".$avatar_default."' width=50px height=50px><br>+ Add</a>";
						$user_buddylist.="</td></tr></table>";
						}
					else
						{
							if($i%2==0)
							{
							$user_buddylist.="<td valign=bottom><a href='user-".$uid.".html' title='".$username_no_format."'><img src='".$avatar_list."' width=50px height=50px><br>".$username."</a></td>";
							if($memprofile['uid']==$mybb->user['uid']) $user_buddylist.="<a href='usercp.php?action=editlists' title='Add household & budd'><img src='".$avatar_default."' width=50px height=50px><br>+ Add</a>";
							$user_buddylist.="</td><td valign=bottom></td></tr></table>";
							}
							else
							{
							$user_buddylist.="<tr><td valign=bottom><a href='user-".$uid.".html' title='".$username_no_format."'><img src='".$avatar_list."' width=50px height=50px><br>".$username."</a></td>";
							if($memprofile['uid']==$mybb->user['uid']) $user_buddylist.="<a href='usercp.php?action=editlists' title='Add household & budd'><img src='".$avatar_default."' width=50px height=50px><br>+ Add</a>";
							$user_buddylist.="</td><td valign=bottom></td><td valign=bottom></td></tr></table>";
							}
						}
				$buddylist=$user_buddylist;
			  }
			 else
			  {
				if($memprofile['uid']==$mybb->user['uid']) $buddylist="<a href='usercp.php?action=editlists' title='Add household & budd'><img src='".$avatar_default."' width=50px height=50px><br>+ Add</a>";
			  }	

			////archives
			$archives="";
			$query = $db->simple_select("posts", "message,subject,tid", "fid='261'	AND uid='".$memprofile['uid']."' AND replyto='0' ", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => '30'));
			while($row = $db->fetch_array($query))
			{
				$tid= $row['tid'];
				$subject_blog_post= $row['subject'];
				$archives.="<a href=thread-".$tid.".html>".$subject_blog_post."</a><br>";
			}

                                          $forum = get_forum("261");
			$parser_options = array(
				"allow_html" => "0",
				"allow_mycode" => $forum['allowmycode'],
				"allow_smilies" => $forum['allowsmilies'],
				"allow_imgcode" => $forum['allowimgcode'],
				"filter_badwords" => 1
			);

			$blog_post="";

			$i=1;
			$query = $db->simple_select("posts", "message,subject,tid,pid", "fid='261'	AND uid='".$memprofile['uid']."' AND replyto='0' ", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => '3'));
			while($row = $db->fetch_array($query))
			{
			if ($i<=3)
				{
					$tid=$row['tid'];
					$j=-1;
					$query_count_reply = $db->simple_select("posts", "uid","tid='".$tid."' ", array('order_by' => 'dateline', 'order_dir' => 'DESC'));
					while($row_count_reply = $db->fetch_array($query_count_reply))
						{
						 $j++;
						}
					$pid=$row['pid'];
					$subject_blog_post=$row['subject'];
					$message=$row['message'];
					$message_blog_post=$parser->parse_message($message, $parser_options);
					$blog_post.="
<table border=\"0\" cellspacing=\"1\" cellpadding=\"5\" class=\"tborder\"><tr><td class=\"thead\">Subject : ".$subject_blog_post."</td></tr><tr><td class=\"trow1\">".$message_blog_post."<br><a href=thread-".$tid.".html>Read Entry (post in forum)</a><br>(".$j.") comment(s) for this entry.<br><br>";
if($memprofile['uid']==$mybb->user['uid']) $blog_post.="<a href='editpost.php?pid=".$pid."'>Click here to edit this entry</a><br>";
$blog_post.="</td></tr></table><br><br>
";
				}
				else break;
			$i++;
			}
// bai viet o forum <> bai viet trong box nhat ky
			$i=1;
			$query = $db->simple_select("posts", "message,subject,tid,pid", "fid<>'261' AND uid='".$memprofile['uid']."' AND replyto='0' ", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => '2'));
			while($row = $db->fetch_array($query))
			{
			if ($i<=2)
				{
					$tid=$row['tid'];
					$j=-1;
					$query_count_reply = $db->simple_select("posts", "uid","tid='".$tid."' ", array('order_by' => 'dateline', 'order_dir' => 'DESC'));
					while($row_count_reply = $db->fetch_array($query_count_reply))
						{
						 $j++;
						}
					$pid=$row['pid'];
					$subject_blog_post= $row['subject'];
					$message = $row['message'];
					$message_blog_post = $parser->parse_message($message, $parser_options);
					$blog_post.="
<table border=\"0\" cellspacing=\"1\" cellpadding=\"5\" class=\"tborder\"><tr><td class=\"thead\">Subject : ".$subject_blog_post."</td></tr><tr><td class=\"trow1\">".$message_blog_post."<br><a href=thread-".$tid.".html>Read Entry (post in forum)</a><br>(".$j.") comment(s) for this entry.<br><br>";
if($memprofile['uid']==$mybb->user['uid']) $blog_post.="<a href='editpost.php?pid=".$pid."'>Click here to edit this entry</a><br>";
$blog_post.="</td></tr></table><br><br>
";
				}
				else break;
			$i++;
			}

2. Edit template member_profile in Admin Control Panel

<html>
<head>
<title>{$mybb->settings['bbname']} - {$lang->profile}</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<style>
{$css}
</style>

</head>
<body onLoad="AutoResize(640,480);">
<div id="header">

<table width=100% CELLPADDING="5">
<tr>
<td class="height_header" colspan="3" align=center>
<strong><font size=3 color=white>Vnsay's Member</font><br><br>It isn't a blog, but it's same a blog.</strong>
</td>
</tr>
<tr>
<td width=200px valign=top>

<table border="0" cellspacing="1" cellpadding="5" class="tborder"><tr><td class="thead">
Profile
</td></tr><tr>
<td class="trow1">
<strong>{$formattedname}</strong><br>
({$usertitle})<br>
{$groupimage}<br>
{$userstars}<br>
{$avatar}<br>
<b>Menu</b><br>
<a href=http://www.vnsay.com>Website Vnsay</a>
</td>
</tr>
</table>

</td>
<td valign=top>

<table class="main_table">
<tr>
<td>
<div class="comment">
<b>Thông báo:</b> Website đang nâng cấp profile của thành viên, có thể thêm background riêng, nhạc nền trong profile..
</div>
<div class="commentfooter">Admin Vnsay</div>

<div class="comment">
{$memprofile['signature']}
</div>
<div class="commentfooter">{$formattedname}</div>

<br><br>
{$entry_menu_new}
<br>
<strong>Newest Entry</strong><br>
{$blog_post}
</td>
</tr>
</table>

<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="trow1">
<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td class="trow1" width="75%">
<span class="largetext"><strong>{$formattedname}</strong></span><br />
<span class="smalltext">
({$usertitle})<br />
{$groupimage}
{$userstars}<br />
<br />
<strong>{$lang->registration_date}</strong> {$memregdate}<br />
<strong>{$lang->date_of_birth}</strong> {$membday} {$membdayage}<br />
<strong>{$lang->local_time}</strong> {$localtime}<br />
<strong>{$lang->postbit_status}</strong> {$online_status}
</span>
</td><td width="25%" align="right" valign="middle">{$avatar}</td></tr></table>
</td>
</tr>
{$awaybit}
</table>
<br />
<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td width="50%" valign="top">
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td colspan="2" class="thead"><strong>{$lang->users_forum_info}</strong></td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->joined}</strong></td>
<td class="trow1">{$memregdate}</td>
</tr>
<tr>
<td class="trow2"><strong>{$lang->lastvisit}</strong></td>
<td class="trow2">{$memlastvisitdate} {$memlastvisittime}</td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->total_posts}</strong></td>
<td class="trow1">{$memprofile['postnum']} ({$lang->ppd_percent_total})<br /><span class="smalltext">(<a href="search.php?action=finduserthreads&amp;uid={$uid}">{$lang->find_threads}</a> &mdash; <a href="search.php?action=finduser&amp;uid={$uid}">{$lang->find_posts}</a>)</span></td>
</tr>
<tr>
<td class="trow2"><strong>{$lang->timeonline}</strong></td>
<td class="trow2">{$timeonline}</td>
</tr>
{$reputation}
{$warning_level}
</table>
<br />
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td colspan="2" class="thead"><strong>{$lang->users_contact_details}</strong></td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->homepage}</strong></td>
<td class="trow1">{$website}</td>
</tr>
{$sendemail}
<tr>
<td class="trow2"><strong>{$lang->pm}</strong></td>
<td class="trow2"><a href="private.php?action=send&amp;uid={$memprofile['uid']}">{$lang->send_pm}</a></td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->icq_number}</strong></td>
<td class="trow1"><a href="javascript:;" onclick="MyBB.popupWindow('misc.php?action=imcenter&amp;imtype=icq&amp;uid={$uid}', 'imcenter', 450, 300);">{$memprofile['icq']}</a></td>
</tr>
<tr>
<td class="trow2"><strong>{$lang->aim_screenname}</strong></td>
<td class="trow2"><a href="javascript:;" onclick="MyBB.popupWindow('misc.php?action=imcenter&amp;imtype=aim&amp;uid={$uid}', 'imcenter', 450, 300);">{$memprofile['aim']}</a></td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->yahoo_id}</strong></td>
<td class="trow1"><a href="javascript:;" onclick="MyBB.popupWindow('misc.php?action=imcenter&amp;imtype=yahoo&amp;uid={$uid}', 'imcenter', 450, 300);">{$memprofile['yahoo']}</a></td>
</tr>
<tr>
<td class="trow2"><strong>{$lang->msn}</strong></td>
<td class="trow2"><a href="javascript:;" onclick="MyBB.popupWindow('misc.php?action=imcenter&amp;imtype=msn&amp;uid={$uid}', 'imcenter', 450, 300);">{$memprofile['msn']}</a></td>
</tr>
</table>
</td>
<td><img src="{$theme['imgdir']}/pixel.gif" height="1" width="8" alt=""/></td>
<td width="50%" valign="top">
{$profilefields}
{$signature}
{$modoptions}
</td>
</tr>
<tr>
<td height=30px align=bottom>
</td>
</tr>
</table>
<center>{$blog_css_edit}
{$blog_bg_music_edit}
Background Music<br>
<object id="MediaPlayer" width="300" height="75" classid="CLSID:22D6F312-BOF6-11D0-94AB-0080C74C7E95" standby="Đang tải dữ liệu.} type="application/x-oleobject"><param name="FileName" value="{$bg_music}"><param name="AutoStart" value="true"><embed type="application/x-mplayer2" src="{$bg_music}" name="MediaPlayer" width="300" height="75" autostart="1"></embed></object>
</center>

</td>
<td width=200px valign=top>

<table border="0" cellspacing="1" cellpadding="5" class="tborder"><tr><td class="thead">
Household & buddy list
</td></tr><tr>
<td class="trow1">
{$buddylist}
</td>
</tr>
</table>
<br>
<table border="0" cellspacing="1" cellpadding="5" class="tborder"><tr><td class="thead">
Archives
</td></tr><tr>
<td class="trow1">
$archives
</td>
</tr>
</table>

</td>
</tr>
<tr>
<td class="height_footer">
</td>
</tr>
</table>

</div>
</body>
</html>

3. Query table

Run query:
ALTER TABLE mybb_users ADD blog_css text null;
ALTER TABLE mybb_users ADD blog_bg_music varbinary(250) null;

4. Upload image to root forum in your host file

images/blog/arrow.gif