The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#11
|
|||
|
|||
Alright, I looked at showgroups.php once more and tried to figure out what the vital parts of the query would be. I came up with this:
Code:
$showgroups = $db->query_read(" SELECT user.*, userfield.*, usertextfield.*, " . iif($vbulletin->options['avatarenabled'], 'avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight,') . " postparsed.pagetext_html, postparsed.hasimages, $hook_showgroups_complete LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid = user.userid) " . iif($vbulletin->options['avatarenabled'], "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)") . " "); HTML Code:
if ($this->post['avatarid']) { $this->post['avatarurl'] = $this->post['avatarpath']; } else { if ($this->post['hascustomavatar'] AND $this->registry->options['avatarenabled']) { if ($this->registry->options['usefileavatar']) { $this->post['avatarurl'] = $this->registry->options['avatarurl'] . '/avatar' . $this->post['userid'] . '_' . $this->post['avatarrevision'] . '.gif'; } else { $this->post['avatarurl'] = 'image.php?' . $this->registry->session->vars['sessionurl'] . 'u=' . $this->post['userid'] . '&dateline=' . $this->post['avatardateline']; } if ($this->post['avwidth'] AND $this->post['avheight']) { $this->post['avwidth'] = 'width="' . $this->post['avwidth'] . '"'; $this->post['avheight'] = 'height="' . $this->post['avheight'] . '"'; } else { $this->post['avwidth'] = ''; $this->post['avheight'] = ''; } } else { $this->post['avatarurl'] = ''; } } if ( // no avatar defined for this user empty($this->post['avatarurl']) OR // visitor doesn't want to see avatars ($this->registry->userinfo['userid'] > 0 AND !$this->registry->userinfo['showavatars']) OR // user has a custom avatar but no permission to display it (!$this->post['avatarid'] AND !($this->cache['perms'][$this->post['userid']]['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['canuseavatar']) AND !$this->post['adminavatar']) // ) { $show['avatar'] = false; } else { $show['avatar'] = true; } |
#12
|
||||
|
||||
Yes, that is much closer. I haven't actually read the code line for line, but it looks more like what I am used to seeing when an avatar is included.
|
#13
|
|||
|
|||
Seems I keep getting an SQL error, but I don't know where it's coming from.
This is the query_read (or something, I'm a novice with SQL; used this query part from showthread.php (changed $posts to $show['avatar'])): Code:
$show['avatar'] = $db->query_read(" SELECT user.*, userfield.*, usertextfield.*, " . iif($vbulletin->options['avatarenabled'], 'avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight,') . " $hook_query_fields LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = post.userid) LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = user.userid) LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid = user.userid) " . iif($vbulletin->options['avatarenabled'], "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)") . " $hook_query_joins "); |
#14
|
||||
|
||||
A query is not just the query_read part. You then just get left with pointers and have to get that data out of there by doing something like a fetch_array. *Then* you end up with variables you can do something with (you can see that in the showthread.php page).
|
#15
|
|||
|
|||
Okay, I see the part where it's being fetched (if I am right), which starts at:
PHP Code:
Also, after having this done, should I pretty much edit the showgroups.php page to include the defined $show['avatar'] from the class_postbit.php? And as a last thing: should the case be that I have to adjust the query accordingly, what would be the best way to know which table (or whatever it is?) should be selected/called/queried? |
#16
|
||||
|
||||
If you already have a query in the showgroups page that then goes through a while loop like we are talking about, most likely, you just want to combine the two queries into one query and do everything at once. Is that what you are doing right now?
|
#17
|
|||
|
|||
I'm not quite certain whether or not I understood it correctly. Is showgroups.php supposed to have a query related to that already (seeing how you have referred to 'two queries into one')?
And no, I haven't edited the showgroups.php itself yet. I wanted to be certain how I should go on about this before messing up everything. My idea (my last post) was to basically copy the $show['avatar'] bit and put it in showgroups.php as well, so it's defined (which I could then use as a variable in the showgroups template). The same goes for the query from class_postbit.php. Or am I understanding this completely wrong? |
#18
|
||||
|
||||
I assumed from your first post that you were going to be showing the avatars for the users in the groups on the showgroups page. If so, there is already a query to grab the users in each group, so you would then want to add the extra stuff to select to that query, I would think.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|