Support Forum

SimplePress 5 – CubePoints Integration Plugin

CU cubehouse
cubehouse
Member

Tada!

Good API, was a little tricky to get the hang of, but all works in the end 🙂

Would like to know how to make “nice” error messages when CubePoints isn't detected.

http://cubehouse.org/blog/wp-content/uploads/2011/07/cubePoints.zip

Thoughts/Feedback/Testing appreciated 🙂

 

Officially the first third-party Simple:Press 5 plugin 😀

30 Answers

New Answer

MP Mr Papa
Mr Papa
Member

I was hoping you were working on that!   outstanding!  have to give this a shot a bit later – but dont have cubepoints Frown

so plenty of hooks and filters for you?

what do you mean by nice message?  where do you want it?  in the admin? on plugin page?  banner at top?  please advise and we can help

CU cubehouse
cubehouse
Member

Howdy!
When cubePoints isn’t installed, wanted a nice error message above the options menu in the admin area. At the moment just some bold text. Don’t know if there is a function to make Simple:press style admin error messages or alerts.

MP Mr Papa
Mr Papa
Member

we do have a admin panel header area you can add messages… I just committed a change with a hook when its done so you can add stuff… after svn up, you will want

sph_admin_panel_header

CU cubehouse
cubehouse
Member

Great, will play with that later. 🙂
Funny rally, my idea was to make a WordPress point plugin and I was going to call it cubePoints because of my username… but somebody already made one… with the same name… So, I made this instead!

MP Mr Papa
Mr Papa
Member

well, arent you the guy who did the earlier integration of cubepoints and simple:press? for the 4.x version?  it was a bit limited given the api we had…

MP Mr Papa
Mr Papa
Member

couple questions on the plugin…

how do you deal with posts in moderation? or do you just get at point of post?  wonder if we have a hook/action when the moderation occurs?

do you subtract points for deleted post?

looks good!

CU cubehouse
cubehouse
Member

Nope! Never been involved with Simple:Press until recently. Just picked cubePoints because I’m planning on using it on my site in the near future. Mark me a Simple:Press noob with significant PHP/WordPress debugging skills 😉

Only deal with new post/topic at the moment.Is only basic so far. Not sure how to deal with eleted posts, since if you change the number of points for a new post, then delete it, the users loses more points… will probably add it in under the assumption admins dont reglarly change point values.

Don’t know how moderation stuff works yet, when it’s approved, does it call a different action then? Currently just picking out data from the $newpost object from the new post action hook.Basing the points added on $newpost->action == “topic” etc. (is it action/type? on my tablet atm… you know what I mean…)

MP Mr Papa
Mr Papa
Member

yeah just add a hook for when posts approved… was there but not very friendly… new one is:

sph_post_approved

an array of approved posts since you can approve all posts in a topic at once…

so yeah when creating the post topic, if post_status == 0, it needs moderation, ie approval..

but you are hooked (its a filter) into: sph_new_forum_post

I would probably hook (an action) into: sph_post_create

which is actually after the topic or post has been created… you are currently before so it might get rejected as spam or other… you will still get $newpost passed to you…

if post_status == 1 then award points… if post_status == 0 then might wait for the post approval hook to actually award the points…

just food for thought…

MP Mr Papa
Mr Papa
Member

and just for reference…

https://simple-press.com/support-forum/sp4/simplepress-and-cube-points-integration/

CU cubehouse
cubehouse
Member

I’m actually getting $newpost[‘poststatus’] = 0 all the time. Even though it’s posting correctly D:

MP Mr Papa
Mr Papa
Member

whoops. have that backwards….. posts needing moderation have post_status == 1 Wink

and only posts required by your permissions to be moderated will go through moderation…

CU cubehouse
cubehouse
Member

Ok, I’m trying to use the “sph_post_delete” hook. It returns a single integer which is the post_id that just got deleted.

Any thoughts on the best way of pulling the user_id from that? Or is there a more sensible hook?

Edit: Also, I think “sph_topic_delete” doesn’t call the “sph_post_delete” hook for each post? Should this be a separate case?

MP Mr Papa
Mr Papa
Member

try an svn up…

have updated both hooks… 

the post delete hook will now pass an object of the post row that was deleted…

the topic delete hook will now pass an object with all the post rows that were deleted…

you can get what you need from them…

but yes, delete topic and delete posts are two different things… easier/quicker/more efficient to delete a topic then delete each post individually…

for some points implementations, you get more points for starting at topic than replying… Wink

one word of caution – not sure you care…  but, if you delete a post, and its the only post in that topic, you will instead get a topic deletion hook fired and not the post deletion hook…