Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#73 2012-10-01 19:53:11

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

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

Yes, TXP is amazing. I wish I could use it better. I’ve had a few eureka moments over the years re the logic but then I struggle again! I’ve just written up my above solution over at TXP Tips and at the end I said to put this in the head to protect against spiders:

<txp:if_custom_field name="secure">
   <meta name="robots" content="none,nofollow,noindex,noarchive,nosnippet,noodp,noydir">
<txp:else />
   <meta name="robots" content="index, follow">
</txp:if_custom_field>

In this simple if/else, Textpattern takes it that if there is nothing in the Secure field, then allow robots. So why does Textpattern not seem to do the same thing in my solution above? In my solution above I have to explicitly state the value of "" to get txp to perform an action based on an empty field. I tried many ways to not use the value attribute but could not manage it. Did I just not figure out the right way to do it like that, or is value essential in anything other than a simple either/or? I’m lost again as to the logic!


BB6 Band My band
Gud One My blog

Offline

#74 2012-10-02 05:54:36

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

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

zero wrote:

Did I just not figure out the right way to do it like that, or is value essential in anything other than a simple either/or? I’m lost again as to the logic!

Textpattern’s tags do work in a consistent fashion no matter how complicated or simple the surrounding conditional structure is.

value is not essential but optional.

If you do not add this attribute to the tag, it is assumed that you want to compare the value of a custom field against “nothing”, where “nothing” is one of the following:

  • an empty string with zero characters. Watch out for blanks or other white-space characters – these are invisible but not “nothing”.
  • a numerical zero (“0”, “0.0000”, et cetera)

If the custom field’s value contains “something” (as opposed to “nothing” from above) the conditional tag is “true” and it’s contained statements are processed. Otherwise Textpattern proceeds to the “txp:else” branch if it exists.

If you do add this attribute to the tag, the custom field’s value is compared against your provided “value”.

Any other behaviour would be considered a bug and should be reported.

Offline

#75 2012-10-02 08:47:41

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

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

Thanks Robert, for that very clear explanation. I can understand that! I have re-run a few possibilities through and have now found logical reasons why they did not work. So the logic is sinking in! I’ll now end my disruption of this plugin thread. Thanks!


BB6 Band My band
Gud One My blog

Offline

#76 2012-10-11 18:28:19

cabes
Member
Registered: 2008-01-01
Posts: 28

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

How do I protect an area so only a specific user can see it? I thought I could use <txp:cbe_frontauth_protect name=“username” /> but it doesn’t seem to be working for me. Is that correct and I am just implementing wrong, or is that for a different purpose?
Thanks,
Caleb

Offline

#77 2012-10-11 18:59:23

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

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

cabes a écrit:

How do I protect an area so only a specific user can see it? I thought I could use <txp:cbe_frontauth_protect name=“username” />

Yes, that’s way to use it, just make sure that you use the login and not the real name.

Offline

#78 2012-10-11 19:27:19

cabes
Member
Registered: 2008-01-01
Posts: 28

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

Ok great, I got it to work. Thanks! This plugin is really wonderful, especially mixed with smd_bio. Thanks for all your hard work.

Caleb

Offline

#79 2012-10-18 15:24:47

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

Hello Claire,

I want limited an article for all admins (whatever their name) and the author of the article.

I want level="1" OR name='<txp:author title="0" />'
But

<txp:cbe_frontauth_if_connected level="1" name='<txp:author title="0" />'>

is not a solution

A Idee ?

Offline

#80 2012-10-18 16:49:58

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

…And a strang behavior for cbe_frontauth_whois

If cbe_frontauth_whois is before cbe_frontauth_if_logged is return nothing

I want display the user connected privilege level in a class for body tag :

<body class='user-level<txp:cbe_frontauth_whois type="privs" />'>

And I need us this code :

<txp:cbe_frontauth_if_logged></txp:cbe_frontauth_if_logged>
<body class='user-level<txp:cbe_frontauth_whois type="privs" />'>

It is possible to improve this?

Offline

#81 2012-10-18 17:05:41

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

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

sacripant a écrit:

I want limited an article for all admins (whatever their name) and the author of the article.

The logic involved in <txp:cbe_frontauth_if_connected> is an AND.
So, the solution for the moment is… duplicate code (sorry) :

<txp:cbe_frontauth_if_connected level="1">
  <txp:output_form form="protected_content" />
</txp:cbe_frontauth_if_connected>

<txp:cbe_frontauth_if_connected name='<txp:author title="0" />'>
  <txp:output_form form="protected_content" />
</txp:cbe_frontauth_if_connected>

Offline

#82 2012-10-18 17:29:48

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

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

sacripant a écrit:

…And a strang behavior for cbe_frontauth_whois
It is possible to improve this?

It will :) Bug spotted, but needs more tests.

For the moment, it is safe to use it the way you do, or this one : <txp:cbe_frontauth_if_logged><txp:cbe_frontauth_whois /></txp:cbe_frontauth_if_logged>

Offline

#83 2012-10-19 11:07:41

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

Hello Claire,

It’s me again :D …

with this code to generate a login form

<txp:cbe_frontauth_login invite="">
	<fieldset>
		<legend>Connexion</legend>
		<txp:cbe_frontauth_logname label="Name" wraptag="div" class="form-12-12" />
		<txp:cbe_frontauth_password label="Pass" wraptag="div" class="form-12-12" />
		<div class="form-12-12">
			<txp:cbe_frontauth_submit label="Go" class="btn" />
			<txp:cbe_frontauth_reset label="Password forgotten ?" />
		</div>	
	</fieldset>
</txp:cbe_frontauth_login>

I’m this warning :

Erreur de balise : <txp:cbe_frontauth_reset label="Password forgotten ?" /> -> Textpattern Warning: cette balise n’existe pas lors du traitement du module “Aucun” dans le gabarit “default”

textpattern/lib/txplib_publish.php:425 trigger_error()
textpattern/lib/txplib_publish.php:311 processTags()
textpattern/lib/txplib_misc.php(812) : eval()’d code:530 parse()
textpattern/lib/txplib_misc.php(812) : eval()’d code:774 _cbe_fa_inout()
textpattern/lib/txplib_misc.php(812) : eval()’d code:450 cbe_frontauth()
textpattern/lib/txplib_misc.php(812) : eval()’d code:98 _cbe_fa_inout_process()
textpattern/lib/txplib_publish.php:411 cbe_frontauth_login()
textpattern/lib/txplib_publish.php:324 processTags()
textpattern/lib/txplib_misc.php(812) : eval()’d code:753 parse()
textpattern/lib/txplib_misc.php(812) : eval()’d code:128 cbe_frontauth()

Offline

#84 2013-01-30 19:33:21

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

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

Hi Claire.

I try to use your plugin on a multisites installation. It seems that the login system doesn’t work due to different subdomains in use: en.domain.com Vs admin.en.domain.com.

Some ideas to correct it?

Edit: Config error. No worry: all works fine ;)

Cheers,

Last edited by Pat64 (2013-01-30 21:33:42)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

Board footer

Powered by FluxBB