Memberslist.php Hook Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sarahk
    Senior Member
    • Jun 2004
    • 138

    Memberslist.php Hook Problem

    I've added a couple of plugins to extend the functionality of memberlist.php. The plugin tool means I can do this with no template or code changes. Awesome, thankyou.

    Here's something I've had to workaround...

    Around line 455 I have
    PHP Code:
        $hook_query_joins $hook_query_where '';
        (
    $hook vBulletinHook::fetch_hook('memberlist_query_userscount')) ? eval($hook) : false;

        
    $userscount $db->query_first_slave("
            SELECT COUNT(*) AS users
            FROM " 
    TABLE_PREFIX "user AS user
            LEFT JOIN " 
    TABLE_PREFIX "userfield AS userfield USING (userid)
            
    $hook_query_joins
            WHERE 
    $condition
                AND    user.usergroupid IN (
    $ids)
                
    $hook_query_where
        "
    ); 
    and I'm able to set values into $hook_query_where.
    Scroll down the page to where we fetch the actual list of members and there is
    PHP Code:
        $hook_query_fields $hook_query_joins '';
        (
    $hook vBulletinHook::fetch_hook('memberlist_fetch')) ? eval($hook) : false;

        
    $users $db->query_read_slave("
            SELECT user.*,usertextfield.*,userfield.*, user.userid, options,
                IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid
            
    $repcondition
            " 
    iif($show['avatarcol'], ',avatar.avatarpath,NOT ISNULL(customavatar.userid) AS hascustomavatar,customavatar.dateline AS avatardateline, customavatar.width AS avwidth, customavatar.height AS avheight') ."
            " 
    iif($show['profilepiccol'], ',customprofilepic.userid AS profilepic, customprofilepic.dateline AS profilepicdateline, customprofilepic.width AS ppwidth, customprofilepic.height AS ppheight') . "
            
    $lastvisitcond
            " 
    iif($usergroupid", NOT ISNULL(usergroupleader.usergroupid) AS isleader") . "
            
    $hook_query_fields
            FROM " 
    TABLE_PREFIX "user AS user
            LEFT JOIN " 
    TABLE_PREFIX "usertextfield AS usertextfield ON(usertextfield.userid=user.userid)
            LEFT JOIN " 
    TABLE_PREFIX "userfield AS userfield ON(userfield.userid=user.userid)
            " 
    iif($show['reputationcol'], "LEFT JOIN " TABLE_PREFIX "reputationlevel AS reputationlevel ON(user.reputationlevelid=reputationlevel.reputationlevelid) ") . "
            " 
    iif($show['avatarcol'], "LEFT JOIN " TABLE_PREFIX "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " TABLE_PREFIX "customavatar AS customavatar ON(customavatar.userid = user.userid)") . "
            " 
    iif($show['profilepiccol'], "LEFT JOIN " TABLE_PREFIX "customprofilepic AS customprofilepic ON (user.userid = customprofilepic.userid) ") . "
            " 
    iif($usergroupid"LEFT JOIN " TABLE_PREFIX "usergroupleader AS usergroupleader ON (user.userid = usergroupleader.userid AND usergroupleader.usergroupid=$usergroupid) ") . "
            
    $hook_query_joins
            WHERE 
    $condition
                AND user.usergroupid IN (
    $ids)
            ORDER BY 
    $sqlsort $sortorder $secondarysortsql
            LIMIT " 
    . ($limitlower 1) . ", $perpage
        "
    ); 
    My variable isn't being used and I can't set it. I have to actually manipulate $condition.

    Now that isn't a problem but it would be great if the code allowed variables to be manipulated consistently.

    While I'm here I'm also not sure how to extend the code that builds the page navigation. No clear allowance for a hook. Currently I add the value to $sortaddon in memberlist_fetch.

    PHP Code:
    $pagenav construct_page_nav
    thanks

    Sarah
    Last edited by sarahk; Mon 12 Feb '07, 6:40pm.
    Simple SEO
  • Floris
    Senior Member
    • Dec 2001
    • 37767

    #2
    We can't support custom code, please ask on vBulletin.org.

    Comment

    • sarahk
      Senior Member
      • Jun 2004
      • 138

      #3
      I appreciate that. The custom code is fine. What I am querying is the fact that there is a hook variable for one query but not for the second.

      In memberlist it does two things
      1. counts the number of members that will be found
      2. gets the actual list


      In the first there is a clear hook variable to use.
      In the second there isn't.

      While I can work around that I figured you'd want to know so that the code will be more consistent.

      The final part was that given you are provided with hooks to allow the conditions and joins to be appended it is therefore necessary to add to the page navigation. I was asking for clarification on which variable to use - given that there was no clearly labelled hook variable.

      If the plugin interface is not supported that's fine, I just needed to clarify that it was the interface that I am talking about, and not the code I've written.
      Simple SEO

      Comment

      • Mike Sullivan
        Former vBulletin Developer
        • Apr 2000
        • 13327
        • 3.6.x

        #4
        You're right. That was inconsistent. I've added the ability to modify the where clause to the actual data fetching query for 3.6.5.

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...