data-ad-format="auto" data-full-width-responsive="true">

Update/fix for new version 2.3.1

Update/fix for new version 2.3.1

{SEARCH} fix

{SEARCH} shortcode uses now only new template system

if {SEARCH} returns value 1, then check theme if it doesn't have them search_template.php.  Then find $SEARCH_SHORTCODE  and replace it with 

Example:

$SEARCH_SHORTCODE = "
<div id='search-header' class='animated bounceInRight'>
<div class='input-group'>
<input type='text' name='q' class='form-control' placeholder="".LAN_SEARCH."">
<input type='hidden' name='s' >
<span class='input-group-btn'>
<button class='btn btn-default' type='submit' ><i class='fa fa-search'></i></button> 
</span>
<input type='hidden' name='s' >
</div><!-- /input-group -->
</div>"; 

Fix: 

$SEARCH_TEMPLATE['shortcode'] = "
<div id='search-header' class='animated bounceInRight'>
<div class='input-group'>
<input type='text' name='q' class='form-control' placeholder="".LAN_SEARCH."">
<input type='hidden' name='s' >
<span class='input-group-btn'>
<button class='btn btn-default' type='submit' ><i class='fa fa-search'></i></button> 
</span>
<input type='hidden' name='s' >
</div><!-- /input-group -->
</div>";

Used/found in: 

Openmind 2.1.1 

Fatal error: Class theme contains 1 abstract method...

If you use theme with theme.html (some for 2.3.0), after update to 2.3.1 you will see this error:

Fatal error: Class theme contains 1 abstract method and must therefore be declared abstract or implement the remaining methods

You can look for an updated theme version, but if there is no one, the fix is easy:

1. rename _construct() to init()

2. move  e107::lan('theme');  before class itself

Badges fix

This is mainly related to updated legacy themes, but maybe this can be useful for some others.

If you notice something like this: 

E107 V231 Fix

you need to find styling for a tag and remove display: block; 

It is because core templates were changed to list-group version. 

It should look this way:

E107 V231 Fix2

Found in:

RideBlue2 2.1.0 [for 2.3.1 only] Fixed in: 2.1.1

Libraries fix (after 30.1)

Not sure if this is correct fix because there are no information about this change, but today sync (13.2) broke look of my site.

In theme.xml 

<library name="bootstrap" version="4" /> 
<library name="fontawesome" version="5" />

change to:

<library name="bootstrap" version="4" scope="front,admin,wysiwyg"/>
<library name="fontawesome" version="5" scope="front,admin,wysiwyg"/>

Not sure about settings, but without a scope, libraries are not loaded. 

This theme uses bootstrap4, so I know that it is not loaded in the admin area (although scope admin), and it is probably loaded in the TinyMCE area thanks WYSIWYG scope.  Not sure for now, I am not using the Tinymce4 plugin for now. 

Don't forget to clear cache, theme.xml is cached in the file. 

Fix (problem) with standalone login page (after cca 13.2.)

You can't use e_IFRAME inside the theme class because it is already defined.  

Something like this will not work:

//login page
$this->membersonly_enabled = e107::getPref('membersonly_enabled');
if (e_PAGE == "login.php" && !$this->membersonly_enabled) {
define('e_IFRAME', '0');
}

Fix:

Put it outside theme class, like before without this class.

 //login page
$membersonly_enabled = e107::getPref('membersonly_enabled');
if (defined("e_PAGE") && e_PAGE == "login.php" && !$membersonly_enabled) {
define('e_IFRAME', '0');
}

If the theme sets this according to the actual layout, there is no fix. This option is available only for the login page, all other pages will have a fatal error in PHP 8.  

I asked as a feature request to have more variability, it wasn't accepted. So the rules are:

- signup and forgotten password pages are always standalone (normal pages with header and footer) until you have a members-only version. Modal versions are not supported.

- login page is by default modal (no header and footer), you can change it the way above.  

Replacement of custom header shortcode form JMT plugin JM_CUSTOM_HEADER

You need to move this functionality to theme shortcodes

Add new properties:

private $actualLayoutData= array();
private $sitetheme = '';

Change _construct() to init();

Fill

$this->sitetheme = e107::getPref('sitetheme');
if(e107::isInstalled('jmtheme')) {
   $where = "layout_theme = '{$this->sitetheme}' AND layout_mode = '".THEME_LAYOUT."' LIMIT 1 ";
   $this->actualLayoutData = e107::getDb()->retrieve('jmlayout', '*', $where ); 
}

Now change header shortcode:

Simple version:

function sc_header()
{
  $headerName = varset( $this->actualLayoutData['layout_header'] , "header_default");
  $headerpath = THEME . "headers/{$headerName}.html";

  if (file_exists($headerpath))
  {
     $text = file_get_contents($headerpath);
  }
  return $text;
}

The extended version is not possible anymore, saving here just for records.

function sc_header($parm)
{
  $text = '';
  if ($parm['header'])
  {
    $headerCode = $parm['header'];
    $headerName = varset( "header_" . $neededheader , "header_default");
  }
  else
  {
    $headerName = varset( $this->actualLayoutData['layout_header'] , "header_default");
  }
  $headerpath = THEME . "headers/{$headerName}.html";

  if (file_exists($headerpath))
  {
     $text = file_get_contents($headerpath);
  }
  return $text;
}

This shortcode is specific because it doesn’t need to use parseTemplate() to parse shortcodes.  I think that it is possible to replace {---HEADER---} with theme shortcode with the theme’s parameters, but then parseTemplate() needs to be used. Not tested, short of time.

The version with {---HEADER---}  above is the actual official way how to do it.

theme preferences are not available in theme init() or __costruct() methods

Not sure what to think about this. Maybe bug?

All $this->themePrefs   needs to be replaced...

Not loaded theme css files

You have this problem if the theme manager doesn't have an area about settings stylesheets. And you installed a fresh theme, otherwise, it takes from cache or site prefs. No idea, the old installation works.

Open theme.xml

<stylesheets>
<css file="style_default.css" name="Default Version" default="true" />
<css file="style_orange.css" name="Orange Version" />
<css file="style_green.css" name="Nightvision Version" />
</stylesheets> 

And add  to each line: scope="front,admin,wysiwyg"

Result:

<stylesheets>
<css file="style_default.css" name="Default Version" default="true" scope="front,admin,wysiwyg" />
<css file="style_orange.css" name="Orange Version" scope="front,admin,wysiwyg"/>
<css file="style_green.css" name="Nightvision Version" scope="front,admin,wysiwyg"/>
</stylesheets>

Then go to the Theme Manager and confirm that at least one of the styles is set as default. 

Confirmed:

Landing Zero 2 1.4 Fixed: LZ2 1.5

No form on signup page

Check if you have allowed user registration.

Then check if your theme has signup_template.php file. 

If yes, delete/rename this file.