SimplePortal

Customization => Themes and Graphics => Topic started by: rad1701 on July 25, 2010, 04:44:08 PM

Title: Limit Theme Choices in Block?
Post by: rad1701 on July 25, 2010, 04:44:08 PM
Is there a way to limit the theme choices that members have to pick from in the standard Theme Choice SP block?  Besides of course, deleting the themes entirely? 

- Thanks!
Title: Re: Limit Theme Choices in Block?
Post by: ccbtimewiz on July 25, 2010, 05:22:42 PM
There is, actually.

However the option is only supported in the SMF 2.0 line.
Title: Re: Limit Theme Choices in Block?
Post by: rad1701 on July 25, 2010, 05:39:30 PM
Hmm, well darn.  I'm using 1.1.11. 

- Thought there might be an easy work around.
Title: Re: Limit Theme Choices in Block?
Post by: ccbtimewiz on July 25, 2010, 06:55:08 PM
There is an easy workaround but it requires hardcoding the source file.

Is that acceptable?
Title: Re: Limit Theme Choices in Block?
Post by: rad1701 on July 25, 2010, 07:55:42 PM
There is an easy workaround but it requires hardcoding the source file.

Is that acceptable?

Certainly.  Love to see the code and what I have to change.  Thanks in advance! 
Title: Re: Limit Theme Choices in Block?
Post by: ccbtimewiz on July 25, 2010, 09:41:55 PM
Open ./Sources/PortalBlocks.php

Find:
Code: [Select]
if ($ID_THEME == 0)
continue;

Replace with:
Code: [Select]
$hidden_themes = array();

if ($ID_THEME == 0) || in_array($ID_THEME, $hidden_themes)
continue;

The $hidden_themes array needs to be filled with the IDs of the themes you don't want to show. Example, to hide theme #1,

$hidden_themes = array(1);

To hide multiple themes, like theme #1 and theme #16:

$hidden_themes = array(1, 16);

To find the ID of a theme, try editing it in the admin panel through Current Theme and look at the URL. It should give you a hint.
Title: Re: Limit Theme Choices in Block?
Post by: rad1701 on July 30, 2010, 07:18:39 PM
Getting an error message after editing the file and forum wouldn't come up:

Parse error: syntax error, unexpected T_BOOLEAN_OR in /home/treksf/treksinscifi.com/forum/Sources/PortalBlocks.php on line 2348

This is the code I tried to use:

Code: [Select]
$hidden_themes = array(3, 14, 16, 21, 23, 24);

      if ($ID_THEME == 0) || in_array($ID_THEME, $hidden_themes)
          continue;
Title: Re: Limit Theme Choices in Block?
Post by: ccbtimewiz on July 31, 2010, 10:37:14 PM
Huh, instead of:

Code: [Select]
if ($ID_THEME == 0) || in_array($ID_THEME, $hidden_themes)
Try;

Code: [Select]
if ($ID_THEME == 0 || in_array($ID_THEME, $hidden_themes))
Title: Re: Limit Theme Choices in Block?
Post by: rad1701 on August 01, 2010, 05:24:09 PM
Nope.  That's didn't help.  Still got this error.

Code: [Select]
Parse error: syntax error, unexpected T_BOOLEAN_OR in /home/treksf/treksinscifi.com/forum/Sources/PortalBlocks.php on line 2348
Title: Re: Limit Theme Choices in Block?
Post by: ccbtimewiz on August 02, 2010, 12:51:35 PM
Man I'm out of practice.

Try this instead perhaps?

Code: [Select]
if (($ID_THEME == 0) || (in_array($ID_THEME, $hidden_themes)))
Title: Re: Limit Theme Choices in Block?
Post by: rad1701 on August 02, 2010, 06:18:31 PM
Nope - sorry.  Back to this error again.

Code: [Select]
Parse error: syntax error, unexpected T_VARIABLE in /home/treksf/treksinscifi.com/forum/Sources/PortalBlocks.php on line 2307
Title: Re: Limit Theme Choices in Block?
Post by: ccbtimewiz on August 12, 2010, 06:24:57 PM
Sorry for the wait.

Please attach the file.
Title: Re: Limit Theme Choices in Block?
Post by: rad1701 on August 14, 2010, 10:59:24 AM
Ok - here's my file.
Title: Re: Limit Theme Choices in Block?
Post by: AngelinaBelle on August 19, 2010, 10:31:58 AM
This one does not seem to have $hidden_themes in it.
Please attach the one you have been working with.
SimplePortal 2.3.8 © 2008-2024, SimplePortal