FlatPress Mobile Plugin – Compatibility Fix for FlatPress 1.5.1 / PHP 8.3 || FlatPress Mobile Plugin – Kompatibilitäts-F

Find help with FlatPress plugins, report a plugin bug, request or present new plugins.
Post Reply
Ronny-M
Posts: 5
Joined: Sat Oct 01, 2022 2:56 am

FlatPress Mobile Plugin – Compatibility Fix for FlatPress 1.5.1 / PHP 8.3 || FlatPress Mobile Plugin – Kompatibilitäts-F

Post by Ronny-M » Thu May 21, 2026 3:31 pm

Hello everyone,

I recently tried using the old "Mobile" plugin with the following systems:

* FlatPress 1.5.1
* PHP 8.3.31
* Smarty 5.x

The plugin generated an HTTP 500 error immediately after activation.

The error log showed:

Code: Select all

Call to undefined method Smarty\Smarty::register_block()
The reason for this is that newer Smarty versions no longer use:

Code: Select all

register_block()
Instead, Smarty 5 requires:

Code: Select all

registerPlugin()

The following change to:

Code: Select all

fp-plugins/mobile/plugin.mobile.php

resolved the issue.

Old Code:

Code: Select all

$smarty->register_block(
'mobile',
array($this, 'smarty_block')

);

New Code:

Code: Select all

$smarty->registerPlugin(
'block',
'mobile',

array($this, 'smarty_block')

);

After replacing the function call, a missing closing brace `}` had to be added to correctly close the constructor.

After these changes:

* The plugin is now correctly activated again.

* Mobile device detection works.

* The mobile theme loads again under FlatPress 1.5.1.

This might help other users who want to use older FlatPress plugins with newer PHP versions.

Best regards,
Ronny

I will upload the finished, new plugin here soon. I'll also upload a copy, or rather a fork, of the plugin to GitHub. At the same time, I'm updating the version to 1.1.0; it was previously 1.0.3. However, since the plugin hasn't been maintained since 2022, I've forked it.

------------

# FlatPress Mobile Plugin – Kompatibilitäts-Fix für FlatPress 1.5.1 / PHP 8.3

Hallo zusammen,

ich habe kürzlich versucht, das alte „Mobile“-Plugin mit folgenden Systemen zu verwenden:

* FlatPress 1.5.1
* PHP 8.3.31
* Smarty 5.x

Das Plugin erzeugte direkt nach der Aktivierung einen HTTP-500-Fehler.

Im Fehlerprotokoll stand:

Code: Select all

Aufruf der nicht definierten Methode Smarty\Smarty::register_block()
Der Grund dafür ist, dass neuere Smarty-Versionen nicht mehr verwenden:

Code: Select all

register_block()
Stattdessen benötigt Smarty 5:

Code: Select all

registerPlugin()

Die folgende Änderung in:

Code: Select all

fp-plugins/mobile/plugin.mobile.php
hat das Problem behoben.

Alter Code:

Code: Select all

$smarty->register_block(
'mobile',
array($this, 'smarty_block')
);

Neuer Code:

Code: Select all

$smarty->registerPlugin(
'block',
'mobile',
array($this, 'smarty_block')
);

Nach dem Ersetzen des Funktionsaufrufs musste außerdem eine fehlende schließende Klammer `}` hinzugefügt werden, um den Konstruktor korrekt zu schließen.

Nach diesen Änderungen:

* Das Plugin wird wieder korrekt aktiviert.

* Die Erkennung mobiler Geräte funktioniert.

* Das mobile Theme wird unter FlatPress 1.5.1 wieder geladen.

Vielleicht hilft dies anderen Nutzern, die ältere FlatPress-Plugins auch unter neueren PHP-Versionen verwenden möchten.

Viele Grüße
Ronny

Das fertige, neue, Plugin werde ich noch hier hochladen. Eine Kopie, bzw. den Fork des Plugins, stelle ich noch auf Github ein. Ich erhöhe gleichzeitig die Version auf 1.1.0, vorher war 1.0.3 genannt. Aber, da das Plugin seit 2022 nicht mehr gepflegt wird, habe ich es geforkt.
Last edited by fraenkiman on Sun Jul 19, 2026 11:52 pm, edited 1 time in total.
Reason: The forum software does not support Markdown. Therefore, code is wrapped in code tags.

Panther
Posts: 93
Joined: Mon Aug 12, 2019 11:05 pm

Re: FlatPress Mobile Plugin – Compatibility Fix for FlatPress 1.5.1 / PHP 8.3 || FlatPress Mobile Plugin – Kompatibilitä

Post by Panther » Sat Jul 11, 2026 7:43 pm

I used for years, but like you I have had this problem too. Now I am using Leggero2 theme and it is working automatically in mobile version.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests