Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Mod Requests => Topic started by: minimono on March 27, 2018, 04:33:19 AM

Title: Based membergroups by thanks_count from mod Say Thanks
Post by: minimono on March 27, 2018, 04:33:19 AM
I'm SMF 2.0.15
How to based membergroups by thanks_count from mod Say Thanks (https://www.simplemachines.org/community/index.php?topic=527032.msg3737095#msg3737095).
same mod Karma based membergroups. (https://custom.simplemachines.org/mods/index.php?mod=1935)

Thank You. :)
Title: Re: Based membergroups by thanks_count from mod Say Thanks
Post by: Steve on March 27, 2018, 01:57:59 PM
Mod questions for existing mods need to be asked in the support threads for them.
Title: Re: Based membergroups by thanks_count from mod Say Thanks
Post by: Kindred on March 27, 2018, 03:51:21 PM
he wants a new mod that adds functionality based on another mod...
Title: Re: Based membergroups by thanks_count from mod Say Thanks
Post by: dougiefresh on March 27, 2018, 10:29:43 PM
I can write something up for ya....  The changes look easy enough.....  It may be tomorrow when I do, though.  (It's almost 10pm here...  and almost bedtime for me  O:) )
Title: Re: Based membergroups by thanks_count from mod Say Thanks
Post by: minimono on March 27, 2018, 11:28:57 PM
Mod is no longer supported so you probably won't receive an answer  :(

I can write something up for ya....  The changes look easy enough.....  It may be tomorrow when I do, though.  (It's almost 10pm here...  and almost bedtime for me  O:) )
;D
Title: Re: Based membergroups by thanks_count from mod Say Thanks
Post by: dougiefresh on March 28, 2018, 10:48:58 AM
Try this: Thanks Received Membergroups (http://www.xptsp.com/board/index.php?topic=1639.0)
Title: Re: Based membergroups by thanks_count from mod Say Thanks
Post by: minimono on March 29, 2018, 06:46:06 AM
I'm test this mod.
mod not refresh membergroups from thanks_count score up/down.
Membergroups refresh when modify number of Thanks Received in ohter group(group not use)
same admin to chang it all time.
Title: Re: Based membergroups by thanks_count from mod Say Thanks
Post by: minimono on April 01, 2018, 01:53:11 AM
Thank you very much for your help.
Try this: Thanks Received Membergroups (http://www.xptsp.com/board/index.php?topic=1639.0)
Title: Re: Based membergroups by thanks_count from mod Say Thanks
Post by: dougiefresh on April 16, 2018, 10:29:27 PM
I'm test this mod.
mod not refresh membergroups from thanks_count score up/down.
Membergroups refresh when modify number of Thanks Received in ohter group(group not use)
same admin to chang it all time.
Sorry about the delay in responding to you.  I'm trying to resolve the issues you brought up.....

I've got the mod changing the id_post_group field upon install and uninstall.  I'm going to look into why the updateStats function doesn't fire when giving/retracting thanks....

UPDATE:  I put the parameters in the wrong order....  Silly me....  O:)
Title: Re: Based membergroups by thanks_count from mod Say Thanks
Post by: dougiefresh on April 16, 2018, 10:53:12 PM
Uploaded v1.0.1 - April 16th, 2018
o Fixed code in SayThanks.php to update postgroups when giving/withdrawing thanks.
o Added entire case for updateStats function in order to restore original postgroups.
o Added a post-install redirect to update the postgroups to reflect thanks counts.
o Added an uninstall script to return the postgroups to reflect post counts.



@minimono:  Try this, please: Thanks Received Membergroups v1.0.1 (http://www.xptsp.com/board/index.php?topic=1639.0)
Title: Re: Based membergroups by thanks_count from mod Say Thanks
Post by: minimono on May 09, 2018, 09:38:51 AM
Error Log  Thanks Received Membergroups v1.0.1

when giving/withdrawing thanks.
Code: [Select]
> https://xxx.com/index.php?action=thank;msg=1188;member=53;topic=306;ajax=1;xml=1
> 2: in_array() expects parameter 2 to be array, string given
> File: D:/Inetpub/vhosts/xxx.com/httpdocs/Sources/Subs.php
  Line: 376
Line: 376
Code: [Select]
374: case 'postgroups':
375: // Parameter two is the updated columns: we should check to see if we base groups off any of these.
==>376: if ($parameter2 !== null && !in_array('thanks_count', $parameter2))
377: return;
378:
379: if (($postgroups = cache_get_data('updateStats:postgroups', 360)) == null)
380: {
381: // Fetch the postgroups!
382: $request = $smcFunc['db_query']('', '
383: SELECT id_group, min_posts
384: FROM {db_prefix}membergroups
385: WHERE min_posts != {int:min_posts}',
386: array(
387: 'min_posts' => -1,
388: )
389: );
390: $postgroups = array();
391: while ($row = $smcFunc['db_fetch_assoc']($request))
392: $postgroups[$row['id_group']] = $row['min_posts'];
393: $smcFunc['db_free_result']($request);
+
+

and when edit Membergroups
Code: [Select]
> https://xxx.com/index.php?action=admin;area=membergroups;sa=edit;group=16
> 8: Only variables should be passed by reference
> file D:/Inetpub/vhosts/xxx.com/httpdocs/Sources/Subs.php
   Line: 419
Line: 419
Code: [Select]
414: // A big fat CASE WHEN... END is faster than a zillion UPDATE's ;).
415: $smcFunc['db_query']('', '
416: UPDATE {db_prefix}members AS mem
417: LEFT JOIN {db_prefix}messages_thanks_stats AS mts ON (mts.id_member = mem.id_member)
418: SET mem.id_post_group = CASE ' . $conditions . '
==>419: ELSE ' . end(array_keys($postgroups)) . '
420: END' . ($parameter1 != null ? '
421: WHERE ' . (is_array($parameter1) ? 'mem.id_member IN ({array_int:members})' : 'mem.id_member = {int:members}') : ''),
422: array(
423: 'members' => $parameter1,
424: )
425: );
426: break;
427:
428: case 'original_postgroups':
429: // Parameter two is the updated columns: we should check to see if we base groups off any of these.
430: if ($parameter2 !== null && !in_array('posts', $parameter2))
431: return;
432:
433: if (($postgroups = cache_get_data('updateStats:postgroups', 360)) == null)
434: {
435: // Fetch the postgroups!
436: $request = $smcFunc['db_query']('', '
437: SELECT id_group, min_posts
438: FROM {db_prefix}membergroups
439: WHERE min_posts != {int:min_posts}',
+

Help me to debug this error.
Thank you very much.
Title: Re: Based membergroups by thanks_count from mod Say Thanks
Post by: minimono on May 14, 2018, 03:47:26 AM
 :-[ :-[ :-[
Title: Re: Based membergroups by thanks_count from mod Say Thanks
Post by: dougiefresh on June 03, 2018, 12:03:38 PM
I've fixed the bugs reported, but I can't seem to upload to my site.  The CPL is under maintenance, so getting the creds is impossible at the moment....  Oh Bother....
Title: Re: Based membergroups by thanks_count from mod Say Thanks
Post by: minimono on June 04, 2018, 03:31:40 AM
Perfect debug. ;)
Thank You very much.
 ;D ;D ;D
Title: Re: Based membergroups by thanks_count from mod Say Thanks
Post by: dougiefresh on October 19, 2018, 09:24:35 AM
Thanks Received Membergroups (https://custom.simplemachines.org/mods/index.php?mod=4180) mod has been approved!!!  YAY!
Title: Re: Based membergroups by thanks_count from mod Say Thanks
Post by: Steve on October 19, 2018, 05:43:14 PM
I'm not sure I understand the last half of this statement in the mod description:

Quote
If that mod is not installed, this mod will result to install!
Title: Re: Based membergroups by thanks_count from mod Say Thanks
Post by: dougiefresh on October 19, 2018, 07:40:50 PM
Evidently, I need to learn English (its my primary\only language).....   :o. I meant if the Say Thanks mod isn't installed, an error message should be displayed and the install not completed.
Title: Re: Based membergroups by thanks_count from mod Say Thanks
Post by: dougiefresh on October 19, 2018, 09:33:18 PM
BTW, the mod description has been fixed.  All mod-related discussion should happen in the mod thread.  Thanks!