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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 447
  • Total: 447

USER CP - An alternative to Profile Screen

Started by akulion, October 18, 2006, 07:57:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jacortina

#80
With Aku's permission, I'm posting a version of his Control Panel which (I believe) is both a bit more flexible (select entries per row; allow easier 'shuffling' of entries) and accounts for Board Settings and Permissions (if user can't change theme, entry shouldn't show up):

global $context, $scripturl, $modSettings, $ID_MEMBER, $txt;

$entries_per_row = 4; // Range 3-5 probably best
$admin_user = 1; // Member # of Forum Administrator for 'Contact' PM
$img_size = 80; // used for height AND width of 'icon'

reloadSettings();
loadLanguage('Profile');
list ($memID) = loadMemberData($ID_MEMBER, false, 'profile');
$context['user']['is_owner'] = $memID == $ID_MEMBER;

/////////////////////////////////////////////////////////////
//
//Ã,  linkÃ,  - construction to yield the part of the URL after 'index.php'
//Ã,  image - location of graphic 'icon'
//Ã,  title - entry 'name'
//Ã,  label - entry description

if (($context['user']['is_owner'] && allowedTo('profile_identity_own')) || allowedTo(array('profile_identity_any', 'manage_membergroups')))
$cp_entry[] = array('link' => '?action=profile;u='.$ID_MEMBER.';sa=account',Ã,  Ã,  'image' => 'usercp/ksysguard.png',Ã,  Ã,  'title' => 'My Account Info',
'label' => 'Click here if you want to change your account related information such as username, email, password or other sensitive details.');

if (($context['user']['is_owner'] && allowedTo('profile_extra_own')) || allowedTo('profile_extra_any'))
$cp_entry[] = array('link' => '?action=profile;u='.$ID_MEMBER.';sa=theme',Ã,  Ã,  'image' => 'usercp/kivio.png',Ã,  Ã,  'title' => 'Look & Layout Options',
'label' => 'Click here to change the way the forum looks for you, options include the look and layout for the boards and posts.');

if ($modSettings['theme_allow'] || $context['user']['is_admin'])
$cp_entry[] = array('link' => '?action=profile;u='.$ID_MEMBER.';sa=pick;sesc='.$context['session_id'],Ã,  Ã,  'image' => 'usercp/blockdevice.png',Ã,  Ã,  'title' => 'My Theme',
'label' => 'This screen will allow you to set your default theme which you wish to use every time you login.');

if (($context['user']['is_owner'] && allowedTo('profile_extra_own')) || allowedTo('profile_extra_any'))
$cp_entry[] = array('link' => '?action=profile;u='.$ID_MEMBER.';sa=forumProfile',Ã,  Ã,  'image' => 'usercp/kuser.png',Ã,  Ã,  'title' => 'My Profile',
'label' => 'Click here to change the way your profile looks and appears to everyone.');

if (($context['user']['is_owner'] && allowedTo('profile_view_own')) || allowedTo('profile_view_any'))
$cp_entry[] = array('link' => '?action=profile;u='.$ID_MEMBER.';sa=statPanel',Ã,  Ã,  'image' => 'usercp/kwalletmanager.png',Ã,  Ã,  'title' => 'My Stats',
'label' => 'Here you can check how many posts you have made, which games you are a champion in and other activity related info.');

if (($context['user']['is_owner'] && allowedTo('profile_view_own')) || allowedTo('profile_view_any'))
$cp_entry[] = array('link' => '?action=profile;u='.$ID_MEMBER.';sa=showPosts',Ã,  Ã,  'image' => 'usercp/kedit.png',Ã,  Ã,  'title' => 'My Posts',
'label' => 'This option will show you all the posts you have made since you became a member of this site.');

if (($context['user']['is_owner'] && allowedTo('profile_extra_own')) || allowedTo('profile_extra_any'))
$cp_entry[] = array('link' => '?action=profile;u='.$ID_MEMBER.';sa=notification',Ã,  Ã,  'image' => 'usercp/mailreminder.png',Ã,  Ã,  'title' => 'My Notifications',
'label' => 'This screen will allow you to change the type and frequency of notifications you get via e-mail when participating in threads.');

if (!empty($modSettings['enable_buddylist']) && $context['user']['is_owner'] && allowedTo(array('profile_extra_own', 'profile_extra_any')))
$cp_entry[] = array('link' => '?action=profile;u='.$ID_MEMBER.';sa=editBuddies',Ã,  Ã,  'image' => 'usercp/kdmconfig.png',Ã,  Ã,  'title' => 'Buddies',
'label' => 'This screen will allow you to select buddies to add to your list.');

if (($context['user']['is_owner'] && allowedTo('profile_extra_own')) || allowedTo('profile_extra_any'))
$cp_entry[] = array('link' => '?action=profile;u='.$ID_MEMBER.';sa=pmprefs',Ã,  Ã,  'image' => 'usercp/mail.png',Ã,  Ã,  'title' => 'My Messages Options',
'label' => 'This screen will allow you to set your preferences for PMs received on the board and also allow you to ignore people you do not wish to receive PMs from.');

if (!$context['user']['is_guest'] && (($context['user']['is_owner'] && allowedTo('profile_view_own')) || allowedTo(array('profile_view_any', 'moderate_forum', 'manage_permissions','tp_dlmanager','tp_blocks','tp_articles','tp_gallery','tp_linkmanager'))))
if($context['user']['is_owner'] || allowedTo('tp_blocks'))
$cp_entry[] = array('link' => '?action=profile;u='.$ID_MEMBER.';sa=tpshoutbox',Ã,  Ã,  'image' => 'usercp/messenger.png',Ã,  Ã,  'title' => 'Show My Shouts',
'label' => 'This screen will show a log of all the shouts you have made in the shoutbox.');

if ($context['allow_search'])
$cp_entry[] = array('link' => '?action=search',Ã,  Ã,  'image' => 'usercp/find.png',Ã,  Ã,  'title' => 'Search',
'label' => 'This screen will allow you to search for posts made in the board.');

if (allowedTo('pm_send'))
$cp_entry[] = array('link' => '?action=pm;sa=send;u='.$admin_user,Ã,  Ã,  'image' => 'usercp/agent.png',Ã,  Ã,  'title' => 'Contact Admin',
'label' => 'Still having problems?<br>Then contact the admin from here and submit your questions.');

/////////////////////////////////////////
// Karma Description Log
//if (($modSettings['karmaMode'] == '1') || ($modSettings['karmaMode'] == '2'))
// if ((!empty($modSettings['karmaisowner']) && ($context['user']['is_owner'])) || (empty($modSettings['karmaisowner'])) || ($context['user']['is_admin']))
// $cp_entry[] = array('link' => '?action=ownkarma;u='.$ID_MEMBER,Ã,  Ã,  'image' => '',Ã,  Ã,  'title' => $txt['who_change_my_karma'],
// 'label' => 'Show log of who who affected your '.$modSettings['karmaLabel'].'.');
/////////////////////////////////////////

/////////////////////////////////////////
// Awards Mod Badge Album
//loadLanguage('ManageAwards');
//if (isset($txt['pa_description']))
// $cp_entry[] = array('link' => '?action=profile;u='.$ID_MEMBER.';sa=awards',Ã,  Ã,  'image' => '',Ã,  Ã,  'title' => 'Badge Album',
// 'label' => 'Manage your Award badge album.');
/////////////////////////////////////////

/////////////////////////////////////////
// Logout
//$cp_entry[] = array('link' => '?action=logout;sesc='.$context['session_id'],Ã,  Ã,  'image' => '',Ã,  Ã,  'title' => 'Logout',
// 'label' => 'Log off the Forum.');
/////////////////////////////////////////

$cell_width = (int) (100 / $entries_per_row);
$row_ent = 0;

$line_1 = '';
$line_2 = '';
$line_3 = '';

echo '<table>';
foreach ($cp_entry as $ent) {

$line_1 .= '<td valign="top" width="'.$cell_width.'%" align="center" height="'.$img_size.'px"><a href="'.$scripturl.$ent['link'].'"><img border="0" src="'.$ent['image'].'" width="'.$img_size.'" height="'.$img_size.'"></a></td>';
$line_2 .= '<td class="windowbg3" style="font-size:small;font-weight:bold;text-align:center;vertical-align:top;padding:3px;"><a href="'.$scripturl.$ent['link'].'">'.$ent['title'].'</a></td>';
$line_3 .= '<td style="font-size:x-small;text-align:center;vertical-align:top;font-weight:bold;padding:3px;">'.$ent['label'].'</td>';

$row_ent = $row_ent + 1;
if ($row_ent == $entries_per_row) {
$row_ent = 0;
echo '<tr height="', $img_size, 'px">', $line_1, '</tr>';
echo '<tr height="1.3em">', $line_2, '</tr>';
echo '<tr height="125px">', $line_3, '</tr>';
$line_1 = '';
$line_2 = '';
$line_3 = '';
}
}
if ($row_ent > 0) {
$line_1 .= '<td colspan="'.($entries_per_row - $row_ent).'"> </td>';
$line_2 .= '<td colspan="'.($entries_per_row - $row_ent).'"> </td>';
$line_3 .= '<td colspan="'.($entries_per_row - $row_ent).'"> </td>';
echo '<tr height="', $img_size, 'px">', $line_1, '</tr>';
echo '<tr height="1.3em">', $line_2, '</tr>';
echo '<tr height="125px">', $line_3, '</tr>';
}
echo '</table>';



EDIT: Fixed the error-causing $user_info reference. Note that I did NOT add the global, but instead changed to check the associated $context array entry (it just grates to pull in a whole additional structure just for a single value referenced once).

akulion

wow this is really awesome :D

Way to go J.A.Cortina :D

I just made tha match, u made the whole Cooking range stove :D :up:

Mindriot

Quote from: Bloc on October 21, 2006, 08:04:47 AM
It was some errors..try refresh and press again.

The trouble on this site was that "index.php" is using another theme, so the change didn't reach Leviathan. But it should go to the forum index instead now.

Still not working for me here.

Regardless, I Love the Forum Resizing on that Theme. Great Stuff!  :up:

mfKG

nice J.A.Cortina, but why not "outsourcing" the Text (ex. My Profile)? Would be much easier for translating/changing, then searching in the code........just my opinion ;)...

jacortina

You are correct. Especially for 'multilingual' boards (where more than one language is expected to be actively used).

On the other hand, it makes some things problematic (or at least makes it something I'm not sure how to approach satisfactorily). For instance, I don't use the word 'karma' for karma functionality, so in the sample entry I added for that, I use a construction in the description (label) which references the word that I do use. Having a simple $txt entry for that description wouldn't be adequate.

Hey, I spent hours just trying to make sure that the results of the code would look correct in both FF and IE.  ;D

Ken.

This latest version is great... my forum is set to use only one theme so the change to having that option removed fits well for me.
I only have one small change that needs to be made so that my background will look right, is it possible to remove the band of color that is behind each icon label as shown in the picture below?
In the screen shot the IE window on the left is showing my live site and the FF window on the right shows the test forumâ€Ã,¦ the test forum is showing the color bands that need to be removed so that it looks the same as the live site.
Thanksâ€Ã,¦ Ken
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

jacortina

Find this line:
$line_2 .= '<td class="windowbg3" style="font-size:small;font-weight:bold;text-align:center;vertical-align:top;padding:3px;"><a href="'.$scripturl.$ent['link'].'">'.$ent['title'].'</a></td>';

and remove the 'class="windowbg3"'

Ken.

Perfect!  ;D

Just one more thing... ;)
The change the bold text to regular do I just remove the font weight entries in the code here, or replace it with some other value?
$line_1 .= '<td valign="top" width="'.$cell_width.'%" align="center" height="'.$img_size.'px"><a href="'.$scripturl.$ent['link'].'"><img border="0" src="'.$ent['image'].'" width="'.$img_size.'" height="'.$img_size.'"></a></td>';
$line_2 .= '<td class="windowbg3" style="font-size:small;font-weight:bold;text-align:center;vertical-align:top;padding:3px;"><a href="'.$scripturl.$ent['link'].'">'.$ent['title'].'</a></td>';
$line_3 .= '<td style="font-size:x-small;text-align:center;vertical-align:top;font-weight:bold;padding:3px;">'.$ent['label'].'</td>';
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.


Ken.

" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

This website is proudly hosted on Crocweb Cloud Website Hosting.