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: 543
  • Total: 543

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.

Nokonium

#90
I'm working with the custom action version and I thought, could I drop J A Cortina's code into Akulions function?

You can, it works  ;D

save as usercp.template.php


<?php
/*
User CP Page - J.A.Cortina version of Akulions original
*/
 
function template_main()
{
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_MEMBERfalse'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 (!
$user_info['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>';
}
?>

rctxtreme

Hrm should I update my (unapproved) package with that?

Nokonium

JA's code fixed the 'member' error but I found an undefined index: user_info error. I think that I've found the fix.

Find

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

Replace with

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

Raven

#93
Wow thanks J.A Cortina, thats really nice!
_____________________________________________

Quote from: J.A.Cortina on October 22, 2006, 04:21:27 AM
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"'
A note, for those who want the band but are using Mirage, I suggest changing "windowbg3" to "catbg" as the "winbg3" is grey and hard to read on most schemes, with "catbg" it is easy to read and it also changes colour when you change the colour of the theme :)

See: http://www.bzfiend.com/raven/forum/index.php?page=8

jacortina

Quote from: Raven on October 22, 2006, 03:52:02 PM
A note, for those who want the band but are using Mirage, I suggest changing "windowbg3" to "catbg" as the "winbg3" is grey and hard to read on most schemes, with "catbg" it is easy to read and it also changes colour when you change the colour of the theme :)

Hmm. Well, I chose the windowbg3 as it's the class used for sticky post cells (at least in the default theme). As such, it's usually the more 'pronounced' of the text cell backgrounds. I wouldn't think that it should be difficult to read.

But the presentation can be 'tweaked' to suit. With all cells having the specific attributes applied in their one specific place (with style attributes already in place for the two text portions to add to/modify), it should be fairly easy to play with it.

Raven

Yeah I know what you mean, the sticky cell in Mirage can actually cause problems as it is hard to read dark red on almost black, I keep meaning to change it but I keep forgetting :P

JDMhustle

Quote from: Alan S on October 18, 2006, 08:55:57 PM



Open the index.php

Search For

'sticky' => array('LockTopic.php', 'Sticky'),

Add after

'usercp' => array('usercp.php', 'usercp'),


Nice code and write up but when i open up index.php in theme directory i get this:
<?php

// This file is here solely to protect your Themes directory.

// Look for Settings.php....
if (file_exists(dirname(dirname(__FILE__)) . '/Settings.php'))
{
// Found it!
require(dirname(dirname(__FILE__)) . '/Settings.php');
header('Location: ' $boardurl);
}
// Can't find it... just forget it.
else
exit;

?>

jacortina

Yes, that's a 'stub' index.php that's put in a couple of directories to make sure of redirection back to the forum root.

And your forum root is where the index.php is that needs to be modified.


JDMhustle

one question, is it possible to get the white background back? i see it has changed to theme background

This website is proudly hosted on Crocweb Cloud Website Hosting.