Skip to content

Commit

Permalink
Merge pull request #27 from Sama34/develop
Browse files Browse the repository at this point in the history
OUGC Feedback 1.8.22
  • Loading branch information
Sama34 committed Jan 21, 2020
2 parents a9628ce + 91ecf5e commit f625477
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[![Omar G.](http://omarg.me/cache/images/logo.png "Omar G. MyBB Page")](http://omarg.me/page?mybb "Omar G. MyBB Page")
[![OUGC Network](https://omargc.me/cache/images/logo.png "OUGC Network")](https://ougc.network/landing?mybb "OUGC Network")

## OUGC Feedback
Adds a powerful feedback system to your forum.

***

### Support
Please visit [Omar G.](https://omarg.me/thread?public/plugins/mybb-ougc-feedback "Visit Omar.G") for more information about this project.
Please visit [OUGC Network](https://ougc.network/?landing=mybb "Visit OUGC Network") for more information about this project.

### Thank You!
Remember this is a free release developed on free time, either for personal use or as custom requests.
Expand Down
2 changes: 2 additions & 0 deletions Upload/inc/languages/english/admin/ougc_feedback.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
$l['setting_ougc_feedback_showin_profile_desc'] = 'Show feedback status in profiles.';
$l['setting_ougc_feedback_showin_postbit'] = 'Show In Posts';
$l['setting_ougc_feedback_showin_postbit_desc'] = 'Show feedback status in posts.';
$l['setting_ougc_feedback_showin_forums'] = 'Show In Forums';
$l['setting_ougc_feedback_showin_forums_desc'] = 'Show feedback user information within posts.';
$l['setting_ougc_feedback_postbit_hide_button'] = 'Hide Post-bit Button';
$l['setting_ougc_feedback_postbit_hide_button_desc'] = 'Turn this on to hide the post-bit feedback button if not allowed to use it. Save one query turning this off.';
$l['setting_ougc_feedback_profile_hide_add'] = 'Hide Profile Add Link';
Expand Down
43 changes: 37 additions & 6 deletions Upload/inc/plugins/ougc_feedback.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ function _info()
return array(
'name' => 'OUGC Feedback',
'description' => $lang->ougc_feedback_desc,
'website' => 'https://omarg.me/thread?public/plugins/mybb-ougc-feedback',
'website' => 'https://ougc.network',
'author' => 'Omar G.',
'authorsite' => 'https://omarg.me',
'version' => '1.8.19',
'versioncode' => 1819,
'authorsite' => 'https://ougc.network',
'version' => '1.8.22',
'versioncode' => 1822,
'compatibility' => '18*',
'codename' => 'ougc_feedback',
'pl' => array(
Expand Down Expand Up @@ -153,6 +153,12 @@ function _activate()
'optionscode' => 'yesno',
'value' => 1
),
'showin_forums' => array(
'title' => $lang->setting_ougc_feedback_showin_forums,
'description' => $lang->setting_ougc_feedback_showin_forums_desc,
'optionscode' => 'forumselect',
'value' => -1
),
'postbit_hide_button' => array(
'title' => $lang->setting_ougc_feedback_postbit_hide_button,
'description' => $lang->setting_ougc_feedback_postbit_hide_button_desc,
Expand Down Expand Up @@ -531,6 +537,21 @@ function _activate()
if(!$db->field_exists($name, $table))
{
$db->add_column($table, $name, $definition);

// Set default group permissions
if($table == 'usergroups')
{
if(in_array($name, array('ougc_feedback_mod_candelete')))
{
$db->update_query('usergroups', array($name => 1), "gid='4'"); // Administrators
}

if(in_array($name, array('ougc_feedback_ismod', 'ougc_feedback_mod_canedit', 'ougc_feedback_mod_canremove')))
{
$db->update_query('usergroups', array($name => 1), "gid='4'"); // Administrators
$db->update_query('usergroups', array($name => 1), "gid='3'"); // Super moderators
}
}
}
else
{
Expand All @@ -543,6 +564,10 @@ function _activate()

/*~*~* RUN UPDATES END *~*~*/

$cache->update_usergroups();

$cache->update_forums();

$plugins['feedback'] = self::$plugin_info['versioncode'];
$cache->update('ougc_plugins', $plugins);
}
Expand Down Expand Up @@ -733,7 +758,7 @@ function get_db_fields()
'ougc_feedback_cangive' => "smallint NOT NULL DEFAULT '1'",
'ougc_feedback_canreceive' => "smallint NOT NULL DEFAULT '1'",
'ougc_feedback_canedit' => "smallint NOT NULL DEFAULT '1'",
'ougc_feedback_canremove' => "smallint NOT NULL DEFAULT '0'",
'ougc_feedback_canremove' => "smallint NOT NULL DEFAULT '1'",
//'ougc_feedback_value' => "int NOT NULL DEFAULT '1'",
'ougc_feedback_maxperday' => "int NOT NULL DEFAULT '5'",
'ougc_feedback_ismod' => "smallint NOT NULL DEFAULT '0'",
Expand All @@ -758,7 +783,7 @@ function get_db_fields()
'ougc_feedback_cangive' => "tinyint(1) NOT NULL DEFAULT '1'",
'ougc_feedback_canreceive' => "tinyint(1) NOT NULL DEFAULT '1'",
'ougc_feedback_canedit' => "tinyint(1) NOT NULL DEFAULT '1'",
'ougc_feedback_canremove' => "tinyint(1) NOT NULL DEFAULT '0'",
'ougc_feedback_canremove' => "tinyint(1) NOT NULL DEFAULT '1'",
//'ougc_feedback_value' => "int UNSIGNED NOT NULL DEFAULT '1'",
'ougc_feedback_maxperday' => "int UNSIGNED NOT NULL DEFAULT '5'",
'ougc_feedback_ismod' => "tinyint(1) NOT NULL DEFAULT '0'",
Expand Down Expand Up @@ -1323,6 +1348,12 @@ function hook_postbit(&$post)
self::load_language();

$post['ougc_feedback'] = $post['ougc_feedback_button'] = '';

if(!empty($post['fid']) && (!$mybb->settings['ougc_feedback_showin_forums'] || ($mybb->settings['ougc_feedback_showin_forums'] != -1 && !in_array($post['fid'], array_map('intval', explode(',', $mybb->settings['ougc_feedback_showin_forums']))))))
{
return;
}

if($mybb->settings['ougc_feedback_showin_postbit'])
{
static $query_cache;
Expand Down

0 comments on commit f625477

Please sign in to comment.