[MODDB] Ultimate Points 1.0.6

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Get Involved
Locked
User avatar
moltendorf
Registered User
Posts: 173
Joined: Thu Dec 01, 2005 2:02 am
Location: San Ramon, California
Contact:

Re: [RC] Ultimate Points 1.0.3

Post by moltendorf » Mon Jul 20, 2009 9:34 am

I have revised this query, please see here: http://www.phpbb.com/community/viewtopi ... #p10269755
moltendorf wrote:I have written a points sync for boards that already have lots of members and posts/topics on them to give existing members points for their posts and topics. Please note, this does not account for attachments or polls at the moment, nor does it count characters or words. To get it to count characters and words though, you simply need to edit each post you have made to get the points for them, in other words, there is no need for this to sync those values. Please note this is for 5 points per post, and 15 points per topic, if you have different settings per topic or post per forum, it will be inaccurate.

This will reset ALL existing points! Use at your own risk.
This SQL query only works with my patch!
  1. Run this SQL query. Replace phpbb_ with your table prefix!

    Code: Select all

    UPDATE phpbb_users u SET u.user_points = ((5*u.user_posts)+(SELECT c.reg_points_bonus FROM phpbb_points_values c LIMIT 1));
  2. Run this SQL query. Replace phpbb_ with your table prefix!

    Code: Select all

    UPDATE phpbb_users u SET u.user_points = (u.user_points + (10*(SELECT COUNT(*) FROM phpbb_topics t WHERE t.topic_poster = u.user_id)));
  3. Run this SQL query. Replace phpbb_ with your table prefix!

    Code: Select all

    UPDATE phpbb_posts p SET p.points_bonus = 5.0, p.points_received = 5.0;
  4. Run this SQL query. Replace phpbb_ with your table prefix!

    Code: Select all

    UPDATE phpbb_posts p SET p.points_bonus = 15.0, p.points_received = 15.0 WHERE p.post_id IN (SELECT t.topic_first_post_id FROM phpbb_topics t);
Last edited by moltendorf on Tue Jul 21, 2009 1:45 am, edited 3 times in total.
Did I ever mention that I think phpBB is awesome? I thought I did, but I'm not so sure, so I'll say it again: phpBB is awesome!
pantry \ snack :: is_good ( ) ? pantry \ snack :: hastily_consume ( ) : pantry \ snack :: reject ( );

Need some help? I have a solid understanding several programming and markup languages.
Projects: QuickChat: A Shoutbox, Live Post, ORANGEstyle

User avatar
Elitzur
I've Been Banned!
Posts: 323
Joined: Sat Sep 15, 2007 7:49 am
Location: Europe, UK.
Contact:

Re: [RC] Ultimate Points 1.0.3

Post by Elitzur » Mon Jul 20, 2009 10:18 am

Hey, Thanks for the good MOD, but where do I go to edit the amount of points you get for a post/topic?

I can't find it. Thanks :)

User avatar
moltendorf
Registered User
Posts: 173
Joined: Thu Dec 01, 2005 2:02 am
Location: San Ramon, California
Contact:

Re: [RC] Ultimate Points 1.0.3

Post by moltendorf » Mon Jul 20, 2009 10:41 am

Elitzur wrote:Hey, Thanks for the good MOD, but where do I go to edit the amount of points you get for a post/topic?

I can't find it. Thanks :)
I couldn't find it either, I don't think that setting exists, it just defaults to 15 points for new topics, 5 points for new posts. Also, there appears to be a bug, I'm not sure if that was intended design, but I'm pretty sure it wasn't. I gave the steps to patch it in a previous response.
http://www.phpbb.com/community/viewtopi ... #p10262315

Also, when installing this modification, and fixing it on my own... I noticed it has really poor database usage. It should be able to add points in one additional query, and remove them in two additional queries (this estimate is based on creating, editing, and deleting posts, not the other modules, like bank and lottery), but it really does it with five or more queries. Is there any chance of drastically improving the excess database usage in the future?
Did I ever mention that I think phpBB is awesome? I thought I did, but I'm not so sure, so I'll say it again: phpBB is awesome!
pantry \ snack :: is_good ( ) ? pantry \ snack :: hastily_consume ( ) : pantry \ snack :: reject ( );

Need some help? I have a solid understanding several programming and markup languages.
Projects: QuickChat: A Shoutbox, Live Post, ORANGEstyle

wolfman24
Registered User
Posts: 387
Joined: Tue Mar 07, 2006 12:07 pm

Re: [RC] Ultimate Points 1.0.3

Post by wolfman24 » Mon Jul 20, 2009 1:20 pm

moltendorf wrote:I couldn't find it either, I don't think that setting exists, it just defaults to 15 points for new topics, 5 points for new posts.
No, the settings are there, but the settings are per forum basis. So where can you edit forum based settings. Go to your ACP -> Forums end edit your Forums settings, but pay attention, categories don't have the points fields.

Funny how people believe something does not exist just because they don't see it.

User avatar
mehrdad_epark.ir
Registered User
Posts: 87
Joined: Thu Jul 31, 2008 3:08 pm

Re: [RC] Ultimate Points 1.0.3

Post by mehrdad_epark.ir » Mon Jul 20, 2009 1:40 pm


User avatar
moltendorf
Registered User
Posts: 173
Joined: Thu Dec 01, 2005 2:02 am
Location: San Ramon, California
Contact:

Re: [RC] Ultimate Points 1.0.3

Post by moltendorf » Mon Jul 20, 2009 10:09 pm

wolfman24 wrote:
moltendorf wrote:I couldn't find it either, I don't think that setting exists, it just defaults to 15 points for new topics, 5 points for new posts.
No, the settings are there, but the settings are per forum basis. So where can you edit forum based settings. Go to your ACP -> Forums end edit your Forums settings, but pay attention, categories don't have the points fields.

Funny how people believe something does not exist just because they don't see it.
Well I didn't believe it was there because there was no manual that came along with this modification. :(

I will update my resync SQL soon to include the info for forum resync.
Last edited by moltendorf on Mon Jul 20, 2009 11:43 pm, edited 1 time in total.
Did I ever mention that I think phpBB is awesome? I thought I did, but I'm not so sure, so I'll say it again: phpBB is awesome!
pantry \ snack :: is_good ( ) ? pantry \ snack :: hastily_consume ( ) : pantry \ snack :: reject ( );

Need some help? I have a solid understanding several programming and markup languages.
Projects: QuickChat: A Shoutbox, Live Post, ORANGEstyle

jimcarrel
Registered User
Posts: 671
Joined: Fri Jul 27, 2007 10:49 pm
Location: Oklahoma City, Oklahoma

Re: [RC] Ultimate Points 1.0.3

Post by jimcarrel » Mon Jul 20, 2009 11:03 pm

I absolutely do not intend to sound rude, but like always, in a thread under a MOD, all answers to questions are covered in the posts. That is how most people find how to solve problems and to find out how a mod works.
That is how I found out where all settings were
:)
Grace--Getting what I don't deserve
Mercy--Not getting what I do deserve

User avatar
milkboy31
Registered User
Posts: 422
Joined: Tue Aug 09, 2005 2:44 pm

Re: [RC] Ultimate Points 1.0.3

Post by milkboy31 » Tue Jul 21, 2009 12:05 am

milkboy31 wrote:One request though: Can we limit points based on forum? I see you can set a points per post/reply/edit per forum... or you can set a points per character/word/etc globally for all forums... I'd like to set a points per character but only enable earning points in certain forums. Maybe this is possible and I just didn't "get it" so correct me if I'm wrong. A simple "points on/off" in the forum config page would be awesome.
Unfortunatly not. Currently there no plans to set advaneced settings on a per forum basis.
Bummer... this doesn't seem like it'd be too much more of a stretch from what you already have. You have a per forum point adjustment for posts already... I think a global "points off" for a forum option isn't a bad idea. But it's your mod. :-P

The problem with NOT having it, is that you limit any users to assign points solely on a per forum basis (per post, per reply, per edit) and you take away their ability to give points per character, per word, per poll, per attachment, etc... if they have a SINGLE forum they don't want points assigned in (like a spam area, a test area, etc...). Having a "no points here" check-box would be ideal. You could still use all parts of the mod, even if you have a testing area or a spam/off-topic area.

If I could add this, I would, but unfortunately my code prowess stops short in this area. :lol:
milkboy31 wrote:Oh, and another... can you tell me how to add a field for points in the memberlist.php??? Thanks!
Where do you want to have the points? They are already in the memberview ....
I want to show them in the full memberlist... like where you can see all users by clicking "members" at the top of your board.

User avatar
moltendorf
Registered User
Posts: 173
Joined: Thu Dec 01, 2005 2:02 am
Location: San Ramon, California
Contact:

Re: [RC] Ultimate Points 1.0.3

Post by moltendorf » Tue Jul 21, 2009 1:41 am

I have revised my SQL resync query. It now accounts for all unique forum settings, attachments, and polls, etc. This will wipe all existing points information for your board (including bank accounts and lottery tickets), because of this, I only suggest you run it on fresh installs of this modification! This query will not count words or characters inside of a post unfortunately. But, don't worry, that info wasn't lost, if a user edits his/her post, the points for the words and characters will be added.

I highly recommend you backup your forum before running this query. If things go haywire, you will be able to restore.

This SQL query has only been tested on MySQL 5.0, it has been written in general SQL syntax, so I hope it will work on other databases.

Use at your own risk!
This SQL query only works with the patch I provided in this post: http://www.phpbb.com/community/viewtopi ... #p10262315
  1. Run this SQL query. Replace phpbb_ with your table prefix!
    Depending on the size of your database, this could take a very long time to complete. After all, look at the length of the query itself, it's 7,740 characters long.

    Code: Select all

        SET @attachment_initial = (
           SELECT
              c.points_per_attach
           FROM
              phpbb_points_values c
           LIMIT
              1
        );
    
        SET @attachment_extra = (
           SELECT
              c.points_per_attach_file
           FROM
              phpbb_points_values c
           LIMIT
              1
        );
    
        SET @poll_initial = (
           SELECT
              c.points_per_poll
           FROM
              phpbb_points_values c
           LIMIT
              1
        );
    
        SET @poll_extra = (
           SELECT
              c.points_per_poll_option
           FROM
              phpbb_points_values c
           LIMIT
              1
        );
    
        TRUNCATE TABLE phpbb_points_bank;
        TRUNCATE TABLE phpbb_points_lottery_tickets;
    
        UPDATE
           phpbb_users u
           SET
              u.user_points = ((
                 SELECT
                    c.reg_points_bonus
                    FROM
                       phpbb_points_values c
                    LIMIT
                       1
              ) + IF((
                 SELECT
                    SUM(f.forum_perpost + (f.forum_peredit * p.post_edit_count) + (@attachment_initial * p.post_attachment))
                    FROM
                       phpbb_forums f,
                       phpbb_posts p
                    WHERE
                       f.forum_id = p.forum_id AND
                       p.poster_id = u.user_id
              ),(
                 SELECT
                    SUM(f.forum_perpost + (f.forum_peredit * p.post_edit_count) + (@attachment_initial * p.post_attachment))
                    FROM
                       phpbb_forums f,
                       phpbb_posts p
                    WHERE
                       f.forum_id = p.forum_id AND
                       p.poster_id = u.user_id
              ),0) + IF((
                 SELECT
                    SUM(f.forum_pertopic - f.forum_perpost)
                    FROM
                       phpbb_forums f,
                       phpbb_topics t
                    WHERE
                       f.forum_id = t.forum_id AND
                       t.topic_poster = u.user_id
              ),(
                 SELECT
                    SUM(f.forum_pertopic - f.forum_perpost)
                    FROM
                       phpbb_forums f,
                       phpbb_topics t
                    WHERE
                       f.forum_id = t.forum_id AND
                       t.topic_poster = u.user_id
              ),0) + IF((
                 SELECT
                    SUM(@poll_initial)
                    FROM
                       phpbb_topics t
                    WHERE
                       t.poll_start > 0 AND
                       t.topic_poster = u.user_id
              ),(
                 SELECT
                    SUM(@poll_initial)
                    FROM
                       phpbb_topics t
                    WHERE
                       t.poll_start > 0 AND
                       t.topic_poster = u.user_id
              ),0) + IF((
                 SELECT
                    SUM(@poll_extra)
                    FROM
                       phpbb_poll_options o,
                       phpbb_topics t
                    WHERE
                       o.topic_id = t.topic_id AND
                       t.topic_poster = u.user_id
              ),(
                 SELECT
                    SUM(@poll_extra)
                    FROM
                       phpbb_poll_options o,
                       phpbb_topics t
                    WHERE
                       o.topic_id = t.topic_id AND
                       t.topic_poster = u.user_id
              ),0) + IF((
                 SELECT
                    SUM(@attachment_extra)
                    FROM
                       phpbb_attachments a
                    WHERE
                       a.poster_id = u.user_id
              ),(
                 SELECT
                    SUM(@attachment_extra)
                    FROM
                       phpbb_attachments a
                    WHERE
                       a.poster_id = u.user_id
              ),0));
    
        UPDATE
           phpbb_forums f,
           phpbb_posts p
           SET
              p.points_bonus = (f.forum_perpost + (f.forum_peredit * p.post_edit_count) + (@attachment_initial * p.post_attachment)),
              p.points_received = (f.forum_perpost + (f.forum_peredit * p.post_edit_count) + (@attachment_initial * p.post_attachment))
           WHERE
              f.forum_id = p.forum_id;
    
        UPDATE
           phpbb_forums f,
           phpbb_posts p,
           phpbb_topics t
           SET
              p.points_bonus = (f.forum_pertopic + (f.forum_peredit * p.post_edit_count) + (@attachment_initial * p.post_attachment)),
              p.points_received = (f.forum_pertopic + (f.forum_peredit * p.post_edit_count) + (@attachment_initial * p.post_attachment))
           WHERE
              f.forum_id = t.forum_id AND
              t.topic_first_post_id = p.post_id;
    
        UPDATE
           phpbb_posts p
           SET
              p.points_bonus = (p.points_bonus + IF((
                 SELECT
                    SUM(@attachment_extra)
                    FROM
                       phpbb_attachments a
                    WHERE
                       a.post_msg_id = p.post_id
              ),(
                 SELECT
                    SUM(@attachment_extra)
                    FROM
                       phpbb_attachments a
                    WHERE
                       a.post_msg_id = p.post_id
              ),0)),
              p.points_received = (p.points_received + IF((
                 SELECT
                    SUM(@attachment_extra)
                    FROM
                       phpbb_attachments a
                    WHERE
                       a.post_msg_id = p.post_id
              ),(
                 SELECT
                    SUM(@attachment_extra)
                    FROM
                       phpbb_attachments a
                    WHERE
                       a.post_msg_id = p.post_id
              ),0))
           WHERE
              p.post_attachment > 0;
    
        UPDATE
           phpbb_posts p,
           phpbb_topics t
           SET
              p.points_bonus = (p.points_bonus + @poll_initial + IF((
                 SELECT
                    SUM(@poll_extra)
                    FROM
                       phpbb_poll_options o
                    WHERE
                       o.topic_id = t.topic_id
              ),(
                 SELECT
                    SUM(@poll_extra)
                    FROM
                       phpbb_poll_options o
                    WHERE
                       o.topic_id = t.topic_id
              ),0)),
              p.points_received = (p.points_received + @poll_initial + IF((
                 SELECT
                    SUM(@poll_extra)
                    FROM
                       phpbb_poll_options o
                    WHERE
                       o.topic_id = t.topic_id
              ),(
                 SELECT
                    SUM(@poll_extra)
                    FROM
                       phpbb_poll_options o
                    WHERE
                       o.topic_id = t.topic_id
              ),0))
           WHERE
              t.poll_start > 0 AND
              t.topic_first_post_id = p.post_id;
Edit: I have fixed a bug in the SQL query that wasn't properly giving points to some members.
Edit: I have fixed another bug that was completely preventing the code from working.
Last edited by moltendorf on Fri Jul 31, 2009 4:14 pm, edited 4 times in total.
Did I ever mention that I think phpBB is awesome? I thought I did, but I'm not so sure, so I'll say it again: phpBB is awesome!
pantry \ snack :: is_good ( ) ? pantry \ snack :: hastily_consume ( ) : pantry \ snack :: reject ( );

Need some help? I have a solid understanding several programming and markup languages.
Projects: QuickChat: A Shoutbox, Live Post, ORANGEstyle

femu
Registered User
Posts: 1070
Joined: Tue Sep 27, 2005 10:03 am

Re: [RC] Ultimate Points 1.0.3

Post by femu » Tue Jul 21, 2009 2:26 am

Dear All,

let me answer first the more easy questions:

@mehrdad_espark.jr: The question is not if UPS works with other mods, but vise versa. UPS offers the points field and others may use it or not. So please ask the author of the Thank Mod to include UPS ;)

@Different People: Again for the question where the points per topic, post/replies and edits are set.

You can find this (if you've done all edits correctly) in each forum. So ACP -> Forum Settings and then in each forum right below the general forum settings you should see the Forum Points Settings.

Now the bigger one ....

@moltendorf: I'm not sure, if I understand all correctly. For the first part (where you add an additional field to the db) and changed afterwards some queries. I need to go into it first, but if it works, we can try to implement these in the next update.

For your statement of "bad database usage" ... There are surely always things, which can be done better. We are no programmers at all, we are still learning. But the mod is doing it's job so far. After 20 years programming for phpBB we will surely be better, but not now ;) Optimizing things is an ongoing process. So don't be too hard with us :roll:

@All: We are currently working on a online userguide for the ACP (that will take while) and we already implemented to set points for topics, posts/replies and edits via the ACP. This way you can set first, what you like to have in general and then just edit those forums, where you like to have it different.
Regards, femu
_____________________________________________
[My development page] - [My normal homepage (German only)]

User avatar
milkboy31
Registered User
Posts: 422
Joined: Tue Aug 09, 2005 2:44 pm

Re: [RC] Ultimate Points 1.0.3

Post by milkboy31 » Tue Jul 21, 2009 4:01 am

@All: We are currently working on a online userguide for the ACP (that will take while) and we already implemented to set points for topics, posts/replies and edits via the ACP. This way you can set first, what you like to have in general and then just edit those forums, where you like to have it different.
Wait, so would this work like this:
ACP points say 20 points per new post
Forum points say 10 points per new post
so
post = 30 points
or
post = 10 points

If post = 10 points, then I'm happy... Forum points would override general ACP points and then I could have my forums with 0 points while others are able to get points still for characters, words, etc...

User avatar
moltendorf
Registered User
Posts: 173
Joined: Thu Dec 01, 2005 2:02 am
Location: San Ramon, California
Contact:

Re: [RC] Ultimate Points 1.0.3

Post by moltendorf » Tue Jul 21, 2009 4:22 am

femu wrote:I'm not sure, if I understand all correctly. For the first part (where you add an additional field to the db) and changed afterwards some queries. I need to go into it first, but if it works, we can try to implement these in the next update.
My changes definitely do work, they completely fix the issue of points being subtracted when editing a post and not deleting any portion of it. Now, I'm not sure if you listed "points are subtracted when you edit a post with attachments" as a feature because it was a bug, or if it really was intended, but I felt it was unintentional to have that happen, so I also repaired that issue in my tweaks. The only things that are not completely functional would be the attachment and poll points being added/subtracted properly when adding or removing them when editing a post. Also, it appears that if you delete a post from within the moderator control panel, or within the administration control panel (when deleting the user entirely, or deleting a forum entirely, etc.) does not subtract points either, and again, I do not know if this was intentional or not. But if you delete a post by clicking on the x button in a post, the points are properly subtracted.

I also hope you take a look at my synchronization query. It properly pre-populates the database with points for each user, however, it does not count characters and words. Your script already properly awards the amount of points for characters and words when editing posts, so I left that out of my query.
femu wrote:For your statement of "bad database usage" ... There are surely always things, which can be done better. We are no programmers at all, we are still learning. But the mod is doing it's job so far. After 20 years programming for phpBB we will surely be better, but not now ;) Optimizing things is an ongoing process. So don't be too hard with us :roll:
It's not so horrible to the point that the board is a hundred percent unusable, I'm just saying that it could definitely be improved. It may hurt servers with slow database performance quite a bit, and cause some websites to cripple under heavy load quicker. I saw some obvious places it could be improved, I wouldn't have said anything if it was like the phpBB 3 itself where I would need some form of a montage to spot performance bottlenecks (although, if it was as large as phpBB 3 itself, I would have said something anyways).
Did I ever mention that I think phpBB is awesome? I thought I did, but I'm not so sure, so I'll say it again: phpBB is awesome!
pantry \ snack :: is_good ( ) ? pantry \ snack :: hastily_consume ( ) : pantry \ snack :: reject ( );

Need some help? I have a solid understanding several programming and markup languages.
Projects: QuickChat: A Shoutbox, Live Post, ORANGEstyle

femu
Registered User
Posts: 1070
Joined: Tue Sep 27, 2005 10:03 am

Re: [RC] Ultimate Points 1.0.3

Post by femu » Tue Jul 21, 2009 6:34 am

milkboy31 wrote:
@All: We are currently working on a online userguide for the ACP (that will take while) and we already implemented to set points for topics, posts/replies and edits via the ACP. This way you can set first, what you like to have in general and then just edit those forums, where you like to have it different.
Wait, so would this work like this:
ACP points say 20 points per new post
Forum points say 10 points per new post
so
post = 30 points
or
post = 10 points

If post = 10 points, then I'm happy... Forum points would override general ACP points and then I could have my forums with 0 points while others are able to get points still for characters, words, etc...
This means simply: In the first installtion we set some predefined values. With the new option, you can overwrite these values with your own. I think we will then change the first fill to 0, 0, 0 ... This should be done of course before you change any single forum with different values. Example:

Currently in first installtion all fileds are filled as fowllows:
Topic: 15 points
Post/Replay: 5 points
Edit: 0.5 points

With the new option, you can freely set the values to whatever you like. So after the first installtion all values will be set to zero then and you set them all by yourself and then edit each forum, where like to have different values.

Hope this is fine this way.
Regards, femu
_____________________________________________
[My development page] - [My normal homepage (German only)]

User avatar
Bobski2000
Registered User
Posts: 130
Joined: Mon Feb 16, 2009 9:40 pm
Location: UK

Re: [RC] Ultimate Points 1.0.3

Post by Bobski2000 » Tue Jul 21, 2009 10:18 am

Hi all. Im trying to edit the first bit in the functions.php.

But i cannot find this text:

Find:

Code: Select all

// The following assigns all _common_ variables that may be used at any point in a template.
	$template->assign_vars(array(
If i search with just this $template->assign_vars(array( it throws up 11 entries. Any ideas on where i should place this bit?

ADD Bedore:

Code: Select all

// Start Ultimate Points
	$user->add_lang('mods/points');
	// End Ultimate Points
I tried to post my functions.php file but it's over 4000 lines and it kinda freaked at me..lol

Thanks

User avatar
moltendorf
Registered User
Posts: 173
Joined: Thu Dec 01, 2005 2:02 am
Location: San Ramon, California
Contact:

Re: [RC] Ultimate Points 1.0.3

Post by moltendorf » Tue Jul 21, 2009 12:39 pm

Bobski2000 wrote: But i cannot find this text:

Find:

Code: Select all

// The following assigns all _common_ variables that may be used at any point in a template.
	$template->assign_vars(array(
Did you try searching for something else that might be unique in that segment?
Like this part, or parts within this part:

Code: Select all

The following assigns all _common_ variables that may be used at any point in a template
Did I ever mention that I think phpBB is awesome? I thought I did, but I'm not so sure, so I'll say it again: phpBB is awesome!
pantry \ snack :: is_good ( ) ? pantry \ snack :: hastily_consume ( ) : pantry \ snack :: reject ( );

Need some help? I have a solid understanding several programming and markup languages.
Projects: QuickChat: A Shoutbox, Live Post, ORANGEstyle

Locked

Return to “[3.0.x] MODs in Development”