Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Cubepoints Rank Display
Avatar
Josh Thomas
Member
Free Members
sp_UserOfflineSmall Offline
Oct 17, 2012 - 1:24 pm

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!

Thanks!Screen-shot-2012-10-17-at-1.19.33-PM.pngImage Enlarger

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 17, 2012 - 8:36 pm

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...

Avatar
Josh Thomas
Member
Free Members
sp_UserOfflineSmall Offline
Oct 17, 2012 - 11:27 pm

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?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 18, 2012 - 12:18 am

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...

Avatar
Josh Thomas
Member
Free Members
sp_UserOfflineSmall Offline
Oct 18, 2012 - 11:21 am

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.

Can you help me find the line of code I need to insertScreen-shot-2012-10-18-at-11.15.44-AM.pngImage Enlarger?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 18, 2012 - 12:38 pm

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

Avatar
Josh Thomas
Member
Free Members
sp_UserOfflineSmall Offline
Oct 18, 2012 - 12:57 pm

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.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 18, 2012 - 1:28 pm

Remove the () after $spThisPostUser

Avatar
Josh Thomas
Member
Free Members
sp_UserOfflineSmall Offline
Oct 18, 2012 - 3:35 pm

That fixed the error, but only recreated the original issue (all ranks are the same).

Avatar
Brandon
U.S.
SP Wrangler
Free Members
sp_UserOfflineSmall Offline
Oct 18, 2012 - 5:06 pm

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);
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625