Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2008-02-03 10:58:01

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: rvm_privileged v0.4

hcgtv wrote:

Hey, this plugin is cool, kind of missed this functionality when I moved to TxP from Nucleus.

Now we can show an edit button next to a story, if we are so privileged, for easy access to the write tab:

/textpattern/index.php?event=article&step=edit&ID=37

How do we the article ID to change depending on which page you’re on?

Offline

#14 2008-02-03 11:00:49

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_privileged v0.4

/textpattern/index.php?event=article&step=edit&ID=<txp:article_id />

Offline

#15 2008-02-03 11:16:43

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: rvm_privileged v0.4

Here is the code I tried…

<txp:rvm_if_privileged>
<p><a target="_blank" id="admin_link" href="/textpattern/index.php?event=article&step=edit&ID=<txp:article_id />">Edit this article</a>
</txp:rvm_if_privileged>

When you click the link, which doesn’t seem to contain the ID, i’m taken to the write tab with this error at the top…

Warning:

Error: '' is not an integer

textpattern/include/txp_article.php:751 assert_int()
textpattern/include/txp_article.php:320 checkIfNeighbour()
textpattern/include/txp_article.php:50 article_edit()
textpattern/index.php:116 include()

in /home/username/public_html/textpattern/lib/txplib_misc.php on line 1999

Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') order by Posted desc limit 1' at line 1 select ID from textpattern where Posted < from_unixtime() order by Posted desc limit 1 in /home/username/public_html/textpattern/lib/txplib_db.php on line 81

Warning:

Error: '' is not an integer

textpattern/include/txp_article.php:751 assert_int()
textpattern/include/txp_article.php:323 checkIfNeighbour()
textpattern/include/txp_article.php:50 article_edit()
textpattern/index.php:116 include()

in /home/username/public_html/textpattern/lib/txplib_misc.php on line 1999

Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') order by Posted asc limit 1' at line 1 select ID from textpattern where Posted > from_unixtime() order by Posted asc limit 1 in /home/username/public_html/textpattern/lib/txplib_db.php on line 81

Offline

#16 2008-02-03 11:17:53

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: rvm_privileged v0.4

Ah. It works on regular articles but not sticky.

How can I get it working on sticky articles?

I have single sticky articles displaying in section lists.

Last edited by FireFusion (2008-02-03 11:20:45)

Offline

#17 2008-02-03 11:48:58

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_privileged v0.4

Upgrade to TXP 4.0.6

Offline

#18 2008-02-03 11:56:28

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: rvm_privileged v0.4

I did before installing this plugin. It’s very strange. The code works on all other pages except sticky articles in article list mode. However if I output just the <txp:article_id /> tag it displays the ID. As soon as it’s in that tag it doesn’t output an ID on those sticky pages.

Also if I go to that sticky article in single article mode it does work again.

mysite.com/section/ <—- Doesn’t display ID

mysite.com/section/sticky-title/ <—- Does display

Last edited by FireFusion (2008-02-03 11:57:14)

Offline

#19 2008-02-06 03:20:38

typeshige
Member
From: USA
Registered: 2005-08-11
Posts: 151
Website

Re: rvm_privileged v0.4

I tried to use <txp:rvm_if_privileged /> around a zem_contact_reborn form. It doesn’t show the form. What am I doing wrong?

Offline

#20 2008-02-06 07:03:15

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_privileged v0.4

Robin, can you open a separate topic for this, since it’s not related to this plugin.

typeshige, are you using TXP 4.0.6 and are you logged in? Also look at the tag trace to see what’s happening.

Offline

#21 2008-02-06 08:19:32

typeshige
Member
From: USA
Registered: 2005-08-11
Posts: 151
Website

Re: rvm_privileged v0.4

rudd:

I took a look at the page source and it looks like its not processing txp tags between rvm_if_priviledged only the plain HTML.

Is this because I’m using rvm_if_priviledged inside another txp tag (my plugin)?

If so, is there anything I can do about it besides taking it out of the plugin?

Thanks in advance!

Last edited by typeshige (2008-02-06 08:19:54)

Offline

#22 2008-02-06 08:55:39

typeshige
Member
From: USA
Registered: 2005-08-11
Posts: 151
Website

Re: rvm_privileged v0.4

This is what I ended up doing but I’m not sure its correct.

I suspected txp can’t do a triple pass for tags, so I examined the code in the rvm_priviledged plugin and used this little bit in my own plugin to tell me if I’m logged in or not:

Snippet from one of my functions:

static $ili = 0;
if ($ili === 0) $ili = is_logged_in();
return ($ili) ? ‘<txp:zem_contact to=“xxxxxxx” label=”“ form=“page-feedback” />’ : ‘’;

This has worked, but I’m not sure I copied all the right bits from your plugin… First of all, I’ve seen the three =‘s before, but I’m not exactly sure what that means (deep comparisons?)… so I’m just accepting the fact that its correct. (If you know the technical term for it, I’d love to study that more.)

Then, in the form, “page-feedback”, I use asy_wondertag to set default values in my form from <txp:rvm_privileged_user /> like:

<txp:asy_wondertag><txp:zem_contact_email label=”“ name=“email” required=“0” default=”<txp:rvm_privileged_user type=“email” />” /></txp:asy_wondertag>

So far this all works, but seems kludgy. If you have a moment, please let me know how this sounds and if there is a better way to do this.

Offline

#23 2008-02-06 09:01:08

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_privileged v0.4

Why don’t you simply do:

<txp:rvm_if_privileged>
  <txp:zem_contact to="xxxxxxx" label="" form="page-feedback" />
</txp:rvm_if_privileged>

Offline

#24 2008-02-06 17:35:23

typeshige
Member
From: USA
Registered: 2005-08-11
Posts: 151
Website

Re: rvm_privileged v0.4

I tried that, but when I do, my html source looks like this:

stuff before rvm_if_priviledged… <txp:zem_contact to=“xxxxxxx” label=”“ form=“page-feedback” />
stuff afterwards…

it’s spitting up the txp tag without processing it to the browser.

It sounds like I wasn’t clear, so I’ll try to explain again.. :) From my page there is plugin I wrote that handles the meat of my page. Towards the end of that plugin, it has a feedback form that I tried to wrap around rvm_if_priviledged. since it looks like you can’t embed a txp tag inside a txp tag inside a txp tag, I thought I’d keep the functionality of rvm_if_priviledged by reusing what i thought was the relevant parts directly in my plugin function and remove one tag from the loop. That has been the only way I’ve been able to get it to work so far, but I welcome suggestions to make it work like you mentioned.

ruud wrote:

Why don’t you simply do:

<txp:rvm_if_privileged>
  <txp:zem_contact to="xxxxxxx" label="" form="page-feedback" />
</txp:rvm_if_privileged>

Offline

Board footer

Powered by FluxBB