MyBB Community Forums

Full Version: welcome box
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
fixed
If you're using any plugin then make sure that its setting is enabled.
boss im not using any plugin for my sidebar, it's just a template edit.. also the settings in portal to show welcomebox is turned on
OK then you need to evaluate that template in index template as well.

Insert the following code just under the index_start hook;
// If user is known, welcome them
if($mybb->settings['portal_showwelcome'] != 0)
{
	if($mybb->user['uid'] != 0)
	{
		// Get number of new posts, threads, announcements
		$query = $db->simple_select("posts", "COUNT(pid) AS newposts", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' $unviewwhere");
		$newposts = $db->fetch_field($query, "newposts");
		if($newposts)
		{ 
			// If there aren't any new posts, there is no point in wasting two more queries
			$query = $db->simple_select("threads", "COUNT(tid) AS newthreads", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' $unviewwhere");
			$newthreads = $db->fetch_field($query, "newthreads");

			$announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']);
			if(is_array($announcementsfids))
			{
				foreach($announcementsfids as $fid)
				{
					$fid_array[] = intval($fid);	
				}
				
				$announcementsfids = implode(',', $fid_array);
				$query = $db->simple_select("threads", "COUNT(tid) AS newann", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' AND fid IN (".$announcementsfids.") $unviewwhere");
				$newann = $db->fetch_field($query, "newann");
			}

			if(!$newthreads)
			{
				$newthreads = 0;
			}

			if(!$newann)
			{
				$newann = 0;
			}
		}
		else
		{
			$newposts = 0;
			$newthreads = 0;
			$newann = 0;
		}

		// Make the text
		if($newann == 1)
		{
			$lang->new_announcements = $lang->new_announcement;
		}
		else
		{
			$lang->new_announcements = $lang->sprintf($lang->new_announcements, $newann);
		}
		if($newthreads == 1)
		{
			$lang->new_threads = $lang->new_thread;
		}
		else
		{
			$lang->new_threads = $lang->sprintf($lang->new_threads, $newthreads);
		}
		if($newposts == 1)
		{
			$lang->new_posts = $lang->new_post;
		}
		else
		{
			$lang->new_posts = $lang->sprintf($lang->new_posts, $newposts);
		}
		eval("\$welcometext = \"".$templates->get("portal_welcome_membertext")."\";");

	}
	else
	{
		$lang->guest_welcome_registration = $lang->sprintf($lang->guest_welcome_registration, $mybb->settings['bburl'] . '/member.php?action=register');
		$mybb->user['username'] = $lang->guest;
		eval("\$welcometext = \"".$templates->get("portal_welcome_guesttext")."\";");
	}
	$lang->welcome = $lang->sprintf($lang->welcome, $mybb->user['username']);
	eval("\$welcome = \"".$templates->get("portal_welcome")."\";");
	if($mybb->user['uid'] == 0)
	{
		$mybb->user['username'] = "";
	}
}
boss can't find index_start in my index template
(2012-01-04, 11:48 AM)jerielm Wrote: [ -> ]boss can't find index_start in my index template

I said "hook", you can see it in ./index.php file available in your forum's root.
(2012-01-03, 02:28 AM)jerielm Wrote: [ -> ]edit-- i have another question how do i run in mysql to disable all forums not to post HTML.. i dont wana do it manually

Forums by default are HTML disabled. You only have to disable when you've enabled it on specific forums. It shouldn't be that hard to do.
hi boss pdtrx yea i know that but i enabled it in most of my forums and im lazy to disable it manually... tnxx cya in pbb lol
@yaldaram

i did that what you said and it only shows :

Today, 11:56 AM

» < blank
» < blank
» Forum Contains New Posts


while in portal.php it shows

Welcome, jerielm
Last visit: Today, 11:56 AM
Since then, there have been:
» 0 new announcements
» 0 new threads
» 54 new posts

View New Posts
View Today's Posts


Actually i'd like to make it look like yours Toungue
2 columns

under column 1 undercolumn 2
Avatar Pic---------| Your Post
--------------------| Your Threads:
------------------- | Reputation
--------------------| No of Thanks

my sidebar width is around 240-250
Change above to this;
// If user is known, welcome them
if($mybb->settings['portal_showwelcome'] != 0)
{
    $lang->load("portal");
    if($mybb->user['uid'] != 0)
    {
        // Get number of new posts, threads, announcements
        $query = $db->simple_select("posts", "COUNT(pid) AS newposts", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' $unviewwhere");
        $newposts = $db->fetch_field($query, "newposts");
        if($newposts)
        { 
            // If there aren't any new posts, there is no point in wasting two more queries
            $query = $db->simple_select("threads", "COUNT(tid) AS newthreads", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' $unviewwhere");
            $newthreads = $db->fetch_field($query, "newthreads");

            $announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']);
            if(is_array($announcementsfids))
            {
                foreach($announcementsfids as $fid)
                {
                    $fid_array[] = intval($fid);    
                }
                
                $announcementsfids = implode(',', $fid_array);
                $query = $db->simple_select("threads", "COUNT(tid) AS newann", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' AND fid IN (".$announcementsfids.") $unviewwhere");
                $newann = $db->fetch_field($query, "newann");
            }

            if(!$newthreads)
            {
                $newthreads = 0;
            }

            if(!$newann)
            {
                $newann = 0;
            }
        }
        else
        {
            $newposts = 0;
            $newthreads = 0;
            $newann = 0;
        }

        // Make the text
        if($newann == 1)
        {
            $lang->new_announcements = $lang->new_announcement;
        }
        else
        {
            $lang->new_announcements = $lang->sprintf($lang->new_announcements, $newann);
        }
        if($newthreads == 1)
        {
            $lang->new_threads = $lang->new_thread;
        }
        else
        {
            $lang->new_threads = $lang->sprintf($lang->new_threads, $newthreads);
        }
        if($newposts == 1)
        {
            $lang->new_posts = $lang->new_post;
        }
        else
        {
            $lang->new_posts = $lang->sprintf($lang->new_posts, $newposts);
        }
        eval("\$welcometext = \"".$templates->get("portal_welcome_membertext")."\";");

    }
    else
    {
        $lang->guest_welcome_registration = $lang->sprintf($lang->guest_welcome_registration, $mybb->settings['bburl'] . '/member.php?action=register');
        $mybb->user['username'] = $lang->guest;
        eval("\$welcometext = \"".$templates->get("portal_welcome_guesttext")."\";");
    }
    $lang->welcome = $lang->sprintf($lang->welcome, $mybb->user['username']);
    eval("\$welcome = \"".$templates->get("portal_welcome")."\";");
    if($mybb->user['uid'] == 0)
    {
        $mybb->user['username'] = "";
    }
}
i got an errror "Parse error: syntax error, unexpected $end in /public_html/forum/index.php on line 476"

and this is whats on line 476 ?>
Pages: 1 2