Hey people!
I'm thinking of manually editing elkarte files to include this mod: http://custom.simplemachines.org/mods/index.php?mod=1741
Of 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
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.)
Alright nice, will give it a shot after 1.1 goes gold! :)
Consider that 1.1 will be "stable" in not less than 6 months. ;)
O:-) Prays for the best haha
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
I suppose you don't have any cache enabled, right?
You may have missed the update code?
See what you changed may help...
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.php
WHEN 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.php
if (!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']
)
);
}
================================
:o
This:
'points' => empty($user_settings['points']) ? 0 : $user_settings['points'],
should likely be:
'points' => empty($profile['points']) ? 0 : $profile['points'],
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. :)
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?
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.
Could you attach the modified files?
I have to test them and see what's happening. :)
It would be great if the addon is ready for ElkArte :)
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.
Is it ready Niloc? Should i test it in my localhost
Great job! Keep it up.
But may be you can create the new column via the addon itself? I can't remember "the how" very well, unless I really put my mind into it, but I think others can help on that.
Oh no it's not ready.. it's just for emanuele to help me sort out with a bug. :(