SimplePortal

Customization => Custom Coding => Topic started by: Sam12345 on April 02, 2011, 11:29:22 AM

Title: Removal of top member area from all SP pages
Post by: Sam12345 on April 02, 2011, 11:29:22 AM
Dear all
I just installed a new theme for my forum and I am designing a website with Simple Portal around the forum. Everything seems to be working well. I am wondering if I can hide the top member area completely from the pages but retain it on the forum. Please have a look at http://www.clinicalresearchsociety.org and let me know if you can help.
Thanks in advance.
Cheers!
Sam
Title: Re: Removal of top member area from all SP pages
Post by: Sam12345 on April 04, 2011, 12:55:14 PM
Anybody?
Angelina?

Thanks....
Sam
Title: Re: Removal of top member area from all SP pages
Post by: AngelinaBelle on April 04, 2011, 01:53:42 PM
All I see at that URL is Invitation for Council Membership. I cannot see what you are talking about.
Title: Re: Removal of top member area from all SP pages
Post by: Sam12345 on April 05, 2011, 08:23:22 AM
Dear Angelina
Thanks for getting back :)
Please have a look at this. http://www.clinicalresearchsociety.org/index.php?page=page2885 This is a SP page. If you see, there is a user box sitting between the logo and the main content area below. This box has the search field in it as well as field for logging in. After login, the same box displays user avatar and other information related to the member including unread posts, etc. I need to remove this box from all SP pages but would like to have it available on the forum pages. This user box is defined in the index.template.php that I have attached to this post. I hope this makes the situation a little more clear.
Thanks for helping out!
Regards
Sam
Title: Re: Removal of top member area from all SP pages
Post by: AngelinaBelle on April 05, 2011, 10:01:59 AM
This may require some tricky customization.
I'm not so good with the REQUEST array.  But the SimplePortal developers are.

So, if I were doing this myself, I think I would
Title: Re: Removal of top member area from all SP pages
Post by: Sam12345 on April 05, 2011, 11:58:22 AM
Hi Angeline
Thanks for your response. I tried to strip off the code for the user area from index.template.php and it gets removed from all pages. Then I put the code in a custom php block  but I am getting a syntax error message. What could I be doing wrong. O have the code below for your reference. Please suggest anything that comes to your mind.

Thanks
Sam  :nervous-happy:

Code: [Select]
<div id="userbox">
<div id="time-stats">
', $context['current_time'],'<span>', $txt['latest_member'], ': ', $context['common_stats']['latest_member']['link'], '</span>
</div>
<div id="searchbox">
<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
<input class="searchinput" type="text" name="search" value="', $txt['forum_search'], '" onfocus="this.value = \'\';" onblur="if(this.value==\'\') this.value=\'', $txt['forum_search'], '\';" />
<input id="searchbutton" class="pngbg" type="submit" name="submit" value="" />
<input type="hidden" name="advanced" value="0" />';

// Search within current topic?
if (!empty($context['current_topic']))
echo '
<input type="hidden" name="topic" value="', $context['current_topic'], '" />';

// If we're on a certain board, limit it to this board ;).
elseif (!empty($context['current_board']))
echo '
<input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';

echo '
</form>
</div>
<div id="memb-login">';
if ($context['user']['is_logged'])
{
if(!empty($context['user']['avatar']))
echo '
<div class="memb-avat">'.$context['user']['avatar']['image'].'</div>';

echo '
<ul>';

echo '<li class="memb-name">', $txt['hello_member_ndt'], ' ', $context['user']['name'],',</li>';

// Only tell them about their messages if they can read their messages!
if ($context['allow_pm'])
echo '
<li>', $txt['msg_alert_you_have'], ' <a href="', $scripturl, '?action=pm">', $context['user']['messages'], ' ', $context['user']['messages'] != 1 ? $txt['msg_alert_messages'] : $txt['message_lowercase'], '</a>', $txt['newmessages4'], ' ', $context['user']['unread_messages'], ' ', $context['user']['unread_messages'] == 1 ? $txt['newmessages0'] : $txt['newmessages1'],'</li>';

// Is the forum in maintenance mode?
if ($context['in_maintenance'] && $context['user']['is_admin'])
echo '<li>[<strong>', $txt['maintenance'], '</strong>]';

// Are there any members waiting for approval?
if (!empty($context['unapproved_members']))
echo '[<a href="', $scripturl, '?action=viewmembers;sa=browse;type=approve">', $context['unapproved_members'] , '', $txt['approve'], '</a> ]</li>';

echo '
<li><a href="', $scripturl, '?action=unread">', $txt['view_unread'], '</a> &bull;
<a href="', $scripturl, '?action=unreadreplies">', $txt['view_replies'], '</a> &bull;
<a href="', $scripturl, '?action=profile;area=showposts;u=', $context['user']['id'], '">', $txt['view_own_posts'], '</a></li>';

// Show the total time logged in?
if (!empty($context['user']['total_time_logged_in']))
{
echo '
<li>', $txt['totalTimeLogged1'];

// If days is just zero, don't bother to show it.
if ($context['user']['total_time_logged_in']['days'] > 0)
echo $context['user']['total_time_logged_in']['days'] . $txt['totalTimeLogged5'];

// Same with hours - only show it if it's above zero.
if ($context['user']['total_time_logged_in']['hours'] > 0)
echo $context['user']['total_time_logged_in']['hours'] . $txt['totalTimeLogged6'];

// But, let's always show minutes - Time wasted here: 0 minutes ;).
echo $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged7'], '</li>';
}
echo '
</ul>';
}

// Otherwise they're a guest - this time ask them to either register or login - lazy bums...
else
{
echo '
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
<form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
<div id="log-username">
<input class="log-input" name="user" type="text" onfocus="if(this.value==\'', $txt['username'], '\')value=\'\';" onblur="if(this.value==\'\')value=\'', $txt['username'], '\';" value="', $txt['username'], '" />
</div>
<div id="log-password">
<input class="log-input" name="passwrd" type="password" onfocus="if(this.value==\'', $txt['password'], '\')value=\'\';" onblur="if(this.value==\'\')value=\'', $txt['password'], '\';" value="', $txt['password'], '" />
</div>
<input id="loginbutton" type="submit" value="" name="submit" />
<input type="hidden" name="cookielength" value="-1" />
</form>
<a id="register" href="', $scripturl, '?action=register"></a>';
}

echo '
</div>
</div>
Title: Re: Removal of top member area from all SP pages
Post by: Sam12345 on April 05, 2011, 12:49:46 PM
I tried disabling validation of php in general setting and made the new block to appear on some pages but then it is giving me the following error where it should normally place itself

Parse error: syntax error, unexpected '<' in /home1/******/public_html/Sources/PortalBlocks.php(3351) : eval()'d code on line 1

I tried starting the code with 'echo and ending with '; but that only makes it appear but not functional. I am breaking my head over this...trying to read stuff all over but no success as of now :(
Title: Re: Removal of top member area from all SP pages
Post by: AngelinaBelle on April 05, 2011, 11:31:37 PM
You need to begin with echo '. And, in the index.template.php, you'll need to make sure that the string is terminated properly where you ripped the code out of it.
Title: Re: Removal of top member area from all SP pages
Post by: Sam12345 on April 06, 2011, 11:08:20 AM
Hello AB
I just need a little extra help with the closing of the string. I am not good at PHP at all although I have been running this SMF forum for three years. Should have invested a little more time on learning it. Anyways, in the interim, I may need some more instructions from you as to how to make this box function the way it should without any errors. At this time the status is as follows:

When I put the code in the custom PHP box as is seen in this example http://www.clinicalresearchsociety.org/index.php?page=page2163 , the new box looks diff from the native box that is there in the index.template.php. Most of the HTML elements seem to be parsed but the PHP is not working. After logging in, the upper native box shows all the info about the member and other stuff, but this custom php box does not change at all ( Please see attached screnshot). I need some help here and I promise to keep learning so I can help myself more in the future :)

Thanks as always!
Sam  :nervous-happy:
Title: Re: Removal of top member area from all SP pages
Post by: AngelinaBelle on April 06, 2011, 02:12:41 PM
First, I would try, at the top of your block,
Code: [Select]
global $context, $scripturl, $txt;And maybe some other missing global variables that I missed seeing.


It would be easier to call the function ssi_login from SSI.php, but it would certainly look different.
Title: Re: Removal of top member area from all SP pages
Post by: Sam12345 on April 06, 2011, 02:47:56 PM
(http://icons.iconarchive.com/icons/icondrawer/gifts/64/bouquet-icon.png)

SOLVED!
Works Great!!!
A Big Thank you....!!!!


http://www.clinicalresearchsociety.org/index.php?page=page2885 ( SP Page)
http://www.clinicalresearchsociety.org/forum/ ( Forum page)
Title: Re: Removal of top member area from all SP pages
Post by: AngelinaBelle on April 07, 2011, 10:08:08 AM
Glad to help.
You probably don't want that block at http://www.clinicalresearchsociety.org/login/

Title: Re: Removal of top member area from all SP pages
Post by: Sam12345 on April 07, 2011, 10:15:11 AM
You are so right. Took it out !! :)
Thanks again.... and I assure you that this is not the last time you heard from me....
Till then...Have a great one!
Sam
Title: Re: Removal of top member area from all SP pages
Post by: AngelinaBelle on April 07, 2011, 07:44:52 PM
Glad to help.
SimplePortal 2.3.8 © 2008-2024, SimplePortal