TinyPortal

Development => Support => Topic started by: bwyrwitzke on January 08, 2009, 04:03:18 AM

Title: Moding the User Block?
Post by: bwyrwitzke on January 08, 2009, 04:03:18 AM
Which file should I be looking at to mod the User block?  I'm using an older Joomla theme (RocketTheme "Versatility" modified by Bloc for SMF) so I already have the "Welcome XXXX", number of PMs, unread posts, etc at the top.  All I want displayed in the user block on the left hand side is the user permissions for submitting atricles and uploading files.  Any help on where to start would be greatly appreciated.  Thanks.

Bruce
Title: Re: Moding the User Block?
Post by: IchBin on January 08, 2009, 04:40:42 AM
TPortalBlocks.template.php file in the default themes folder is where the user block is. If you search for TPortal_user you should find the block easily.
Title: Re: Moding the User Block?
Post by: bwyrwitzke on January 08, 2009, 04:43:49 AM
Thanks IchBin!
Title: Re: Moding the User Block?
Post by: ZarPrime on January 08, 2009, 05:02:33 AM
Before you go and do that, why don't you see if this code will do what you want.  Put it in a php block

    $bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet2 = '<img src="'.$settings['images_url'].'/TPdivider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet3 = '<img src="'.$settings['images_url'].'/TPdivider3.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet4 = '<img src="'.$settings['images_url'].'/tpgoto.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet5 = '<img src="'.$settings['images_url'].'/tpmodule2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
echo
'<p>';
// admin parts etc.
         if(!isset($context['TPortal']['can_submit_article']))
            $context['TPortal']['can_submit_article']=0;
// do not show if none is availalable
if($context['TPortal']['can_submit_article']==1 || allowedTo(array('tp_dlupload','tp_dlmanager','tp_settings','tp_articles','tp_blocks','tp_linkmanager','tp_teampage','tp_gallery')))
{
echo '<img src="'.$settings['images_url'].'/tpoptions.gif" style="margin: 0;" align="absbottom" alt="" />
      <b>'.$txt['tp-tools'].'</b></p>';
              // can we submit an article?
              if($context['TPortal']['can_submit_article']==1 && !allowedTo('tp_articles'))
                       echo $bullet4.'<a href="', $scripturl, '?action=tpmod;sa=submitarticle">' . $txt['tp-submitarticle']. '</a><br />';

// upload a file?
              if(allowedTo('tp_dlupload') || allowedTo('tp_dlmanager'))
                       echo $bullet4.'<a href="', $scripturl, '?action=tpmod;dl=upload">' . $txt['permissionname_tp_dlupload']. '</a><br />';

// tpadmin checks
if (allowedTo('tp_settings'))
echo $bullet4.'<a href="' . $scripturl . '?action=tpadmin;sa=settings">' . $txt['permissionname_tp_settings'] . '</a><br />';
if (allowedTo('tp_blocks'))
echo $bullet4.'<a href="' . $scripturl . '?action=tpadmin;sa=blocks">' . $txt['permissionname_tp_blocks'] . '</a><br />';
if (allowedTo('tp_articles'))
{
echo $bullet4.'<a href="' . $scripturl . '?action=tpadmin;sa=articles">' . $txt['permissionname_tp_articles'] . '</a><br />';
// any submissions?
if($context['TPortal']['submitcheck']['articles']>0)
echo $bullet4.$bullet3.'<a href="' . $scripturl . '?action=tpadmin;sa=submission"><b>' . $context['TPortal']['submitcheck']['articles'] . ' ' .$txt['tp-articlessubmitted'] . '</b></a><br />';
}
if (allowedTo('tp_dlmanager'))
{
echo $bullet4.'<a href="' . $scripturl . '?action=tpmod;dl=admin">' . $txt['permissionname_tp_dlmanager'] . '</a><br />';
// any submissions?
if($context['TPortal']['submitcheck']['uploads']>0)
echo $bullet4.$bullet3.'<a href="' . $scripturl . '?action=tpmod;dl=adminsubmission"><b>' . $context['TPortal']['submitcheck']['uploads'] . ' ' .$txt['tp-dluploaded'] . '</b></a><br />';
}
/*
if (allowedTo('tp_gallery'))
echo $bullet4.'<a href="' . $scripturl . '?action=tpmod;show=admin">' . $txt['permissionname_tp_gallery'] . '</a><br />';
if (allowedTo('tp_teampage'))
echo $bullet4.'<a href="' . $scripturl . '?action=tpmod;team=admin">' . $txt['permissionname_tp_teampage'] . '</a><br />';
if (allowedTo('tp_linkmanager'))
echo $bullet4.'<a href="' . $scripturl . '?action=tpmod;link=admin">' . $txt['permissionname_tp_linkmanager'] . '</a><br />';
*/
}


ZarPrime
Title: Re: Moding the User Block?
Post by: bwyrwitzke on January 08, 2009, 05:28:13 AM
You guys are outstanding.  It looks like I can revert back to original TPblocks.template.php file.  Thanks for the help.  I might have even learned something...  :uglystupid2:

Bruce
Title: Re: Moding the User Block?
Post by: ZarPrime on January 08, 2009, 12:07:14 PM
Fantastic.  It's always good news when somebody learns something. ;D :up:

ZarPrime
Title: Re: Moding the User Block?
Post by: bwyrwitzke on January 08, 2009, 01:35:26 PM
I added a couple of lines so the "Submit HTML Article" and "Submit BBC Article" would show up:


if(allowedTo('tp_submithtml'))
                       echo $bullet.'<a href="', $scripturl, '?action=tpmod;sa=submitarticle">' . $txt['tp-submitarticle']. '</a><br />';
               
                if(allowedTo('tp_submitbbc'))
echo $bullet.'<a href="', $scripturl, '?action=tpmod;sa=submitarticle;bbc">' . $txt['tp-submitarticlebbc']. '</a><br />';



Thanks again for the help.
Title: Re: Moding the User Block?
Post by: IchBin on January 08, 2009, 03:33:01 PM
The other thing you can do if you want, is copy the file to your custom theme and edit it. This way, the default theme and the default install of TP is untouched as well. Just another way of doing it.