TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

June 26, 2024, 01:42:38 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,280
  • Total Topics: 21,227
  • Online today: 203
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 224
  • Total: 224

Edit userbox info

Started by envon, October 18, 2005, 09:25:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

envon

Is there a way to change or add some info to the user block.ÂÃ,  I would like to be able to show a total membership as well as the membership in a particular user group.ÂÃ,  I would think it would be simply adding a line of code just not sure what to call as I am not a great coder.

Thanks in advance for your time

bloc

You mean to show what groups the member is in? Primary group + others?

envon

What I am looking for is where you have Members it says total members I would like to add a member group and the numer of members in that group. so something like this:

Members
total members     500
membergroup     105

Also would like to rename Members to Supporters. Fusion Artist is the membergroup name.

Supporters
total supporters    500
Fusion Artists        105


eldacar

What I think would be great is for there not to be any blocks other than phpblock/htmlblock. When you select the userblock it loads php code into a phpblock which you can then edit if you like.

bloc

Quote from: envon on October 19, 2005, 02:28:45 AM
What I am looking for is where you have Members it says total members I would like to add a member group and the numer of members in that group. so something like this:

Members
total members     500
membergroup     105

Also would like to rename Members to Supporters. Fusion Artist is the membergroup name.

Supporters
total supporters    500
Fusion Artists        105



This would require several additional calls to the database..I don't think its good to have all that in just the userblock. Better as a single phpblock I think.

bloc

Quote from: eldacar on October 19, 2005, 11:13:16 AM
What I think would be great is for there not to be any blocks other than phpblock/htmlblock. When you select the userblock it loads php code into a phpblock which you can then edit if you like.
Well, yeah..but then I would need to post updates to the userblock-code amd basically support any kind of "custom" version..it will just be too much. Now I can concentrate on getting the specific blocktypes working good, and any updates WILL go come through, by simplay updating.

But of course the php blocktype is versatile, you could easily copy over the code for a "custom" userblock - a lot of the info is drawn from the SMF system, just a few TP related things so its not hard to make your own version at all.

Also, power users could perhaps benefit greatly from this, but others who like to just start and go will be less happy. :)

envon

I think you may be miss understanding what I would like to do.  All i would like is to change the word members to Supporters, remove the latest add Fusion Artists (which is a membergroup).  The reason for this is the site I am running is for a group of artists working together on various projects. There are sveral people who are part of the group who are just supporters of the project and then there are the actual artists.  I would just like to show those numbers.  I will look around for the code block used in the userblock and see what I can come up with and post it back here for you to see if its correct.

Thanks for all the hard work Bloc you the best.

Xarcell

Maybe we can get a snippet. Anyone wanna take a crack at it?

I would like it as well..

winrules

It's actually not that hard. Just go to www.yoursite.com/forumdirectory/Themes/default/TPortalBlocks.template.php and you'll find all the code for making the blocks there. Just edit the code for the user block.

The code is currently
// Tportal userbox
function TPortal_userbox()
{
          global $context, $settings, $options, $scripturl, $txt, $modSettings;

$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;" />';
        echo'<table width="99%" cellpadding="0" cellspacing="5" border="0"><tr>';
        echo '<td width="100%" valign="top" class="smalltext" style="font-family: verdana, arial, sans-serif;">';

        if (!empty($context['user']['avatar']) && isset($context['TPortal']['userbox']['avatar']))
                echo $context['user']['avatar']['image'] . '<br />';

        // If the user is logged in, display stuff like their name, new messages, etc.
        if ($context['user']['is_logged'])
        {

                echo '<span class="normaltext">
                                                        ', $txt['hello_member'], ' <b>', $context['user']['name'], '</b></span>';

                // Only tell them about their messages if they can read their messages!
                if ($context['allow_pm']){
                        echo '<br />'.$bullet.'<a href="', $scripturl, '?action=pm">' .$txt['tp-pm'].' ', $context['user']['messages'], '</a>';
                   if($context['user']['unread_messages']>0)
                        echo '<br />'.$bullet.'<a style="font-weight: bold; " href="', $scripturl, '?action=pm">' .$txt['tp-pm2'].' ',$context['user']['unread_messages'] , '</a>';

                }
                // Are there any members waiting for approval?
                if (!empty($context['unapproved_members']))
                        echo '<br />'.$bullet.'<a href="', $scripturl, '?action=regcenter">'.$txt['tp_unapproved_members'].'<b> '. $context['unapproved_members']  . '</b></a>';

                if(isset($context['TPortal']['userbox']['unread'])){
                      echo '<br />'.$bullet.'<a href="', $scripturl, '?action=unread">' .$txt['tp-unread'].'</a>
                                                        <br />'.$bullet.'<a href="', $scripturl, '?action=unreadreplies">'.$txt['tp-replies'].'</a>';
               }

                // Is the forum in maintenance mode?
                if ($context['in_maintenance'] && $context['user']['is_admin'])
                        echo '<br /><b>' .$bullet.$txt['tp_maintenace']. '</b>';
                // Show the total time logged in?
                if (!empty($context['user']['total_time_logged_in']) && isset($context['TPortal']['userbox']['logged']))
                {
                        echo '<br />'.$bullet.$txt['tp-loggedintime'] . ' ';

                         echo '<br />'.$context['user']['total_time_logged_in']['days'] . 'd ';
                         echo $context['user']['total_time_logged_in']['hours'] . 'h ';
                         echo $context['user']['total_time_logged_in']['minutes'] .'m';
                }
               if(isset($context['TPortal']['userbox']['time'])){
                     echo '<br />'.$bullet. $context['current_time'];
               }
               // can we submit an article?
               if(!isset($context['TPortal']['can_submit_article']))
                  $context['TPortal']['can_submit_article']=0;

               if($context['TPortal']['can_submit_article']==1 && !$context['user']['is_admin'])
                       echo '<br /><b>'.$bullet.'<a href="', $scripturl, '?action=tpmod&sub=submitarticle">' . $txt['tp-submitarticle']. '</a></b>';

               echo '</div>';
        }
        // Otherwise they're a guest - so politely ask them to register or login.
        else
        {
                echo '
                                                        ', $txt['welcome_guest'], '<br />
                                                        ', $context['current_time'], '<br />

                                                        <form 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">', $txt['smf53'], '</option>
                                                                        <option value="1440">', $txt['smf47'], '</option>
                                                                        <option value="10080">', $txt['smf48'], '</option>
                                                                        <option value="302400">', $txt['smf49'], '</option>
                                                                        <option value="-1" selected="selected">', $txt['smf50'], '</option>
                                                                </select>
                                                                <input type="submit" value="', $txt[34], '" /><br />
                                                                ', $txt['smf52'], '
                                                        </form>';
        }
       if(isset($context['TPortal']['userbox']['stats']))
   // add stats in here
            echo '
                  <hr /><img src="'.$settings['images_url'].'/icons/members.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=mlist"><b>'.$txt[19].'</b></a>
                 <br />'.$bullet.$txt[488].': ' , isset($modSettings['totalMembers']) ? $modSettings['totalMembers'] : $modSettings['memberCount'] , '
                 <br />'.$bullet.$txt[656]. ': <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '"><b>', $modSettings['latestRealName'], '</b></a>';

       if(isset($context['TPortal']['userbox']['online'])){
   // add online users
            echo '<hr /><img src="'.$settings['images_url'].'/icons/online.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a><br />';

            $online = ssi_whosOnline('array');
   echo $bullet.'Users: '.$online['num_users'];
   echo '<br />'.$bullet.'Guests: '.$online['guests'];
   echo '<br />'.$bullet.'Total: '.$online['total_users'].'<hr />';

            foreach($online['users'] as $user){
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';
   }
         }
echo '<br /></td></tr></table>';

}

IchBin

Open the index.english.php file in the /Themes/default/languages folder.
Find this line:

Find this line:
$txt[19] = 'Members';

Replace with:
$txt[19] = 'Supporters';

$txt[656] = 'Latest Member';

Replace with:
$txt[656] = 'Fusion Artists';