[wp-hackers] Plugin Questions

Bill Smith ml_wordpress at copperleaf.org
Thu May 12 14:45:06 GMT 2005

1) I'm working on a small plugin that requires an additional database 
table. Currently I'm using a query like

SHOW TABLES LIKE 'wp_mytable'

to check to see if my table already exists and create it if it doesn't. 
That seems expensive to me to do everytime my plugin is loaded so I was 
thinking about socking somthing away in wp_options that would let me 
know that I've already created it. I'm assuming that by the time an 
plugin code is executed that the options will have already been queried 
and cached.

What are others doing to accomplish this?

2) This may be more of a php question. There are occasions where I would 
like to perform a longer running task in the background (in terms of a 
minute or two, not hours). I realize that platform,webserver, php 
configuration can play a big role in what is possible. I've done some 
reading on using exec or system to perform background tasks. I've also 
thought of creating a php command line script that could be run from 
cron and check for work to be done. I was curious if anybody has some 
real world experience doing this with a plugin.

3) Last one... for the moment. :) In certain parts of my plugin, I'd 
like to restrict access to either the admin or users of a certain level. 
Is there a call that can tell me the users credentials so I can 
determine what they are allowed to do?


More information about the wp-hackers mailing list