[wikka-community] Conditional tags for Wikka actions

Dario Taraborelli dartar
Thu Jul 23 17:06:29 GMT 2009


Dear all,

I have just come across a fantastic WordPress extension called Widget  
Logic [1] that I would like to adapt for a future Wikka release.

If you are familiar with WordPress, you probably know that widgets are  
template components that control the display of various kinds of  
(static or dynamic) content in the sidebar of the blog. Even if not  
necessarily template-oriented, "actions" are to some extent the Wikka  
equivalent of WordPress's widgets.

Widget Logic introduces a new field for each widget based on WordPress  
conditional tags [2] that makes the output of the widget depend on the  
the evaluation of this field. Any kind of PHP code that can be  
evaluated as TRUE or FALSE is allowed in these fields, including WP  
built-in tags such as:

	is_admin()
	is_front_page()
	comments_open()
	is_category('Stinky Cheeses')

and so on and so on. You can do fancy things like:

	(date('Y-m-H')>='2009-08-01') || current_user_can('level_10')

which displays the content to admins or to regular users only after  
August 1, 2009 (I am using this to preview the content of an ad from a  
sponsor that will run starting in August). You can dispatch different  
content as a function of IP address, referrer or locale and so on and  
so on.

Implementing this in Wikka seems quite straightforward:

- actions can be easily extended to allow an extra parameter  
containing conditional tags of this kind
- Wikka already features a large number of conditional tags via its API.

Applying the Widget Logic idea would allow users to control who can  
access the specific output generated by an action and under which  
conditions. Pushing things even further, admins could configure a  
default condition applying to all instances of an action (e.g. control  
the use of the feedback form or file upload action). This will be  
possible as soon as the new plugin-ready architecture (a project  
currently led by Brian) will be available.

Feedback and comments are very welcome

Dario


[1] http://wordpress.org/extend/plugins/widget-logic/
[2] http://codex.wordpress.org/Conditional_Tags
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.wikkawiki.org/pipermail/community_wikkawiki.org/attachments/20090723/765fa917/attachment.html>



More information about the community mailing list