ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Issues of first party plugin "Filter By Author"

December 24, 2010 9:37am

Subscribe [4]
  • #1 / Dec 24, 2010 9:37am

    Laisvunas

    879 posts

    Hi,

    I found three issues concerning first party plugin Filter By Author:

    1) its function “constrain_by_author” which is called by the hook “edit_entries_search_where” does not use $EXT global, which it should in order to avoid incompatibility with other extensions which use the same hook (currently “Filter By Author” is incompatible with “Filter By Sticky” extension). That is, instead of

    function constrain_by_author()
        {
            global $IN;
            
            $member_id = $IN->GBL('author', 'GP');
            
            if ($member_id != '' && is_numeric($member_id))
            {
                return " AND exp_members.member_id = '$member_id'";
            }
        }

    it should be something like this

    function constrain_by_author() 
    {
       global $EXT, $IN;
        
        $where_clause = '';
    
        if ($EXT->last_call !== FALSE)
        {
          $where_clause = $EXT->last_call;
        }
        
         $member_id = $IN->GBL('author', 'GP');
            
         if ($member_id != '' && is_numeric($member_id))
         {
        $where_clause .= " AND exp_members.member_id = '$member_id' ";
         }
    
         return $where_clause;
    
    }

    2) “Filter By Author” extension outputs javascript in which there is this code (line 81)

    window.onload = function()
    {
    fbaLoad();
    fbaAddEvents();
    }

    Obviously, this should not be done because it can interfere with wndow.onload = somefunction in other add-on.

    3) “Filter By Author” extension outputs javascript in which there is function “fbaAddEvents” which attaches function “doLinkChange” to all anchor elements in the document. This is very inefficient way of doing things because the function “doLinkChange” should be attached only to pagination links which are contained in the “div” element having “class” attribute “crumblinks”.

  • #2 / Dec 27, 2010 3:30pm

    Brandon Jones

    5500 posts

    Thanks, Laisvunas. I’ll look into this further.

  • #3 / Jan 10, 2011 3:30pm

    StayInTouch

    16 posts

    Could these issues be what causes the problem I described in this thread:

    http://ellislab.com/forums/viewthread/174314/

    Thanks,

    Chad Boswell

  • #4 / Jan 11, 2011 3:04am

    John Henry Donovan

    12339 posts

    Chad,

    It could well be. What Laisvunas is talking about is not enough measures in place in the extension which don’t account for an incompatibility with other extensions which you have a lot of installed

    You could try updating the extension with the code above and see if that works for you

  • #5 / Jan 11, 2011 11:45am

    StayInTouch

    16 posts

    I applied the code that Laisvunas posted and it didn’t fix my particular problem, though I’m sure it will help with any potential conflicts with other extensions.

    However, as I was looking into the code I saw this on line 64:

    $sql = "SELECT member_id, screen_name from exp_members WHERE total_entries > 0 ORDER BY screen_name ASC";

    By removing the WHERE clause it seems to have fixed my issue:

    $sql = "SELECT member_id, screen_name from exp_members ORDER BY screen_name ASC";

    Now it shows all the members in the list and their name stays in the list even after deleting all of their entries. This is exactly what I was needing.

    Thanks,

    Chad Boswell

  • #6 / Jan 12, 2011 3:49am

    John Henry Donovan

    12339 posts

    Glad you are up and running again.Feel free to start a new thread if you have any more questions.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases