Topic RSS
I have accepted the task for 4.1 for a point system, so I will hopefully, be doing an initial look in the next month or so. Then comes discussions amongst the team in the best way to proceed (or abandon). but first, we need to get 4.0.1 out.. hopefully tomorrow…
hm, seems i’m lost. as the sf-hook-template.txt/.php was reworked a bit with the latest release as it seems, it seemed to be a good idea to include my code alterations there instead of alterting a core sf-forum file like sf-database.php ..
anyway, these two extended functions do not seem to work as expedted as i always get some Call to a member function get_var() on a non-object in /abs/path/here/wp-content/plugins/simple-forum/forum/hooks/sf-hook-template.php on line 395 or similar.. Would you be able to shed some light or help out, Mr Papa? If you would take a look into this file, which is an exact copy of my sf-hook-template that would be too nice and probably easier than to post the code here!
Lines causing problems are #373 and #395. Follows the same logic as suggested – what am I missing? Any help would be appreciated as always! [Edit: Code alterations from line #329 on function sf_hook_post_save() work like a charm btw =)
The problem is your use of the $wpdb object. You need to make it global so just put
at the top of each function that uses it.
Also remember that you need to 'return' content not echo it. Generally speaking anything echoed will appear at the very top of the page.
Damn, thats really a beginners' mistake – i should have seen that.. Sorry and thanks.
Anyway, what seems to work for post-removal perfectly well now, doesnt subtract ANY point when i delete a topic nor will it spit out any error message..
Code is (*.txt-File above accordingly update also):
{
/* Additional CubePoints integration */
if( function_exists('cp_alterPoints') && is_user_logged_in() ) {
global $wpdb;
$starter = $wpdb->get_var("SELECT user_id FROM ".SFTOPICS." WHERE topic_id = " . $topicid);
cp_alterPoints($starter, -3);
}
return;
}
And if you’re already on it.. function sf_hook_post_profile() – How can i access the user_ID of the user of the specific post? I would need to pass that to cp_displayPoints(); ..
i dont follow you.
the post_profile hook as to do with displaying a user's profile and nothing to do with a specific post. the 'post' part of the title indicates after the profile has been displayed.
10:04 pm
Just to update the Cubepoints-SimplePress integration a bit… The sf-hook-template.php part wasn't working for me so I edited sf-post.php. This is all for Simplepress version 4.1.2.
To add 30 cubepoints at topic creation (line 265 of sf-post.php), this is what the code now looks like:
return;
} else {
# lets grab the new topic id
$newpost['topicid'] = $wpdb->insert_id;
if( function_exists('cp_alterPoints') && is_user_logged_in() ){
cp_alterPoints(cp_currentUser(), 30);
}
}
I also changed the new topic notice to read around line 342 of sf-post.php "New Topic Saved and 30 GW Points Earned!".
Then, to add 10 points with a reply post, around line 364 of sf-post.php it now looks like this:
return;
} else
if( function_exists('cp_alterPoints') && is_user_logged_in() ){
cp_alterPoints(cp_currentUser(), 10);
}
Unfortunately, I haven't yet found a way to remove points upon topic or reply deletion. Anyone have any luck with that? Thanks, phanthomas and mr papa, for all the help in this thread!
there is a program hook available when a post is deleted. you can hook in there and add your code or call the cubepoints api.
we still have an open ticket to do our own points type thing, currently slated for v5.0
I tried Gamerwatier's post and it is giving points for a brand new post creation! I'm on SPF 4.1.3 btw
But not for posts on a existing topic.
Here is the code I used for trying to give points for a post on a existing topic. It's around Line 357 under
# Create new Post in existing Topic ————————————————
# Write the post
$newpost = sf_write_post($newpost);
if(!$newpost['db'])
{
update_sfnotice('sfmessage', __("Unable to Save New Post Message", "sforum"));
return;
if( function_exists('cp_alterPoints') && is_user_logged_in() ){
cp_alterPoints(cp_currentUser(), 5);
}
}
I haven't attemped to delete points if a post/topic is deleted just yet.
Most Users Ever Online: 444
Currently Online: SPQC
59 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
Quote
Offline


Visit

Privacy Policy



