If the gender data is hanging around in the user object at time of posting wouldn't it be more efficient to make another field for gender in the posts table and save it with the post?
The efficient solution is to cache the users, and join them pragmatically which is what JoinUsers does. Only it doesn't carry the gender across even though all the values are returned from the query.
look in dashboard/models/class.usermodel.php -> JoinUser
This isn't the idea solution but it is simple for you, the plugin version would be more complex becuase there isn't a hook where you can add additional values in the mix, maybe somethign you can mention on github.
If the comment model Get added the the options, then you could use BeforeGet to to set $Options['Join'] retrieve what you want and go it by hooks, unfortunately the is not the case right now.
The efficient solution is to cache the users, and join them pragmatically which is what JoinUsers does. Only it doesn't carry the gender across even though all the values are returned from the query.
look in dashboard/models/class.usermodel.php -> JoinUser
set the line to
<pre>
$Join = GetValue('Join', $Options, array('Name', 'Email', 'Photo', 'Gender'));
</pre>
>
Thx xOO - Figured you would find an efficient solution for an inefficient one. I tested your change above and added:
This isn't the idea solution but it is simple for you, the plugin version would be more complex becuase there isn't a hook where you can add additional values in the mix, maybe somethign you can mention on github.
If the comment model Get added the the options, then you could use BeforeGet to to set $Options['Join'] retrieve what you want and go it by hooks, unfortunately the is not the case right now.>
@sarowlwp - maybe you can add what he said... hint hint. Since you got your solution.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Even though Gdn::UserModel()->JoinUsers() doesn't join the Gender into the result table you don't need to.
If you make a call to Gdn::UserModel()->GetID() after join users has been called and that user was already joined then the user will be cached in Gdn::UserModel() and it won't hit the database again.
Answers
haha ,thx,i will take it
A thought.
If the gender data is hanging around in the user object at time of posting wouldn't it be more efficient to make another field for gender in the posts table and save it with the post?
The efficient solution is to cache the users, and join them pragmatically which is what JoinUsers does. Only it doesn't carry the gender across even though all the values are returned from the query.
look in dashboard/models/class.usermodel.php -> JoinUser
set the line to
$Join = GetValue('Join', $Options, array('Name', 'Email', 'Photo', 'Gender'));
This isn't the idea solution but it is simple for you, the plugin version would be more complex becuase there isn't a hook where you can add additional values in the mix, maybe somethign you can mention on github.
grep is your friend.
If the comment model Get added the the options, then you could use
BeforeGet
to to set$Options['Join']
retrieve what you want and go it by hooks, unfortunately the is not the case right now.grep is your friend.
The efficient solution is to cache the users, and join them pragmatically which is what JoinUsers does. Only it doesn't carry the gender across even though all the values are returned from the query.
>
Thx xOO - Figured you would find an efficient solution for an inefficient one. I tested your change above and added:
and it worked my fine.
This isn't the idea solution but it is simple for you, the plugin version would be more complex becuase there isn't a hook where you can add additional values in the mix, maybe somethign you can mention on github.
If the comment model Get added the the options, then you could use BeforeGet to to set $Options['Join'] retrieve what you want and go it by hooks, unfortunately the is not the case right now.>
@sarowlwp - maybe you can add what he said... hint hint. Since you got your solution.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Does beg the question, this would be a nice feature for the dashboard ?
There was an error rendering this rich post.
Even though Gdn::UserModel()->JoinUsers() doesn't join the Gender into the result table you don't need to.
If you make a call to Gdn::UserModel()->GetID() after join users has been called and that user was already joined then the user will be cached in Gdn::UserModel() and it won't hit the database again.
good point it is already cached.
Gdn::UserModel()->GetID($Author)->Gender
grep is your friend.
should be
Gdn::UserModel()->GetID($Author->UserID)->Gender
grep is your friend.