SimplePortal

Support => English Support => Topic started by: kaamaru on May 14, 2009, 09:09:40 AM

Title: Disable SimplePortal on a theme?
Post by: kaamaru on May 14, 2009, 09:09:40 AM
Is it possible to disable simple portal on a certain theme. I need to find out how to do this because i have this theme: http://www.farfromperfection.com/smf4iphone.html and if i have simple portal it messes it up.

Thanks for any help
Title: Re: Disable SimplePortal on a theme?
Post by: ???1031 on May 14, 2009, 10:22:58 AM
Hmmm as far i know a theme can not disable the Simple Portal. It could be changed something in the code but i think a theme can not do it. You could add Special SPortal template files with own code than SMF will automatic use this one instead of the default one.

Bye
DIN1031
Title: Re: Disable SimplePortal on a theme?
Post by: Eliana Tamerin on May 14, 2009, 01:53:41 PM
Well, you could modify SPortal2.php in sportal_init():

Code: [Select]
if (WIRELESS || empty($modSettings['sp_portal_mode']) || (!empty($maintenance) && !allowedTo('admin_forum')) || isset($_GET['debug']))
return;

and sportal():

Code: [Select]
if (WIRELESS)
redirectexit('action=forum');

If you added something similar to detect the specific theme (number would have to be hardcoded based on each forum) and then disable the portal and redirect them to the forum much like is done for the Wireless template, that could work.
Title: Re: Disable SimplePortal on a theme?
Post by: ccbtimewiz on May 14, 2009, 05:25:07 PM
As Eliana has said...

Find:
Code: [Select]
if (WIRELESS || empty($modSettings['sp_portal_mode']) || (!empty($maintenance) && !allowedTo('admin_forum')) || isset($_GET['debug']))
return;

Replace with:
Code: [Select]
if (WIRELESS || empty($modSettings['sp_portal_mode']) || (!empty($maintenance) && !allowedTo('admin_forum')) || isset($_GET['debug']))
return;

// Add to this array with the IDs of the theme(s). Example: array(1, 5, 6);
$no_portal_themes = array();

// Let's do it. Stop showing SP on the themes defined above! Go Go Go!
if (in_array($settings['theme_id'], $no_portal_themes))
return;
Title: Re: Disable SimplePortal on a theme?
Post by: ???1031 on May 15, 2009, 01:09:33 AM
Hmmm this is a simple way. I think possible this can be a feature :).
Title: Re: Disable SimplePortal on a theme?
Post by: kaamaru on September 07, 2009, 05:49:40 AM
THANK YOU!!!!!
Title: Re: Disable SimplePortal on a theme?
Post by: kaamaru on September 07, 2009, 06:36:46 AM
How should I get this to work on 2.3?
Title: Re: Disable SimplePortal on a theme?
Post by: Nathaniel on September 07, 2009, 07:23:23 AM
Try this edit:
Code: ("Find this code (sources/Subs-Portal.php)") [Select]
    $sportal_version = '2.3';
Code: ("Replace with this code") [Select]
    $sportal_version = '2.3';

    // Add to this array with the IDs of the theme(s). Example: array(1, 5, 6);
    $no_portal_themes = array();

    // Let's do it. Stop showing SP on the themes defined above! Go Go Go!
    if (in_array($settings['theme_id'], $no_portal_themes))
        return;

I just updated ccbtimewiz's edit so that it should work with SP 2.3. :)
Title: Re: Disable SimplePortal on a theme?
Post by: Stigmartyr on May 09, 2010, 02:26:02 PM
I just started using the iPhone theme for mobile users, but they're complaining they've lost access to the shoutbox.

Is there any way we could offer them a compromise?  When I manually enter the URL for the shoutbox page into the iPhone theme it's rendered without the post box, so we can read but we can't post.

I was wondering if I could get a little help with that.  I am thinking I could add 'Shout' as a button to the iPhoe theme's menu perhaps, but when they get there, they will need to be able to actually post something.
Title: Re: Disable SimplePortal on a theme?
Post by: kaamaru on May 13, 2010, 09:43:49 AM
Is there a way I can only disable the left and right blocks?
Title: Re: Disable SimplePortal on a theme?
Post by: Nathaniel on May 13, 2010, 10:27:02 PM
The edit below should do it:
Code: ("Find") [Select]
$blocks = getBlockInfo(null, null, true, true);
Code: ("Replace") [Select]
if (in_array($settings['theme_id'], $no_portal_themes))
$blocks = getBlockInfo(array(2, 3), null, true, true);
else
$blocks = getBlockInfo(null, null, true, true);

Remember that the $no_portal_themes variable will need to be defined.
Title: Re: Disable SimplePortal on a theme?
Post by: kaamaru on May 14, 2010, 03:45:24 AM
The edit below should do it:
Code: ("Find") [Select]
$blocks = getBlockInfo(null, null, true, true);
Code: ("Replace") [Select]
if (in_array($settings['theme_id'], $no_portal_themes))
$blocks = getBlockInfo(array(2, 3), null, true, true);
else
$blocks = getBlockInfo(null, null, true, true);

Remember that the $no_portal_themes variable will need to be defined.

Sorry, I am really bad at php. How will I define it?
Title: Re: Disable SimplePortal on a theme?
Post by: AngelinaBelle on May 14, 2010, 09:59:43 AM
Suppose you have only one theme for which you want no portal, and it is theme 27
Code: [Select]
  $no_portal_themes = array(27);But if you want no portal for themes 3, 7, and 9
Code: [Select]
   $no_portal_themes = array(3, 7, 9);
And you can stick that right before
Code: [Select]
   if (in_array($settings['theme_id'], $no_portal_themes))
That would keep it all together in one place for you.
 
Since you are new to php AND interested in customizing your php code, you will probably enjoy a php tutorial.  It will really help.  See if you like the one at http://w3schools.com (http://w3schools.com)
 
Title: Re: Disable SimplePortal on a theme?
Post by: kaamaru on June 11, 2010, 01:34:29 PM
The edit below should do it:
Code: ("Find") [Select]
$blocks = getBlockInfo(null, null, true, true);
Code: ("Replace") [Select]
if (in_array($settings['theme_id'], $no_portal_themes))
$blocks = getBlockInfo(array(2, 3), null, true, true);
else
$blocks = getBlockInfo(null, null, true, true);

Remember that the $no_portal_themes variable will need to be defined.

Sorry, I am really bad at php. How will I define it?

I get an error if I use this and  $no_portal_themes = array(16); at the same time. I get an integer error.
Title: Re: Disable SimplePortal on a theme?
Post by: AngelinaBelle on June 11, 2010, 02:05:15 PM
Code: ("Find") [Select]
   $blocks = getBlockInfo(null, null, true, true);
Code: ("Replace") [Select]
   $no_portal_themes = array(16);
   if (in_array($settings['theme_id'], $no_portal_themes))
      $blocks = getBlockInfo(array(2, 3), null, true, true);
   else
      $blocks = getBlockInfo(null, null, true, true);


Title: Re: Disable SimplePortal on a theme?
Post by: kaamaru on June 11, 2010, 04:31:18 PM
I get this.
Title: Re: Disable SimplePortal on a theme?
Post by: Nathaniel on June 11, 2010, 08:08:22 PM
There is a much better way to do this now, open your theme's 'index.template.php' file and add the code below to the end of the 'template_init' function.
Code: [Select]
$settings['disable_sp'] = true;
Title: Re: Disable SimplePortal on a theme?
Post by: kaamaru on June 12, 2010, 05:13:09 AM
There is a much better way to do this now, open your theme's 'index.template.php' file and add the code below to the end of the 'template_init' function.
Code: [Select]
$settings['disable_sp'] = true;

Can I do it so it hides just the left and right blocks?
Title: Re: Disable SimplePortal on a theme?
Post by: Nathaniel on June 13, 2010, 09:28:30 PM
There is a much better way to do this now, open your theme's 'index.template.php' file and add the code below to the end of the 'template_init' function.
Code: [Select]
$settings['disable_sp'] = true;

Can I do it so it hides just the left and right blocks?

Not with that setting. Its back to editing your Sources/Subs-Portal.php file if you want to hide just two of the sides.

Code: ("Find") [Select]
$blocks = getBlockInfo(null, null, true, true);
Code: ("Replace") [Select]
$no_portal_themes = array(16);
if (in_array($settings['theme_id'], $no_portal_themes))
$blocks = array_merge(getBlockInfo(2, null, true, true), $blocks = getBlockInfo(3, null, true, true));
else
$blocks = getBlockInfo(null, null, true, true);

Try that edit, seems that there was a bug in my last post, the getBlockInfo function can't take an array of column ids. ;)
Title: Re: Disable SimplePortal on a theme?
Post by: kaamaru on June 14, 2010, 06:34:38 AM
THANK YOU, THANK YOU, THANK YOU! That worked really well and I was able to display the portal, but I had one problem. This problem only affected the board index and the topic index but not the actual topics themselves. The problem was the css was getting messed up. Is there any portal css file that I could disable or something similar?

With all the blocks disabled:

(http://i671.photobucket.com/albums/vv73/Calumks/Screenshot2010-06-14at113300.png)

With the left and right blocks disabled:

(http://i671.photobucket.com/albums/vv73/Calumks/Screenshot2010-06-14at112724.png)
Title: Re: Disable SimplePortal on a theme?
Post by: Nathaniel on June 14, 2010, 07:55:52 AM
That is most likely due to SimplePortal adding a table to display the portal sides. With some editing of the 'Portal.template.php' file (and maybe the portal.css file as well), you should be able to get it to display how you want it. I suggest that you make a copy of that file in your wireless themes directory, then have a go at editing it.
Title: Re: Disable SimplePortal on a theme?
Post by: kaamaru on June 15, 2010, 06:49:23 AM
Thanks, I got it working. Now all I need to know is how can I take the code out of portalblocks.php for boardnews and put it in portal.template? I need to do this as I only want to edit the block for one theme.

Thanks!
Title: Re: Disable SimplePortal on a theme?
Post by: Nathaniel on June 17, 2010, 12:38:03 AM
Code: ("Find (Sources/PortalBlocks.php)") [Select]
if ($context['SPortal']['core_compat'])
Code: ("Replace") [Select]
template_boardnews($return, $per_page, $page_index, $avatars);
return;

if ($context['SPortal']['core_compat'])

The code below needs to be added to the end of the "Portal.template.php" file (before the "?>") for every theme that has one (probably just the curve theme and your custom theme), otherwise you will get a fatal error for the theme that doesn't have this code (when you view the portal). You can then edit the template as required for a specific theme, you may also want to edit the portal.css file.

Code: [Select]
function template_boardnews($data, $per_page, $page_index, $avatars)
{
global $context, $txt;

if ($context['SPortal']['core_compat'])
{
foreach ($data as $news)
{
echo '
<div class="tborder">
<table class="sp_block">
<tr class="catbg">
<td class="sp_middle">', $news['icon'], '</td>
<td class="sp_middle sp_regular_padding sp_fullwidth"><a href="', $news['href'], '" >', $news['subject'], '</a> | ', $news['timeyear'], '</td>
</tr>
<tr class="windowbg">
<td class="sp_regular_padding" colspan="2">';

if ($avatars && $news['avatar']['name'] !== null && !empty($news['avatar']['href']))
echo '
<img src="', $news['avatar']['href'], '" alt="', $news['poster']['name'], '" width="30" style="float: right;" />
<div class="middletext">', $news['timeday'], ' ', $txt['by'], ' ', $news['poster']['link'], '<br />', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';
else
echo '
<div class="middletext">', $news['timeday'], ' ', $txt['by'], ' ', $news['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';

echo '
<div class="post"><hr />', $news['body'], '<br /><br /></div>
</td>
</tr>
<tr>
<td class="windowbg2" colspan="2">
<div class="sp_right sp_regular_padding">', $news['link'], ' ',  $news['new_comment'], '</div>
</td>
</tr>
</table>
</div>
<br />';
}
}
else
{
foreach ($data as $news)
{
echo '
<h3 class="catbg"><span class="left"></span>
<span class="sp_float_left sp_article_icon">', $news['icon'], '</span><a href="', $news['href'], '" >', $news['subject'], '</a> | ', $news['timeyear'], '
</h3>
<div class="windowbg">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">';

if ($avatars && $news['avatar']['name'] !== null && !empty($news['avatar']['href']))
echo '
<img src="', $news['avatar']['href'], '" alt="', $news['poster']['name'], '" width="30" class="sp_float_right" />
<div class="middletext">', $news['timeday'], ' ', $txt['by'], ' ', $news['poster']['link'], '<br />', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';
else
echo '
<div class="middletext">', $news['timeday'], ' ', $txt['by'], ' ', $news['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';

echo '
<div class="post"><hr />', $news['body'], '</div>
<div class="sp_right">', $news['link'], ' ',  $news['new_comment'], '</div>
</div>
<span class="botslice"><span></span></span>
</div>
<br />';
}
}

if (!empty($per_page))
echo '
<div class="sp_page_index">', $txt['sp-articlesPages'], ': ', $page_index, '</div>';

echo '
<br />';
}
Title: Re: Disable SimplePortal on a theme?
Post by: kaamaru on June 17, 2010, 08:12:56 AM
I am really sorry but I can't find "   if ($context['SPortal']['core_compat'])" anywhere in the Subs-Portal.php file.
Title: Re: Disable SimplePortal on a theme?
Post by: Nathaniel on June 17, 2010, 10:38:08 AM
Thanks because you need to edit the PortalBlocks.php file, not the Subs-Portal.php, apologies for that mistake, I have corrected it in the post above.
Title: Re: Disable SimplePortal on a theme?
Post by: kaamaru on June 23, 2010, 07:27:03 AM
THANKS!
SimplePortal 2.3.8 © 2008-2024, SimplePortal