News: April 1st, 2012, A Day That Will Live in Infamy ~~ TinyPortal 1.0 Final Released!  GET IT NOW !!!
To Read More About It, Just Click Here!

Login  |  Register
* *

Welcome !!!

Welcome, Guest. Please login or register.
Did you miss your activation email?
Please welcome ankan, our newest member.

 
 

Welcome, Guest. Please login or register.
Did you miss your activation email?
July 02, 2015, 12:13:21 PM

Login with username, password and session length

Recent

Members
  • Total Members: 3538
  • Latest: ankan
Stats
  • Total Posts: 175371
  • Total Topics: 19946
  • Online Today: 58
  • Online Ever: 383
  • (January 02, 2015, 05:58:49 AM)
Users Online
Users: 2
Guests: 25
Total: 27

Please read the Posting Guidelines


Author Topic: [block] Horizontal user block  (Read 3142 times)

0 Members and 1 Guest are viewing this topic.

Offline raid

  • Beta Tester
  • *
  • Posts: 162
    • http://www.darkforge.it/
[block] Horizontal user block
« on: November 26, 2010, 08:52:36 AM »
Name of Snippet: Horizontal user block
SMF/TP versions tested:: SMF 1.1.12/TP1 RC1
Block Type:: php
Author: raid
Link to Discussion: http://www.tinyportal.net/index.php?topic=33395.0
Other Requirements: none
Description: It's like TP userblock but horizontal view, nothing more

Code: [Select]
   $bullet = '<img src="'.$settings['tp_images_url'].'/TPdivider.gif" alt="" style="margin:0 4px 0 0;" />';
   $bullet2 = '<img src="'.$settings['tp_images_url'].'/TPdivider2.gif" alt="" style="margin:0 4px 0 0;" />';
   $bullet3 = '<img src="'.$settings['tp_images_url'].'/TPdivider3.gif" alt="" style="margin:0 4px 0 0;" />';
   $bullet4 = '<img src="'.$settings['tp_images_url'].'/TPmodule2.gif" alt="" style="margin:0 4px 0 0;" />';
   $bullet5 = '<img src="'.$settings['tp_images_url'].'/TPmodule2.gif" alt=""  style="margin:0 4px 0 0;" />';
 
  echo '<table width="100%" cellpadding="0" cellspacing="0" border="0">
       <tr>';


//Let's show the user avatar if there is one and userbox avatar showing is active
   if (!empty($context['user']['avatar']) && isset($context['TPortal']['userbox']['avatar']))
      echo '<td align="left">
         <div style="margin-top: 5px;">' , $context['user']['avatar']['image'] , '</td>';

   // If the user is logged in, display stuff like their name, new messages, etc.
   if ($context['user']['is_logged'])
   {
      echo '<td align="left">
      <h4>', $txt['hello_member'], ' ', $context['user']['name'], '</h4>
      <ul class="reset">';

      // Only tell them about their messages if they can read their messages!
      if ($context['allow_pm'])
      {
         echo '
         <li><a href="', $scripturl, '?action=pm">' .$bullet.$txt['tp-pm'].' ',  $context['user']['messages'], '</a></li>';
         if($context['user']['unread_messages']>0)
            echo '
         <li style="font-weight: bold; "><a href="', $scripturl, '?action=pm">' . $bullet. $txt['tp-pm2'].' ',$context['user']['unread_messages'] , '</a></li>';
      }
      // Are there any members waiting for approval?
      if (!empty($context['unapproved_members']))
         echo '
         <li><a href="', $scripturl, '?action=viewmembers;sa=browse;type=approve">'.$bullet. $txt['tp_unapproved_members'].' '. $context['unapproved_members']  . '</a></li>';

      if(isset($context['TPortal']['userbox']['unread']))
         echo '
         <li><a href="', $scripturl, '?action=unread">' .$bullet.$txt['tp-unread'].'</a></li>
         <li><a href="', $scripturl, '?action=unreadreplies">'.$bullet.$txt['tp-replies'].'</a></li>
         <li><a href="', $scripturl, '?action=profile;u='.$context['user']['id'].';sa=showPosts">'.$bullet. $txt['tp-showownposts'].'</a></li>
         <li><a href="', $scripturl, '?action=tpmod;sa=showcomments">'.$bullet.$txt['tp-showcomments'].'</a></li>
         ';

      // Is the forum in maintenance mode?
      if ($context['in_maintenance'] && $context['user']['is_admin'])
         echo '
         <li>' .$bullet2.$txt['tp_maintenace']. '</li></ul></td>';
         
   echo '<td align="left">
         <ul class="reset">';
      // Show the total time logged in?
      if (!empty($context['user']['total_time_logged_in']) && isset($context['TPortal']['userbox']['logged']))
      {
         echo '
         <li>' .$bullet2.$txt['tp-loggedintime'] . ' '.$context['user']['total_time_logged_in']['days'] . $txt['tp-acronymdays']. $context['user']['total_time_logged_in']['hours'] . $txt['tp-acronymhours']. $context['user']['total_time_logged_in']['minutes'] .$txt['tp-acronymminutes'].'</li>';
      }
      echo '
         <li>' . $bullet2.$context['current_time'].'</li>';
     
      // admin parts etc.
         if(!isset($context['TPortal']['can_submit_article']))
            $context['TPortal']['can_submit_article']=0;
     
      // can we submit an article?
          if(allowedTo('tp_submithtml'))
         echo '
      <li><a href="', $scripturl, '?action=tp' . (allowedTo('tp_articles') ? 'admin' : 'mod') . ';sa=addarticle_html">' . $bullet3.$txt['tp-submitarticle']. '</a></li>';
          if(allowedTo('tp_submitbbc'))
               echo '
      <li><a href="', $scripturl, '?action=tp' . (allowedTo('tp_articles') ? 'admin' : 'mod') . ';sa=addarticle_bbc">' . $bullet3.$txt['tp-submitarticlebbc']. '</a></li>';
         
      if(allowedTo('tp_editownarticle'))
               echo '
      <li><a href="', $scripturl, '?action=tpmod;sa=myarticles">' . $bullet3.$txt['tp-myarticles']. '</a></li>';
     
      // upload a file?
        if(allowedTo('tp_dlupload') || allowedTo('tp_dlmanager'))
             echo '
         <li><a href="', $scripturl, '?action=tpmod;dl=upload">' . $bullet3.$txt['permissionname_tp_dlupload']. '</a></li></ul></td>';
         
   if (allowedTo('tp_settings') || allowedTo('tp_blocks') || allowedTo('tp_articles') || allowedTo('tp_dlmanager') || (sizeof($context['TPortal']['tpmodules']['adminhook'])>0))
     {
   echo '<td align="left">
         <ul class="reset">';

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

      // add adminhooks
      if(sizeof($context['TPortal']['tpmodules']['adminhook'])>0)
      {
         foreach($context['TPortal']['tpmodules']['adminhook'] as $link)
            echo '<li><a href="' . $scripturl . '?'.$link['action'].'">' . $bullet5.$link['title']. '</a></li>';
      }
     
      echo '
      </ul></td>';
     }
     
   }
   // Otherwise they're a guest - so politely ask them to register or login.
   else{
      echo '
      <td><div style="line-height: 1.4em;">', $bullet, $txt['welcome_guest'], '
      <br />', $bullet2, $context['current_time'], '</div></td>
      <td>
      <div style="line-height: 1.4em;">', $txt['smf52'], '</div>
      <form style="margin-top: 5px;" action="', $scripturl, '?action=login2" method="post" >
         <input type="text" name="user" size="10" /> <input type="password" name="passwrd" size="10" />
         <select name="cookielength">
            <option value="60" selected="selected">', $txt['smf53'], '</option>
            <option value="1440">', $txt['smf47'], '</option>
            <option value="10080">', $txt['smf48'], '</option>
            <option value="302400">', $txt['smf49'], '</option>
            <option value="-1">', $txt['smf50'], '</option>
         </select>
         <input type="submit" value="', $txt[34], '" />
      </form>
      </td>';
   }

   
   echo'</tr>
       </table>';


@moderator: I cannot attach image (attachment disabled for me), plz take it from here:
http://www.tinyportal.net/index.php?topic=33395.msg267908#msg267908
-- fixed. Users should now have permission to attach to this board when creating a topic.
« Last Edit: November 26, 2010, 09:09:12 AM by IchBin »
SMF 2.0 + TP RC2