Log in

View Full Version : Success/Error Messages


ptmuldoon
11-21-2008, 09:28 PM
I'm trying to learn how to add a success message when a user submits data in a plugin/product I'm working on.

I discovered the print_stop_message() But I'm not sure if there is either:

1. A function to show a success message, or
2. If there is a way to create a customized stop message.

JamesAB
11-22-2008, 12:51 AM
This is what I have used for custom "no permission" error pages.

First, I created the phrase my_no_permisission_videos, with the phrase type Front-End Error Messages.

Then I've used this for cusom error pages:

eval(standard_error(fetch_error('my_no_permisissio n_videos')));

Good luck,
James

Dismounted
11-22-2008, 08:02 AM
You can use this to display success messages (with redirect).
$vbulletin->url = 'myfile.php';
eval(print_standard_redirect('redirect_myphrase')) ;

ptmuldoon
11-22-2008, 03:36 PM
Well, I really trying to keep all the code in one file. And really don't want to be redirecting for a success or failure message.

I just want to show a custom message if the the form was submitted sucessfully, or if not, the reason the form failed. This is was I have now, but unsure if it can be customized.

define('CP_REDIRECT', "multiuser.php?do=edit&id=".$id);
print_stop_message('deleted_notice_successfully'); //How to customize stop message? Currently from notice.php file.



JamesAB

I'll try and see if I can understand what you mentioned. Not sure yet on how to add custom vbphrases.

Dismounted
11-23-2008, 02:54 AM
print_stop_message() is used for Admin/Mod CP messages - and not for geenral messages to the user. The code I posted above will do want you want.

ptmuldoon
11-23-2008, 01:44 PM
print_stop_message() is used for Admin/Mod CP messages - and not for geenral messages to the user. The code I posted above will do want you want.

Right, I am creating a backend Admin product/Mod. So should I be able to create a custom stop message for the new mod I'm working on?

Dismounted
11-24-2008, 04:25 AM
Yes, if you are creating an Admin/Moderator message, use print_stop_message().

ptmuldoon
11-24-2008, 02:26 PM
Thanks, but thats where I'm getting stuck. How do you create that custom stop message such as:
print_stop_message('My Custom Message');

Dismounted
11-25-2008, 05:12 AM
Have a look at the vBulletin API:
http://members.vbulletin.com/api

ptmuldoon
11-25-2008, 05:17 PM
Thats perfect. From there, I should be able to learn more on how the different classes and functions work.