Recent Topics

1 Nov 28, 2006 01:12    

Not entirely plugin-related, but since a plugin is why I'm asking I'm asking here.

So to me creator_User and Author are the same thing. If this is true then if I want my plugin to only allow edits by the actual author of the article I would use either $params[creator_User]->ID or $params[Author]->ID and have only the person who originally created the post. If so then I wonder which is better to use. $params[Author]->assigned_user_ID is what? It's always blank when I print_r(params) so I'm guessing it gets filled with someone else's user ID when a post is assigned to that other user.

Seems to develop a plugin I want I've figured out a cheap way to stop anyone from editing everyone's posts, but I don't really understand the assigned_user_ID thing. Cheap in that the blogger will still see and be able to click the edit link, but the plugin will stop them from submitting the edit.

2 Nov 28, 2006 19:10

EdB, there's probably no event where both "Author" and "creator_User" are given in $params.
$params is different for most of the events. See the doc at http://doc.b2evolution.net/v-1-8/plugins/Plugin.html (for 1.8.x).

For debugging, you should use var_dump() instead of print_r() and in b2evo we have the very handy pre_dump() (which wraps html PRE tags around the output).

3 Nov 28, 2006 22:46

Thanks! I've found that if I watch your replies to everything sooner or later you'll say something that makes me go "wow I can do that?!?" and start the process all over again. For example being able to do "params[item]->id" to get something I obviously saw in a print_r for params.

var_dump() instead of vardump() - hooray! Dunno why but I thought vardump was in the code somewhere so I gave it a shot and it failed so I kept print_r ing everything. Good thing no one else uses the backend of the installation I'm doing this to because it saves me wrapping everything in "if is_logged_in and is me" :)

The doc page you linked to here convinced me to put "echo call to AdminWhateverFoo here" before each "Plugins->trigger_event( 'Admin" so's I would have an idea of where each little bit gets a chance to do it's thing.

Cool! I'm gonna var_dump() and see what there is to see.

4 Nov 28, 2006 23:14

As said.. pre_dump() is even cooler (better too read) than var_dump().


Form is loading...