[MyAAC][Plugin] Most powerful guilds (TFS 0.3/4 and 1.0)

Discussion in 'Website Applications' started by MyAAC, Oct 11, 2017.

  1. MyAAC

    MyAAC Member

    Joined:
    May 4, 2017
    Messages:
    96
    Likes Received:
    41
    Best Answers:
    8
    This is most powerful guilds plugin for MyAAC. It displays guilds that have most unjustified kills.

    Requirements: Any version of MyAAC.

    Installation:

    Go to Admin Panel, select 'Plugins', and then select powerful-guilds.zip and click upload. That's all!

    In config.local.php, optionally add:
    Code (Text):
    1.  
    2. $config['powerful_guilds'] = array(
    3.    'refresh_interval' => 10 * 60, // cache query for 10 minutes (in seconds)
    4.    'amount' => 5, // how many powerful guilds to show
    5.    'page' => 'news' // on what pages most powerful guilds box should appear, for example 'news', or 'guilds' (blank makes it visible on every page)
    6. );
    7.  
    Screenshot:
    Bildschirmfoto 2017-10-11 um 16.10.51.png
     

    Attached Files:

  2. cs007

    cs007 Member

    Joined:
    Dec 2, 2010
    Messages:
    56
    Likes Received:
    1
    Best Answers:
    0
    Hey man, you can help me?
    PHP:
    1. Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'database_ot.g.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by in /var/www/html/system/libs/pot/OTS_Base_DB.php:101 Stack trace: #0 /var/www/html/system/libs/pot/OTS_Base_DB.php(101): PDO->query('SELECT `g`.`id`...') #1 /var/www/html/plugins/powerful-guilds/powerful-guilds.php(35): OTS_Base_DB->query('SELECT `g`.`id`...') #2 /var/www/html/plugins/powerful-guilds/powerful-guilds.php(70): mostPowerfulGuildsDatabase() #3 /var/www/html/plugins/powerful-guilds/powerful-guilds.php(96): mostPowerfulGuildsList() #4 /var/www/html/system/hooks.php(47): require('/var/www/html/p...') #5 /var/www/html/system/hooks.php(74): Hook->execute(Array) #6 /var/www/html/index.php(384): Hooks->trigger(2) #7 {main} thrown in /var/www/html/system/libs/pot/OTS_Base_DB.php on line 101
     
  3. MyAAC

    MyAAC Member

    Joined:
    May 4, 2017
    Messages:
    96
    Likes Received:
    41
    Best Answers:
    8
    This seems to be a new behavior introduced in MySQL version 5.7, as stated here: MySQL :: MySQL 5.7 Reference Manual :: 5.1.10 Server SQL Modes

    To get around this error, we can change sql_mode to behave like in older MySQL versions. The real solution would be to rewrite the query, but for that I don't have time now.

    So, just edit your plugins/powerful-guilds/powerful-guilds.php and replace first line:
    Code (PHP):
    1. <?php
    with:
    Code (PHP):
    1. <?php
    2. $query = $db->query('SELECT @@sql_mode as `mode`')->fetch();
    3. $mode = str_replace('ONLY_FULL_GROUP_BY', '', $query['mode']);
    4.  
    5. $db->query('set session sql_mode = ' . $db->quote($mode));
    And it should work :)
     
  4. cs007

    cs007 Member

    Joined:
    Dec 2, 2010
    Messages:
    56
    Likes Received:
    1
    Best Answers:
    0
    Mine was already this way.
    3xzwq - Ghostbin
     
  5. MyAAC

    MyAAC Member

    Joined:
    May 4, 2017
    Messages:
    96
    Likes Received:
    41
    Best Answers:
    8
    Which part of my post didn't you understand?

    Replace the first line, so it looks like this:
    Code (PHP):
    1.  
    2. <?php
    3. $query = $db->query('SELECT @@sql_mode as `mode`')->fetch();
    4. $mode = str_replace('ONLY_FULL_GROUP_BY', '', $query['mode']);
    5.  
    6. $db->query('set session sql_mode = ' . $db->quote($mode));
    7.  
    8. /**
    9.  * Powerful guilds for MyAAC
    10.  *
    11.  * @name      powerful-guilds
    12.  * @author    Slawkens <[email protected]>
    13.  * @version   1.1
    14.  */
    15.  
     
    slawkens likes this.
  6. cs007

    cs007 Member

    Joined:
    Dec 2, 2010
    Messages:
    56
    Likes Received:
    1
    Best Answers:
    0
    Thank you very much, my friend.
     
  7. DukeeH

    DukeeH Active Member

    Joined:
    Dec 6, 2010
    Messages:
    525
    Likes Received:
    36
    Best Answers:
    3
    Great, thanks!
     

Share This Page

Loading...