MyBB-Plugins Forums
How to throw error. - Printable Version

+- MyBB-Plugins Forums (http://forums.mybb-plugins.com)
+-- Forum: Archived Forums (http://forums.mybb-plugins.com/Forum-Archived-Forums)
+--- Forum: MyBB 1.4.x (http://forums.mybb-plugins.com/Forum-MyBB-1-4-x)
+---- Forum: General (http://forums.mybb-plugins.com/Forum-General)
+---- Thread: How to throw error. (/Thread-How-to-throw-error)



How to throw error. - coreyman - 11-23-2009

So I would like for my addon to throw an error and stop installing for a condition... like this...

PHP Code:
function buynewpoints_activate(){
    require 
"../inc/adminfunctions_templates.php";
    global 
$db$mybb;
    
//check if newpoints is installed before we do anything of this.
    
if(! $db->table_exists("newpoints_settings")){
       
//throw error and stop execution.
       
echo"Newpoints is not installed";
        exit;
    } 

Usually when you install, it says it was successfully or unsuccessfully installed at the top of the page, the error I'm throwing I want to be displayed there.


RE: How to throw error. - Diogo Parrinha - 11-23-2009

I've replied to your PM, hope it fixes your problem


RE: How to throw error. - coreyman - 11-23-2009

Solved:

PHP Code:
flash_message('NewPoints is not activated.''error');
admin_redirect('index.php');