Trying to do an 'if,else' statement within a SQL query, so that the Karma Balance column will be sorted separately than the others, obviously it's not working yet, but if someone sees something simple to add, please shout it out.
I just don't think the "if ($ShowKarma)" portion is correct. I've set up the multiple sql's as you've suggested, but I'm thinking it will work if the correct "if" portion is written. I'll keep trying. Thank you!
I can keep getting it to sort only by Karma with this: ->OrderBy("kb.Balance", $SortOrder); instead of this: ->OrderBy("u.$UserField", $SortOrder); but that eliminates the functionality of the others.
@kirkpa31 said:
I just don't think the "if ($ShowKarma)" portion is correct. I've set up the multiple sql's as you've suggested, but I'm thinking it will work if the correct "if" portion is written. I'll keep trying. Thank you!
I can keep getting it to sort only by Karma with this: ->OrderBy("kb.Balance", $SortOrder); instead of this: ->OrderBy("u.$UserField", $SortOrder); but that eliminates the functionality of the others.
I uploaded a new MembersList Enhanced v3.0 with functionality for like this plugin, karma balance plugin, and thankful people plugin and sorting of those columns with options to include them in settings if desired.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Although the many days I spent modifying 2.0 to include things that now come standard in 3.0, you've taught me a lot about all of this and I couldn't be more grateful. Many apologies for the barrage of questions I had earlier, as this plugin is utterly perfect. You are the best @peregrine. As is this community.
Also, I see the mistakes I was making in the if-else statement and what you've done now makes perfect sense to me.
I added a column within my Members List Enhanced to show each user's Accepted Answer total from the Q&A plugin.
I used the QnACountAcceptance keyword that @x00 references in the Karma Bank plugin and just followed what you've laid out in the code @peregrine. It seems to work perfectly in tests, sorts well and updates instantly.
within /plugins/MembersListEnh/default.php add:
'Plugins.MembersListEnh.ShowAnswers',
within /plugins/MembersListEnh/views/memtable.php add in 4 separate respective areas:
case 'qnacountacceptance':
$UserField = 'QnACountAcceptance';
break;
having a problem, that it numbers all members, but includes all the spam bots that got caught in my filters as well, which looks odd when my 20th member is number 180 or so, and it's giving enough pages to fit all of those, when only the first couple are in use. any suggestions on what to do?
At the moment I'm busy, and I've written too many plugins and received too few donations to look at specific feature requests from people who haven't donated.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Comments
@peregrine is it possible to add additional fields of information, such as Karma, # of times Thanked, etc.?
ahh I found your reply here: http://vanillaforums.org/discussion/comment/171208/#Comment_171208
I'll give this a try. Thanks.
Quick Question:
Possible to allow all users to see members list 2.0 through config.php?
SOLVED:
Just edited the 'roles & permissions' within my dashboard. All good now. Didn't think to do something so simple right off the bat.
Attempt to sort the added KarmaBankBalance column
Trying to do an 'if,else' statement within a SQL query, so that the Karma Balance column will be sorted separately than the others, obviously it's not working yet, but if someone sees something simple to add, please shout it out.
->Select('*') ->From('User u') ->Join('KarmaBankBalance kb', 'u.UserID = kb.UserID') if ($ShowKarma) { ->OrderBy("kb.Balance", $SortOrder); } else { ->OrderBy("u.$UserField", $SortOrder); } ->Where('Deleted',false) ->Limit($Limit, $Offset) ->Get();
do the if else entirely outside the sql and call two different sql's
if ($ShowKarma)
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
I just don't think the "if ($ShowKarma)" portion is correct. I've set up the multiple sql's as you've suggested, but I'm thinking it will work if the correct "if" portion is written. I'll keep trying. Thank you!
I can keep getting it to sort only by Karma with this:
->OrderBy("kb.Balance", $SortOrder);
instead of this:->OrderBy("u.$UserField", $SortOrder);
but that eliminates the functionality of the others.I uploaded a new MembersList Enhanced v3.0 with functionality for like this plugin, karma balance plugin, and thankful people plugin and sorting of those columns with options to include them in settings if desired.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Although the many days I spent modifying 2.0 to include things that now come standard in 3.0, you've taught me a lot about all of this and I couldn't be more grateful. Many apologies for the barrage of questions I had earlier, as this plugin is utterly perfect. You are the best @peregrine. As is this community.
Also, I see the mistakes I was making in the if-else statement and what you've done now makes perfect sense to me.
great plugin. This is perfect.
To make the Karma and Thanks values clickable, sending you to the respective tab in the user's profile, just change:
if ($ShowThank) echo '<td>' . $User->ReceivedThankCount . '</td>'; if ($ShowKarma) echo '<td>' . $User->Balance . '</td>';
to
if ($ShowThank) { $Anchor = '/profile/receivedthanks/'. $User->UserID .'/'. $User->Name; echo '<td>' . Anchor($User->ReceivedThankCount,$Anchor) . '</td>'; } if ($ShowKarma) { $Anchor = '/profile/karmabank/'. $User->UserID .'/'. $User->Name; echo '<td>' . Anchor($User->Balance,$Anchor) . '</td>'; }
@kirkpa31
I didn't even think of to include that. nice addition.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
I put your mod into version 4.0 thx. nice addition.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Members List 4.0 isn't sortable b/c of a small change within memtable.php
lines 30-31:
$Arg = $MLUrl; $MColUrl = 'members/p1';
change to:
$Arg = $MLUrl; $MColUrl = 'plugin/MembersListEnh/views/memberlist/p1';
and
lines 171-172:
$MemNumRows, 'members' . '/{Page}' . '&sort=' . $SortOrder . '&ufield=' .$UserField
change to:
$MemNumRows, 'plugin/MembersListEnh/views/memberslistenh' . '/{Page}' . '&sort=' . $SortOrder . '&ufield=' .$UserField
thanks for the feedback -
1) Use the original 4.0 zip without your changes above.
2) remove any routes that deal with members under routing in your dashboard,
3) disable plugin.
4) enable plugin.
it is sortable as is, if you disable the plugin and re-enable it. if I failed to mention it, consider it mentioned.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Ah ok, that way is much easier.
I added a column within my Members List Enhanced to show each user's Accepted Answer total from the Q&A plugin.
I used the
QnACountAcceptance
keyword that @x00 references in the Karma Bank plugin and just followed what you've laid out in the code @peregrine. It seems to work perfectly in tests, sorts well and updates instantly.within /plugins/MembersListEnh/default.php add:
'Plugins.MembersListEnh.ShowAnswers',
within /plugins/MembersListEnh/views/memtable.php add in 4 separate respective areas:
$ShowAnswers = Gdn::Config("Plugins.MembersListEnh.ShowAnswers");
within /plugins/MembersListEnh/views/mle-settings.php add:
@kirkpa31
never mind I thought you missed something.
now, you are only missing kudos and voting I think .
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
having a problem, that it numbers all members, but includes all the spam bots that got caught in my filters as well, which looks odd when my 20th member is number 180 or so, and it's giving enough pages to fit all of those, when only the first couple are in use. any suggestions on what to do?
At the moment I'm busy, and I've written too many plugins and received too few donations to look at specific feature requests from people who haven't donated.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.