SMF Points June 16, 2016, 11:09:22 pm Hey people!I'm thinking of manually editing elkarte files to include this mod: http://custom.simplemachines.org/mods/index.php?mod=1741Of course some tweaking here and there is necessary but I'm curious to know what you folks think?Is it quite a simple thing and should kinda work? Or is it very hard to accomplish? :O
Re: SMF Points Reply #1 – June 17, 2016, 07:50:45 pm From a quick look it should generally work after its been converted to ElkArte ... The work will mostly be around converting the db querys to Elk format (easy) and then replacing the source edits in the install.xml with hooks (its unlikely that you will find those exact lines of code, but you should find hooks in the areas that were changed.)
Re: SMF Points Reply #2 – June 18, 2016, 04:13:27 am Alright nice, will give it a shot after 1.1 goes gold!
Re: SMF Points Reply #3 – June 18, 2016, 07:51:00 am Consider that 1.1 will be "stable" in not less than 6 months.
Re: SMF Points Reply #5 – June 30, 2016, 11:13:54 pm Yay I'm sort of done.But there's one problem...I've somehow hard coded the count based groups to follow the "points" instead of "posts". And it works.But the problem is, everytime the points increase to the next group, it will not auto-refresh or auto-update.Instead, I will need to go to any post-count based group, and just save it (without changing anything) and it will be refreshed.Is there some "cronn" setting or something which functions to auto-update these groups?What am I missing here? :O
Re: SMF Points Reply #6 – July 01, 2016, 04:04:38 am I suppose you don't have any cache enabled, right?You may have missed the update code?See what you changed may help...
Re: SMF Points Reply #7 – July 01, 2016, 05:12:43 am These are what I've changed so far... hmm...#Load.php'points' => comma_format($profile['points']),'points' => empty($user_settings['points']) ? 0 : $user_settings['points'], ================================#GenericMessages.template.php$poster_div .= '<li class="listlevel1 title">Points: ' . $message['member']['points'] . '</li>';================================#Membergroups.subs.phpWHEN points >= ' . $min_posts . (!empty($lastMin) ? ' AND points <= ' . $lastMin : '') . ' THEN ' . $id;================================#ProfileInfo.template.php<dt>Points:</dt><dd>', $context['num_points'], ' points</dd>if (!isset($context['disabled_fields']['posts']))echo '<dt>Points:</dt><dd>', $context['member']['points'], ' Points</dd>';================================#ProfileInfo.controller.php$context['num_points'] = comma_format($user_profile[$this->_memID]['points']);================================#Post.subs.phpif (!empty($posterOptions['update_post_count']) && !empty($posterOptions['id']) && $msgOptions['approved']) { $point = 0; // no, BBCCode won't count $plaintext = preg_replace('[\[(.*?)\]]', ' ', $msgOptions['body']); // convert newlines to spaces $plaintext = str_replace(array('', "\r", "\n"), ' ', $plaintext); // convert multiple spaces into one $plaintext = preg_replace('/\s+/', ' ', $plaintext); $words = str_word_count($plaintext); $point += (floor($words/25)); // Limit? if ($point > 10) $point = 10; $db->query('', ' UPDATE {db_prefix}members SET points = points + {int:point} WHERE id_member = {int:id_member} LIMIT 1', array( 'point' => $point, 'id_member' => $posterOptions['id'] ) ); }================================
Re: SMF Points Reply #8 – July 01, 2016, 08:00:30 am This:Code: [Select]'points' => empty($user_settings['points']) ? 0 : $user_settings['points'], should likely be:Code: [Select]'points' => empty($profile['points']) ? 0 : $profile['points'],
Re: SMF Points Reply #9 – July 02, 2016, 01:16:06 am Alright changed that! But sadly, still the same. But oh well, at least it works in general.. as long as you manually refresh the post-count based groups every now and then.
Re: SMF Points Reply #10 – July 02, 2016, 04:35:18 am Looking at the code of Post.subs.php you posted, a question: does it mean you removed the update of post counts at all?Do you have the post count enabled on the boards you are posting to?
Re: SMF Points Reply #11 – July 02, 2016, 10:31:35 pm Nope, the post counts are still working. You will still +1 for each post. And yup, I have post counts enabled on those boards too.
Re: SMF Points Reply #12 – July 06, 2016, 07:42:04 am Could you attach the modified files?I have to test them and see what's happening.
Re: SMF Points Reply #13 – July 31, 2016, 09:24:48 am It would be great if the addon is ready for ElkArte
Re: SMF Points Reply #14 – July 31, 2016, 11:54:19 am Oh my... nearly forgot about this. @emanuele Here's the modified files attached! And also, yeah you'll need a new column "points" under the members table in the database.