Support Forum
Hi folks.
I'm using the Cubepoints plugin and was able to successfully show the points total in my user info on a post!
Pretty impressed with myself, since I don't know jack about php, just followed the codex.
What I'd like to know now is, what is the code that I place into TopicView.php that displays the rank I created within the plugin? For instance, if I have 27 points, it's associated with a rank of "Getting Started" that I set up in the admin. How can I make that rank show up in the red circle of the image attached?
Just a humble request in advance: words like string, array, call, etc mean nothing to me. I just need a line of code that I can paste into the proper area on TopicView.php. Anything more sophisticated will likely make my head explode.
Thanks very much!
Not sure I understand... you talk about cubepoints, but then switch to rank...
is this the forum rank? or some rank within cubepoints? if the latter, you will have to use the template tag or shortcode provided by the wp cubepoints plugin...
Visit Cruise Talk Central and Mr Papa's World
Thanks for your reply.
I am talking specifically about rankings set up within the Cubepoints plugin, apologies for the confusion.
As for the template tag or short code, I have absolutely no idea where to even begin looking for those. I read the codex on template tags, but that was no help.
I'd be happy to use either of those, but where do I find them?
if you are looking for a cubepoints rank, you need to look within that wp plugin - not simple press...
took a 15 second look at the plugin, seems you want something like:
if (is_user_logged_in()) echo 'Rank:'.cp_module_ranks_getRank(cp_currentUser());
but have not tested it... again, its a cubepoints function...
Visit Cruise Talk Central and Mr Papa's World
Thanks. That sort of worked. However, I believe that's the code that shows on a widget when the user is logged in, because it shows the same rank as mine for every other member as well. Meaning, every instance of this code will only show the rank of whoever is logged in and not the individual members.
The reason I'm asking on this forum is because you provide great information in your codex about how to display the points (see screenshot). This is almost exactly the same thing, and it's probably stored in a similar area. It's just that I have no idea where to look.
Ah, yes. Had just copied their code. You will want to use the post user vs current user. Problem is I don't know if they are passing user id or user object. And I wont have access to code until tonight.
Try changing it to $spThisPostUser
Visit Cruise Talk Central and Mr Papa's World
Ok, tried this:
if (is_user_logged_in()) echo 'Rank:'.cp_module_ranks_getRank($spThisPostUser());
...but got a fatal error. Forgive my ignorance, but I probably didn't fully understand your suggestion. I'd bet this is a fairly easy fix for someone like you once you're able to see the code tonight. But as for me, you'll have to be fairly specific on exactly what I need to put exactly where. Hope that's ok.
Thanks again for looking into this.
Remove the () after $spThisPostUser
Visit Cruise Talk Central and Mr Papa's World
Josh Thomas said
That fixed the error, but only recreated the original issue (all ranks are the same).
Probably needs the user ID. Try
if (is_user_logged_in()) echo 'Rank:'.cp_module_ranks_getRank($spThisPostUser->ID);
But I don't think you want the check to see if logged in if using it in the TopicView file by the poster's avatar. So
So just
echo 'Rank:'.cp_module_ranks_getRank($spThisPostUser->ID);