Topic RSS
Hey Andy, Papa..
First of all, let me thank you for another major step in SF-Development! Although there were some bugs (the already “well known” bug within Firefox and some others) I successfully mastered to get my forums up to 4.0.
So far, our users are really happy with it! Some really nice addons, redone functions etc.pp. Me as an admin at least – i’m very happy to tell that we could finally re-activate RSS for our forums again as it contains also an “internal” forum, which contains confidential data und could be read by ANY user knowing (or testing out) the correct ID of the forum/s. Now everything works just fine!
What i’m looking for now are some – probably – very simple things: I’m trying to integrate the new “CubePoints” Plugin into the whole WP-System. Means: Not only comments and articles, but forums also.
The Plan:
- Topic Starter receives – let’s say – 5 Points for opening a new topic
- Follow up posts receive 1 point for each post
- Upon deletion of a topic/posting points get deducted from achieved score again
Just an example to give you a picture.
What i need now:
- Name/Location of the script/s and function/s that execute a new topic posting
- Name/Location of the script/s and function/s that execute a new follow up posting
- Name/Location of the script/s and function/s that execute a new postings deletion
- Name/Location of the script/s and function/s that execute a topics deletion
(Question: Does that delete every post ONE by ONE? Then it would know every users ID etc. pp – and therefore be ideal to deduct the according score from every users account? Or is there any possible workaround?) - If you could name the exact lines that would have to be edited/where code would need to be inserted – that would be just perfect, but maybe too much asked for?!
I’m quite willing to give you something back in exchange, like a full documentation of what has to be done to achieve the above mentioned or whatever to get a full community thing up and running.. Deal?[Edit: PS – a little donation to show respect and support further development has just been done..)
wow, ambitious endeavor… we have a points type system on our list for future consideration, but it likely wont be using that plugin though when the time comes, will take a look.
I would start in two places:
sf-database.php – most actions like you ask about are handled in there, or at least the db manipulation
sf-hook-template.txt – read the online help about hooks, but there may be some (save post) in there that could help you.
Thanks for the donation!
Thanks for the quick reply though i'm a bit disappointed about it's richness of details. Or the lack of it ;)
However, after some research I can now answer most of my questions. Actually it's already working ~90% already now.
- Post creation – score can easily be increased.
File: sf-hook-template.txt – File has to be renamed to *.php to make it work. Lines to be edited as follows, beginning at line #294:function sf_hook_post_save($permalink, $content)
{
/* Additional CubePoints integration */
if( function_exists('cp_alterPoints') && is_user_logged_in() ){
cp_alterPoints(cp_currentUser(), 1);
}
return;
}This will add just one point at post creation.
- The editable hook-thingie is really a nice idea. Just a pity that it lacks some functions for post deletion, topic creation etc. So we have to mingle with the core-files

To deduct a point upon TOPIC deletion:
File: sf-database.php. Lines to be edited as follows, beginning at line #2634:if($wpdb === false)
{
if($show) update_sfnotice('sfmessage', '1@'.__("Deletion Failed", "sforum"));
return;
} else { # CubePoints integration
if( function_exists('cp_alterPoints') && is_user_logged_in() )
{
cp_alterPoints(cp_currentUser(), -1);
}
} - To deduct a point upon POST deletion:
File: sf-database.php. Lines to be edited as follows, beginning at (with the lines above already inserted) line #2684:if($wpdb === false)
{
if($show) update_sfnotice('sfmessage', '1@'.__("Deletion Failed", "sforum"));
} else {
if( function_exists('cp_alterPoints') && is_user_logged_in() )
{
cp_alterPoints(cp_currentUser(), -1);
}
if($show) update_sfnotice('sfmessage', '0@'.__("Post Deleted", "sforum"));
}
Works like a charm now – with just small deductions from my original plan as follows:
- It does not seem possible to distinguish a TOPIC and a POST creation. So also not possible to give like 5 points for topic creation and just 1 for topic postings.
- It does not decrease the score of any follow up posters when a complete TOPIC is removed. Points will just be removed from the original topic poster. I have an idea on how to fix that, but any input/quick solution/code would be nice.
Any further input on these things would be really nice!
Besides: Why i prefer CubePoints or any other system over a just simple-press internal function is that CubePoints already integrates flawlessly with article and comment creation as well as deletion. So it's a more global approach to a real community rather than just a forum-community thingie..
*DANG* Bug :P
#2 and #3 do remove the points from the accordings admins/moderators account..
Can anyone shed some light on how to find out the users id of the creator that need to be parsed to CubePoints for the above mentioned?!
you can distinguish a post and a topic by looking at the number of posts in the topic where the post is being made. If its one, then its the start of the topic. Just add a db query to the hook routine to get the number of posts. You can do this in any of the hooks as you have complete access to the db.
for removing a topic, you will need to modify the core spf code. I will also open a new ticket for consideration of adding a few more specialized hooks to tell when certain actions occur.
As I mentioned, when we get around to implementing a points type system (and its tentatively on the books for 4.1) we will consider cubepoints. But it will globally have to meet our needs. For example, some users will ONLY want a points system for the forum, so could cubepoints be turned off for posts and/or comments? you dont need to answer, but just trying to point out that no one solution is likely to make everyone happy.
Cubepoint was just released so i think its a long way to go til perfection.. anyway – works like a charm so far and does everything as its supposed to. And yes – you can freely adjust if and how many points you will add for a comment or even totally disable it. Same goes for articles. You can also subtract a freely adjustable amount of points for deletion of a comment, so if you want to "punish" a user for some comment you may give him one point for each comment and like -5 points for its deletion.. And yes – you can also donate points from user to user.. Really nice thing. Anyway, i'm not trying to convince anyone, that's not my job..
Back to topic: Just for now i could live with the fact that only the topic poster will get one point subtracted and not the follow-up posters. I think that could be done though through a query for the PostID.
Exactly, that would be line #2646:
Guess i would have to walk through every post with that TopicID and deduct points from the according user of that posting.
But my main concern remains unanswered again: Is there any way to get access to the userID in my codesnippets #2 and #3? I need to replace cp_currentUser() with the userID of the poster as the above mentioned code will deduct the point/s from MY or the moderators account..
Personal note: sf-hook-template.php is a brilliant idea as it allows everyone to do whatever one individually wants. It just lacks some features as the deletion of posts, topics (including all followup-posts), access to the userID (as it seems) and last but not least the option to display anything in the Userbox that appears left to every posting. Just sharing some thoughts..
you want the user id of the person who started the topic?
Assume this would go in the two locations in sf-database.php that you modified…
YES! Thanks very very much, Papa! Seems to work now as expected. Just need to walk through the follow-up posts on a topic now, then it would be perfect, i guess
And it would be nice to have a hook to display whatever in the Userbox left to every post without hacking the core-code. If that could be added within the next release, i`d be totally happy!
An updated and bugfixed version of Cubepoints is expected within the next 2 days, btw..
8:46 am
I am also interested in using cubepoints with simplepress. I am not as technically savy as the original poster.
Is there a way you could integrate it into the next update for those of us who wish to use it as a points system, till you come up with your own. Just keep in mind that many sites are now starting to use Cubepoints and they might not want 2 point systems.
I would try the coding listed above, but again I am not that tech savy.
Thanks.
Most Users Ever Online: 444
Currently Online:
58 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
-Radio-: 1251
Lee H: 606
Luffer: 535
Conrad_Farlow: 485
jim: 478
neon: 263
ovizii: 240
Tal: 240
Member Stats:
Guest Posters: 2616
Members: 7328
Moderators: 1
Admins: 2
Forum Stats:
Groups: 5
Forums: 16
Topics: 10839
Posts: 79131
Newest Members: ordie69, mutha66, jawaulk, mastergalen, ikkiamonrah, OlafKS, js, Anne Wayman, vinzMtl, VikingBrent
Moderators: Brandon C (158)
Administrators: Yellow Swordfish (22131), Mr Papa (23587)
Log In
Register
Home
Add Reply
Add Topic
Offline

Quote


Visit 
Privacy Policy



