Based membergroups by thanks_count from mod Say Thanks

Started by minimono, March 27, 2018, 04:33:19 AM

Previous topic - Next topic

minimono

I'm SMF 2.0.15
How to based membergroups by thanks_count from mod Say Thanks.
same mod Karma based membergroups.

Thank You. :)
SMF 2.0.15 | PHP 7.X | MySql 5.6 | Softer theme | SMFAds

Steve

Mod questions for existing mods need to be asked in the support threads for them.
DO NOT pm me for support!

Kindred

he wants a new mod that adds functionality based on another mod...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

dougiefresh

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:) )

minimono

Quote from: kim_c on January 19, 2018, 10:59:01 AM
Mod is no longer supported so you probably won't receive an answer  :(

Quote from: 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:) )
;D
SMF 2.0.15 | PHP 7.X | MySql 5.6 | Softer theme | SMFAds


minimono

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.
SMF 2.0.15 | PHP 7.X | MySql 5.6 | Softer theme | SMFAds

minimono

SMF 2.0.15 | PHP 7.X | MySql 5.6 | Softer theme | SMFAds

dougiefresh

#8
Quote from: 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.
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:)

dougiefresh

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

minimono

Error Log  Thanks Received Membergroups v1.0.1

when giving/withdrawing thanks.
> 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
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
> 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
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.
SMF 2.0.15 | PHP 7.X | MySql 5.6 | Softer theme | SMFAds

minimono

SMF 2.0.15 | PHP 7.X | MySql 5.6 | Softer theme | SMFAds

dougiefresh

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....

minimono

SMF 2.0.15 | PHP 7.X | MySql 5.6 | Softer theme | SMFAds


Steve

I'm not sure I understand the last half of this statement in the mod description:

QuoteIf that mod is not installed, this mod will result to install!
DO NOT pm me for support!

dougiefresh

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.

dougiefresh

BTW, the mod description has been fixed.  All mod-related discussion should happen in the mod thread.  Thanks!

Advertisement: