Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#71 2012-09-28 21:44:28

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

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

Yes, it’s definitely the logic, Hilary! I think I’ve got it and I think I even understand its logic too :-)

<txp:if_custom_field name="secure"> // (There is always this custom field even if empty)
  <txp:cbe_frontauth_protect level='1,<txp:custom_field name="secure" />'>
    <txp:cbe_frontauth_if_logged> 
        Protected content just for the privileged few
    </txp:cbe_frontauth_if_logged> 
          <txp:else /> // If they are not logged in or have wrong privilege level	 
            <txp:output_form form=“form_login” /> // Show login form
   </txp:cbe_frontauth_protect> 
</txp:if_custom_field>
  <txp:if_custom_field name="secure" value=""> If field is empty/article is unprotected
              Unprotected content whether logged in or not
  </txp:if_custom_field>

Thanks for the help. I hope this perhaps helps other code-phobics!


Wondrous Healing Wondrous ways to a healthy old age
Safe Reiki Harmless natural healing.

Offline

#72 2012-09-28 21:53:36

hilaryaq
Plugin Author
Registered: 2006-08-20
Posts: 265
Website

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

Glad you got it working, well done!! Once the logic clicks you can do anything with txp :)


…………………
I <3 txp
…………………

Offline

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

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,259
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!


Wondrous Healing Wondrous ways to a healthy old age
Safe Reiki Harmless natural healing.

Offline

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

wet
Developer
From: Lenzing, Austria
Registered: 2005-06-06
Posts: 3,267
Website

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,259
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!


Wondrous Healing Wondrous ways to a healthy old age
Safe Reiki Harmless natural healing.

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: 478
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: 478
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

Board footer

Powered by FluxBB