Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. <?php
  2. //Disallow direct Initialization for extra security.
  3.  
  4. if(!defined("IN_MYBB"))
  5. {
  6. die("You Cannot Access This File Directly. Please Make Sure IN_MYBB Is Defined.");
  7. }
  8.  
  9. // Hooks
  10. $plugins->add_hook('global_start', 'myfirstplugin_global_start');
  11.  
  12. // Information
  13. function myfirstplugin_info()
  14. {
  15. return array(
  16. "name" => "My First Plugin",
  17. "description"=> "This is my first plugin! :)",
  18. "website" => "http://mywebsite.com",
  19. "author" => "Vernier",
  20. "authorsite" => "http://mywebsite.com",
  21. "version" => "1.0",
  22. "guid" => "",
  23. "compatibility" => "*"
  24. );
  25. }
  26.  
  27. // Activate
  28. function myfirstplugin_activate() {
  29. global $db;
  30.  
  31. $myfirstplugin_group = array(
  32. 'gid' => 'NULL',
  33. 'name' => 'myfirstplugin',
  34. 'title' => 'My First Plugin',
  35. 'description' => 'Settings For My First Plugin',
  36. 'disporder' => "1",
  37. 'isdefault' => "0",
  38. );
  39. $db->insert_query('settinggroups', $myfirstplugin_group);
  40. $gid = $db->insert_id();
  41.  
  42. $myfirstplugin_setting = array(
  43. 'sid' => 'NULL',
  44. 'name' => 'myfirstplugin_enable',
  45. 'title' => 'Do you want to enable My First Plugin?',
  46. 'description' => 'If you set this option to yes, this plugin be active on your board.',
  47. 'optionscode' => 'yesno',
  48. 'value' => '1',
  49. 'disporder' => 1,
  50. 'gid' => intval($gid),
  51. );
  52. $db->insert_query('settings', $myfirstplugin_setting);
  53. rebuild_settings();
  54. }
  55.  
  56. // Deactivate
  57. function myfirstplugin_deactivate()
  58. {
  59. global $db;
  60. $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN ('myfirstplugin_enable')");
  61. $db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='myfirstplugin'");
  62. rebuild_settings();
  63. }
  64.  
  65. function myfirstplugin_global_start(){
  66. global $mybb;
  67.  
  68. if ($mybb->settings['myfirstplugin_enable'] == 1){
  69. echo "Dies wird IMMER angezeigt xD \n";
  70.  
  71.  
  72. if($mybb->usergroup['cancp'] == 1){
  73. echo "Dies wird IMMER angezeigt xD";
  74. }
  75. }
  76. }
  77. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement