[wp-hackers] Re: Detect if a plugin is calling function

Peter Westwood peter.westwood at ftwr.co.uk
Mon Apr 30 18:05:32 GMT 2007


On 30 Apr 2007, at 18:44, David Coppit wrote:

> On Fri, 6 Apr 2007, David Coppit wrote:
>
>> On Fri, 6 Apr 2007, Alex Günsche wrote:
>>
>>> You could hook in before the other plugin, the add_action() and
>>> add_filter() hooks provide an optional parameter to define the  
>>> plugin
>>> pririty. Plugins which don't use this parameter have a default  
>>> value of
>>> 10. Yours could use 7 or something.
>>
>> So setting the priority for Category Access to something like 1000  
>> would
>> have it filter *after* the other plugins filter it.
>
> Hm... The problem still isn't solved. We wanted to be able to  
> detect when
> the categories or comments are being pulled for a plugin, rather than
> being rendered for the user. For example, Akismet comments are being
> modified by my plugin when they shouldn't be. Can anyone suggest a  
> way to
> detect whether a call to wp_list_categories is for user or not?  
> Should I
> deconstruct the stack?
>

Things that spring to mind as possible solutions are:

is_admin()
User Role

You need to identify when the template tags you are modifying are  
called and where you do/do not want to modifed the results.

Ideally if you are in an admin page then you probably don't want to  
limit the category access unless it is for a low level user.

westi
-- 
Peter Westwood <peter.westwood at ftwr.co.uk>
Blog: http://blog.ftwr.co.uk/
WordPress Plugins: http://blog.ftwr.co.uk/wordpress/





More information about the wp-hackers mailing list