Our FamilyForum

FamilyForum Documentation & Help => FamilyForum Features & Guidelines => Forum Features => Topic started by: Ken on April 01, 2012, 06:32:21 AM

Title: UserCP Re-Discovered!
Post by: Ken on April 01, 2012, 06:32:21 AM
Just 're-discovered' the FamilyForum  UserCP page (http://www.ourfamilyforum.org/FamilyForum/index.php?page=71)!

It's a really nice page and I've always liked it a lot, so I'll edit it a bit to correct the broken links for some of the functions and then add it back into the Profile pages.  :bigthumb:
Title: Re: UserCP Re-Discovered!
Post by: Ken on April 01, 2012, 06:48:52 AM
Lotsa code here!  :yikes:
Need to sort through all these strings to see why extra code is being added to the page address when a button is clicked.

Example:
(https://www.ourfamilyforum.org/FamilyForum/usercp/find.png) <<< The search button should take us to the search page, but the extra code that is added to the address string causes it to go to the forum page.

Code: [Select]
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 (!$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'].'?phpMyAdmin=6b84a268fac5bc82be63787800983323"><img border="0" src="'.$ent['image'].'" width="'.$img_size.'" height="'.$img_size.'"></a></td>';
$line_2 .= '<td style="font-size:small;font-weight:bold;text-align:center;vertical-align:top;padding:3px;"><a href="'.$scripturl.$ent['link'].'?phpMyAdmin=6b84a268fac5bc82be63787800983323">'.$ent['title'].'</a></td>';
$line_3 .= '<td style="font-size:x-small;text-align:center;vertical-align:top;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>';
Title: Re: UserCP Re-Discovered!
Post by: Skhilled on April 01, 2012, 04:44:26 PM
You have to remember that a lot has changed to SMF and to TP since that was written.
Title: Re: UserCP Re-Discovered!
Post by: Ken on April 01, 2012, 07:46:14 PM
You have to remember that a lot has changed to SMF and to TP since that was written.

Yeah... the code is not all that clear to me, maybe it needs to be posted on the TinyPortal site to see if someone wants to take a look.