MyBB Community Forums

Full Version: Index widgets & Private Message system problem.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

Website: www.multimart.org

I am currently trying to get the "Online Users" and "Welcome" widget onto my sidebar on the index page. These widgets work/ can be displayed on the portal, though I'm having some trouble doing it on my index.

These are the widgets I'd like to have on the index page:
[Image: 18fcccf21b0ac051d6f8bffee971c68d.png]
[Image: 6f5dd49f6679c0cd686c1af04ea812f1.png]

index page code
<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
<script type="text/javascript">
<!--
 lang.no_new_posts = "{$lang->no_new_posts}";
 lang.click_mark_read = "{$lang->click_mark_read}";
// -->
</script>
</head>
<body>
{$header}
<div class="side" style="float: right; width: 19%">

<!--<tr>
   <td class="thead">
        Title Here
   </td>
</tr>

<tr>
   <td class="trow2">
    Text Here
   </td>-->
</tr>
</table>
</div>
<div class="forum" style="float: left; width: 80%;">{$forums}</div>
{$boardstats}

<dl class="forum_legend smalltext">
 <dt><img title="Forum Contains New Posts" src="images/custom/on.gif"></img></dt>
 <dd>Forum Contains New Posts</dd>

 <dt><img title="{$lang->no_new_posts}" src="images/custom/off.gif"></img></dt>
 <dd>{$lang->no_new_posts}</dd>

 <dt><img title="{$lang->forum_locked}" src="images/custom/offlock.gif"></img></span></dt>
 <dd>{$lang->forum_locked}</dd>
</dl>
<br class="clear" />
{$footer}
</body>
</html>



There is also one other system not working correctly, the private messaging system:
[Image: 626b4a9ff91b342b2076c002975d04d2.png]

I have no idea how to fix this, but this is the code from the header.

<div id="panel">
<div class="wrap">
{$welcomeblock}
</div></div>
<a name="top" id="top"></a>
<div id="header">
<div class="wrap" style="height: 80px;">
<div class="logo"><a href="{$mybb->settings['bburl']}/index.php"><img src="{$theme['logo']}" alt="{$mybb->settings['bbname']}" title="{$mybb->settings['bbname']}" /></a></div>
<a class="popbox" href="{$mybb->settings['bburl']}/search.php">Advanced SAearch</a>
</div>
</div>
<div id="bridge">
       <div class="wrap">

               <form  class="search_box" action="search.php" method="post">
                       <input name="keywords" class="search_textbox" type="text" value="Search..." onfocus="javascript: if(this.value == 'Search...'){ this.value = ''; }" onblur="javascript: if(this.value==''){this.value='Search...';}">
                       <input name="submit-search" class="button"  type="image" src="images/unn/search_submit.png">
                       <input type="hidden" name="action" value="do_search">
               </form>

<ul class="menu">
<li><a href="{$mybb->settings['bburl']}"><div style="text-align: center;"><span style="color: #FFF; text-shadow: rgb(102, 102, 102) 0px 2px 3px; font-size: 14px;"> <img style="position: relative; top:2px;" src="images/home.png"></img> Home</span></div></a></li>
<li><a href="misc.php?action=payments"><div style="text-align: center;"><span style="color: #FFF; text-shadow: rgb(102, 102, 102) 0px 2px 3px; font-size: 14px;"><img style="position: relative; top:2px;" src="images/donate.png"> Account Upgrade</span></div>
<div style="text-align: center;"><br style="text-shadow: rgb(102, 102, 102) 0px 2px 3px;" />
</div></a></li>
<li><a href="{$mybb->settings['bburl']}/misc.php?action=help"><div style="text-align: center;"><span style="color: #FFF; text-shadow: rgb(102, 102, 102) 0px 2px 3px; font-size: 14px;"> <img style="position: relative; top:2px;" src="images/rules.png"> Help & Rules</span></div></a></li>
                  <li><a href="{$mybb->settings['bburl']}/memberlist.php"><div style="text-align: center;"><span style="color: #FFF; text-shadow: rgb(102, 102, 102) 0px 2px 3px; font-size: 14px;"><img style="position: relative; top:2px;" src="images/member.png"> Members</span></div></a></li>
                  <li><a href="{$mybb->settings['bburl']}/newpoints.php"><div style="text-align: center;"><span style="color: #FFF; text-shadow: rgb(102, 102, 102) 0px 2px 3px; font-size: 14px;"><img style="position: relative; top:2px;" src="images/point.png"> Credits</span></div></a></li>
                  <li><a href="{$mybb->settings['bburl']}/contactus/index.php"><div style="text-align: center;"><span style="color: #FFF; text-shadow: rgb(102, 102, 102) 0px 2px 3px; font-size: 14px;"><img style="position: relative; top:2px;" src="images/email.png"> Contact Us</span></div></a></li>
       </div>
</div>
<!--<div id="bridge2">
       <div class="wrap">
<ul class="menuglob">
                          <li><a href="http://www.universal-gaming.net"><div style="text-align: center;"><span style="color: #FFF; text-shadow: rgb(102, 102, 102) 0px 2px 3px; font-size: 14px;">Universal Gaming</span></div></a></li>
                          <li><a href="http://www.nl-rp.com"><div style="text-align: center;"><span style="color: #FFF; text-shadow: rgb(102, 102, 102) 0px 2px 3px; font-size: 14px;">New Life Roleplay</span></div></a></li>
          <li><a href="#"><div style="text-align: center;"><span style="color: #FFF; text-shadow: rgb(102, 102, 102) 0px 2px 3px; font-size: 14px;">Avovix</span></div></a></li>

</ul>
       </div>
</div> -->
<div class="sep_container">

   <div class="sep_3"></div>
   <div class="sep_4"></div>

</div>
<div id="container">
<div id="content">
{$pm_notice}
{$bannedwarning}
{$bbclosedwarning}
{$unreadreports}
{$pending_joinrequests}
<navigation>
<br />

Kind Regards,
Husky
sections from portal cannot be directly displayed on index without using plugins / code changes in files.
simple method can be to use jQuery to embed required parts from portal page. see this as example

And I could not understand your other requirement related to Private Messages. can you elaborate it ..
Hi,

Thank you for the reply.

<script type="text/javascript">
jQuery(function(){
jQuery(".welcome").load("{$mybb->settings['bburl']}/portal.php .welcome_portal");
jQuery(".latestthreads").load("{$mybb->settings['bburl']}/portal.php .latestthreads_portal");
}); </script>

{$welcome}
{$latestthreads}

The "latest thread" widget/ block works however the "welcome" one doesn't (See the image below of what I mean by the welcome widget)
[Image: 7b67558d804a9a8d75820fae8729c23b.png]


The private messaging system is meant to display a number. If the user has any un-read pm's the grey box should be red.

[Image: 39902b78bd0aade6081a2304d72ec05d.png]
Trying to import these into the index page.

Current code

portal_welcome
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<td class="bhead">
	<strong>
		{$lang->welcome}
	</strong>
</td>
<tr class="welcome_portal">
<td class="trow123">
	{$welcometext}
</td>
</tr>
</table>

<br />

portal_whosonline
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr class="onlineusers_portal">
<td class="bhead"><strong>{$lang->online}</strong></td>
</tr>
<tr>
<td class="trow123">
<span class="smalltext">
{$lang->online_users}<br /><strong>&raquo;</strong> {$lang->online_counts}<br />{$onlinemembers}
</span>
</td>
</tr>
</tr>
</table>
<br />

index
<div class="sidebar" style="float: right; width: 15%;">
	
<script type="text/javascript">
jQuery(function(){
jQuery(".welcome").load("{$mybb->settings['bburl']}/portal.php .portal_welcome");
jQuery(".onlineusers").load("{$mybb->settings['bburl']}/portal.php .onlineusers_portal ");
jQuery(".latestthreads").load("{$mybb->settings['bburl']}/portal.php .latestthreads_portal");
}); </script>

{$welcome}
{$onlineusers}
{$latestthreads}
	
</div>

I had tried to follow .m. example, but unfortuantely its only worked for the "Latest threads".

Thanks in advance.
bump.
jQuery can fetch the required content section only if it has a css class or id defined for that section.

a template edit was required to get the latest threads content.
similar edits (not exact) might be required for getting other sections.

can you please check the suggested example once again
but I have a class for that section:

<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<td class="bhead">
    <strong>
        {$lang->welcome}
    </strong>
</td>
<tr [b]class="welcome_portal[/b]">
<td class="trow123">
    {$welcometext}
</td>
</tr>
jQuery(".welcome").load("{$mybb->settings['bburl']}/portal.php .portal_welcome");
I have also tried experimenting with the code, despite all my best of efforts, I've failed to make it work. Mind showing an example (and yes, I have been referring to that tutorial but I haven't had much sucess with other blocks).

Thank you in advance. Smile
If you provide an ACP logon and account I will get that working for you Smile
Done Big Grin
Thank you Lessfish.

In regards of the Private Message system. This is how it currently looks:
[Image: 9606b5e1fa974ca2059e97a71c47b439.png]

Is meant to look like this when the user has recieved no PM's:
[Image: 6170043568cc3289b26247aea4b9cd99.png]

.. and if the user has a private message:

[Image: e3559fc5ca026f8157a507ababa7cd88.png]

Code

global.css
.pm_count {
        background: #606060;
        padding: 3px 7px;
        border-radius: 2px;
        -moz-border-radius: 2px;
        -webkit-border-radius: 2px;
        color: #a0a0a0;
        font-weight: 700;
}

headerinclude
if ($('.pm_count').text() != '0') {
        $('.pm_count').css({background-color: "#ff5d5c", color: "#fff"});
}

header_welcomeblock_member
<a href="{$mybb->settings['bburl']}/private.php">Private Messages &nbsp; <span class="pm_count">{$mybb->user['pmunread']}</span></a>

Any other code can be provided.

I've changed header_welcomeblock_member with the following:
<a href="{$mybb->settings['bburl']}/private.php">Private Messages &nbsp; <span class="pm_count">{$mybb->user['pms_unread']}</span></a></code>

Just strugling with changing the font and background colour. Any help please.
I use template conditionals for this;

 <a href="{$mybb->settings['bburl']}/private.php">Private Messages &nbsp; <span class="upm badge"><if ($mybb->user['pms_unread'])>0 then>{$mybb->user['pms_unread']}<else>0</if></span></a>

Though I guess CSS might do it, like so:
 <a href="{$mybb->settings['bburl']}/private.php">Private Messages &nbsp; <span class="pm_count pm_count_{$mybb->user['pms_unread']}">{$mybb->user['pms_unread']}</span></a>

Then in your css, add two classes: pm_count and pm_count_0. make sure that pm_count_0 is AFTER pm_count in the css.

pm_count_0 is the greyed out, no pms css. pm_count is the red. Then it will work.