PDA

View Full Version : pring_delete_confirmation help


ptmuldoon
12-02-2008, 04:22 PM
I'm trying to use the print_delete_confirmation function, but can't seem to get it work.

Per the vbulletin API, I've learned that it uses 8 inputs as such:

Prints a dialog box asking if the user is sure they want to delete the specified item from the database
void print_delete_confirmation (string $table, mixed $itemid, string $phpscript, string $do, [string $itemname = ''], [mixed $hiddenfields = 0], [string $extra = ''], [string $titlename = 'title'])

* string $table: Name of table from which item will be deleted
* mixed $itemid: ID of item to be deleted
* string $phpscript: PHP script to which the form will submit
* string $do: 'do' action for target script
* string $itemname: Word describing item to be deleted - eg: 'forum' or 'user' or 'post' etc.
* mixed $hiddenfields: If not empty, an array containing name=>value pairs to be used as hidden input fields
* string $extra: Extra text to be printed in the dialog box
* string $titlename: Name of 'title' field in the table in the database


Based on the above, I've created the following:
print_delete_confirmation('table', $variable, 'phpscript', 'dorequest', 0, '', 'Delete Comment', 'column2' );

My Table includes both an ID column and the column2 column. Yet attempts to use the function keep giving an sql error. And I noticed the attempted query is always something like "SELECT tableid, column2"

I assume that the 'id' is automatically added by the function. But it appends it to table like it does, I don't know.

Does anyone have any ideas or can lend any help or advice?

Dismounted
12-03-2008, 02:27 AM
In vBulletin the primary ID field of a table is usually the table name with "id" tacked on the end (see post, thread, etc.). This is why it automatically adds the ending onto the field.

ptmuldoon
12-04-2008, 01:09 PM
Thanks for the help. With your input and a look at some of the other vbulletin tables, I got that figured out.

But I can't seem to figure out how to add a custom message to the confirmation box? I just get a yes and no option. I thought the string $extra should show the message?

Dismounted
12-05-2008, 04:46 AM
Have a look in the actual function file to see what happens - it would probably be better than me explaining it. :p