Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#133 2015-11-21 19:12:23

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

Cool !
Thx Claire.

Offline

#134 2016-07-27 08:18:41

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,538
Website GitHub Twitter

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

Hi
I dont know what am i misdoing, but the code below is not working link it should!

<txp:cbe_frontauth_protect level="5">
	<p>Je suis level 5 level du user avec cbe_frontauth_whois : <txp:cbe_frontauth_whois type="privs" /></p><hr>
</txp:cbe_frontauth_protect>
<txp:cbe_frontauth_protect level="6">
	<p>Je suis level 6 level du user avec cbe_frontauth_whois : <txp:cbe_frontauth_whois type="privs" /></p>
</txp:cbe_frontauth_protect>

The result :

Je suis level 5 level du user avec cbe_frontauth_whois : 6
Je suis level 6 level du user avec cbe_frontauth_whois : 6

What am i doing wrong ?
I use txp 4.5.7, php 5.4.45 / MySQL: 5.5.5-10.0.25-MariaDB-cll-lve

Hi, I tryed the 0.9.6 version and it works, i think it s a bug on the new version 0.9.7

Last edited by Dragondz (2016-07-27 09:16:42)

Offline

#135 2017-11-02 00:53:24

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 687
Website Mastodon

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

cbe_frontauth 0.97 gave me a unregistered_tag error in debug mode on a site updated from 4.4.1 to 4.6.2.

The error goes away at first by adding the following at the top of the plugin code:

if (class_exists('\Textpattern\Tag\Registry')) { Txp::get('\Textpattern\Tag\Registry') ->register('cbe_frontauth') ->register('cbe_frontauth_backend') ->register('cbe_frontauth_box') ->register ('cbe_frontauth_if_connected') ->register('cbe_frontauth_invite') ->register('cbe_frontauth_edit_article') ->register('cbe_frontauth_label') ->register('cbe_frontauth_link') ->register('cbe_frontauth_if_logged') ->register('cbe_frontauth_login') ->register('cbe_frontauth_loginwith') ->register('cbe_frontauth_logname') ->register('cbe_frontauth_logout') ->register('cbe_frontauth_password') ->register('cbe_frontauth_protect') ->register('cbe_frontauth_redirect') ->register('cbe_frontauth_reset') ->register('cbe_frontauth_stay') ->register('cbe_frontauth_submit') ->register('cbe_frontauth_whois') ; }

When the cbe_frontauth-made article EDIT box appears in the frontend i get popup errors indicating, that the article ID in question didn’t make it into the plugin-generated link:

User_Error "'' is not an integer". twice
then
User_Error "Incorrect parameter count in the call to native function 'FROM_UNIXTIME'".
then the whole round again.

I end up with an empty article write window in the backend.

Any idea, what it could be?
The site was updated (not running cbe_frontauth before), because the server provider announced to update PHP from 5.3 to a newer version. In fact they didn’t update yet.
register globals ON in htaccess gives me a security warning in TXP diagnosis about an outdated PHP version used.
Maybe that is the source of error?

Last edited by jayrope (2017-11-02 21:00:07)


A hole turned upside down is a dome, when there’s also gravity.

Offline

#136 2022-04-25 09:45:32

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,538
Website GitHub Twitter

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

Hi Claire

The php 7.3 are throwing a warning about a deprecated creat_function, i dont know how to fix that, (it s not urgent it only to let you know).

Cheers.

Offline

#137 2022-04-25 16:30:14

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

Dragondz wrote #333149:

The php 7.3 are throwing a warning about a deprecated create_function, i dont know how to fix that, (it s not urgent it only to let you know).

The create_function function is removed altogether in PHP8. I came across this problem elsewhere and looked at how to resolve it, so here’s a possible (untested) solution based on what I learned. I’m not very familiar with the plugin so haven’t been able to test it in action. Perhaps you could test it?

In the function cbe_frontauth_edit_article replace:

//      array_walk( $path_parts, create_function( '&$v, $k', '$v = $k."=".$v ;' ) ) ;
        array_walk(
            $path_parts,
            function(&$v,$k) { $v = $k . "=" . $v; }
        );

and in function _cbe_fa_init replace:

//  array_walk( $init_for, create_function( '&$v, $k, $p', '$v = $v."_".$p ;'), $type ) ;
    array_walk(
        $init_for,
        function(&$v,$k,$p) { $v = $v . "_" . $p; },
        $type
    );

Also note an addition of the following line in gas-kirito’s fork on this line:

include_once(txpath.'/lib/txplib_admin.php');

That fork also reworks the help text but aside from that one added line the code is identical, so it doesn’t include any other changes.

To make life easier, see this post for an updated plugin try -downloading this zip file which contains the above changes plus gas-kirito’s additional line and jayrope’s tag registration in a php file of just the code (it’s not the whole plugin, just for swapping out in the file system). Swap that file out with the one in /textpattern/plugins/cbe_frontauth/ of v4.8.8 and see if that gets you any further. If not, more work is needed, if yes, perhaps you could test if it’s reliable and if it is, we can make a proper plugin update of it.

EDIT: If it doesn’t work, do you think (one of) you could set up a little test site / mini theme that one could download and use to debug problems. It looks like this is one of those plugins that offers some key functionality but Claire last updated it many years ago and hasn’t logged into the forum for a long while either. Alternatively, we might be able to identify good alternatives.


TXP Builders – finely-crafted code, design and txp

Offline

#138 2022-04-26 07:56:36

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,538
Website GitHub Twitter

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

Hi Jakob

I made the changes you mentioned and it seems to work at first glance.

I will test it more carefully and see if all is good.

Thanks man.

Offline

#139 2022-04-26 12:00:42

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

Dragondz wrote #333154:

I made the changes you mentioned and it seems to work at first glance. I will test it more carefully and see if all is good.

That’s excellent if it does. It’d be great if you could test it – or make a little test setup. We could then repackage it up, along with kirito’s reworked help notes, into an updated plugin.

I’ve lost track of how this plugin compares to mck_login (kirito has an updated fork of that too), mem_self_register and the if_logged_in tags, potentially in combination with etc_post.


TXP Builders – finely-crafted code, design and txp

Offline

#140 2022-04-26 14:08:59

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,538
Website GitHub Twitter

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

Hi

I made some tests and all seems to works as expected! login, logout, test if someone has some level.

Right now all is good.

Cheers.

Offline

#141 2022-04-26 14:54:35

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

Dragondz wrote #333157:

Hi

I made some tests and all seems to works as expected! login, logout, test if someone has some level.

Right now all is good.

Cheers.

Nice. Is the problem of an empty article that jayrope describes above also something that cbe_frontauth caters for? Or is that some other code. Sounded pretty essential but I don’t the plugin well enough to judge.


TXP Builders – finely-crafted code, design and txp

Offline

#142 2022-04-26 17:20:03

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,538
Website GitHub Twitter

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

jakob wrote #333160:

Nice. Is the problem of an empty article that jayrope describes above also something that cbe_frontauth caters for? Or is that some other code. Sounded pretty essential but I don’t the plugin well enough to judge.

Hi, i dont know never used that feature before.

Offline

#143 2022-04-27 09:00:54

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

OK, to tie up the loose ends so far, here’s an updated fork of cbe_frontauth with the folllowing changes incorporated:

  • refactored help + changelog (as per Kirito’s repo)
  • kirito’s v4.8 compatibility update
  • Tag registration (as per jayrope’s code above)
  • Refactored create_function for php 7.3+ compatibility.

These are all really just compatibility fixes with no changed functionality and I’m sure there’s more that could be done. Nevertheless I’ve bumped the version number up to 0.9.8 and made a new txt installer. You can find it here:


TXP Builders – finely-crafted code, design and txp

Offline

#144 2022-04-27 12:34:07

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,538
Website GitHub Twitter

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

Thanks Jakob,

That will save the hassle to modify it each time i use it.

Cheers.

Offline

Board footer

Powered by FluxBB