Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




Direct database queries

UserPost

7:01 pm
June 18, 2010


bgold2j

Member

posts 6

1

Hello,

I was wondering if I could get a quick definition of what a "direct database query" is and why it makes certain plugins incompatibile with Role Scoper.


For instance what is it that the get-recent-comments plugin does that makes it not work with role scoper?


For plugin authors, what are the workarounds for these types of things?


Best

Brian


9:26 pm
June 18, 2010


Kevin

Admin

posts 2503

2

What I mean by "direct database query" is the use of low-level functions to retrieve posts or terms from the database, rather than WP_Query(), get_posts(), get_pages(), get_terms(), etc. To impose content-specific restrictions and roles, Role Scoper must append conditional clauses to your query. The problems that arise are:

a) if you use $wpdb->get_results(), Role Scoper can filter the query, but must guess at the nature and context of the query by looking at a lot of variables that are not necessarily fully descriptive or forward compatible, including the query itself.

b) if you use the mysql functions, Role Scoper cannot filter the query at all

8:22 pm
June 21, 2010


bgold2j

Member

posts 6

3

Hi Kevin,

Regarding "b", when Role Scoper cannot filter the query because it uses sql, does that mean that all of the results are discarded? Is it possible to do something like a passthrough?

The reason I ask is because there seem to be a lot of plugins out there that do direct database queries.


Thanks!

Brian

10:12 am
June 22, 2010


Kevin

Admin

posts 2503

4

If another plugin uses the mysql_query() function directly, Role Scoper will not modify the query or result set at all. So yes, it is a "passthrough" situation. The issue is not about data being discarded.


About the Agapetry forum

Currently Online:

16 Guests

Maximum Online: 150

Forums:

Groups: 2

Forums: 7

Topics: 1246

Posts: 5654

Members:

There are 1257 members

There are 1 guests


Kevin has made 2503 posts

Top Posters:

metal450 - 178

Ragnar - 108

YikYak - 70

whiteorb - 49

Daisy - 35

Administrator: Kevin | Moderators: Kevin