Support Forum

WPAchievements Ranks

FF Frank Fasano
Frank Fasano
Member

Is anyone using the WPAchievements plugin with Simple:Press?  If so, does anyone happen to know a way that I can display users’ ranks on posts under their names in the forum?

Thanks.

120 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

It’s been a while since I looked at it but I assume it has some sort of template tag or available function that can be called to display what you want so it should be easy enough to add it into the Simple:Press page template. So – do you know what the call is and how to use it?

FF Frank Fasano
Frank Fasano
Member

Some of that might be beyond my capabilities.  I know ranks can be displayed with WordPress shortcodes.  Will that work?

YS Yellow Swordfish
Yellow Swordfish
Member

We can help you with it – have no fear!
I am not sure about using shortcodes in this way but I can check up for you. Template tags would be better and simpler… Will need to get back to you…

YS Yellow Swordfish
Yellow Swordfish
Member

Where are you funding information on shortcodes please? I don’t see anything that mentions them…

FF Frank Fasano
Frank Fasano
Member

I copy and pasted all the shortcodes into a Word document and shared it here:

http://www.filedropper.com/wpachievementsshortcoes

Let me know if you have trouble accessing it.

Thanks!

MP Mr Papa
Mr Papa
Member

Not sure I follow where this was heading, but will try…

so you want it under the username in the topic view?  so find the spTopicView.php template file in the wp theme you are using and edit it…  the user name is displayed with this template tag:

                                    sp_PostIndexUserName(‘tagClass=spPostUserName spCenter’);

so you will want to output it after that…   you will want to add code similar to this:

echo do_shortcode("[shortcode]");

but instead of shortcode, use the one you want to display the rank with… perhaps

echo do_shortcode("[wpa_rank_achievements]");

with the needed arguments..

as always, we strongly recommend you create a child theme or your own theme rather than edit our themes since your changes will be overwritten if you update our themes…

FF Frank Fasano
Frank Fasano
Member

Hmmm…the actual process works but there seems to be no way to link the users in the forum with the shortcodes.  What I mean is that I can use a shortcode to display the logged in user’s rank but not the ranks of all the other users because I don’t know how to tell it who’s rank to pull.  Does that make sense?

The shortcode will accept a user ID though.  Is there a way to make this a variable that simple:press can understand?

YS Yellow Swordfish
Yellow Swordfish
Member

It depends where you are putting this. If ot goes on the topic view page (posts) on tbhe left where the avatar etc., is then you can use:

$spThisPostUser->ID

which will return the user ID of the author of the post.

FF Frank Fasano
Frank Fasano
Member

The plugin uses this shortcode:

[wpa_myranks user_id="1"]

So I tried this and it didn't work:
[wpa_myranks user_id="$spThisPostUser->ID"]

Sorry, I'm not great at this.  Should I have done something otherwise?

I'm trying to get it to display here:



YS Yellow Swordfish
Yellow Swordfish
Member

I have to admit I am not a shortcode man (or fan) but you wont get what you want – I think – with those quotes around the variable. Plus – as Steve demonstrated above – you need to make the full function call – just as he outlined.

FF Frank Fasano
Frank Fasano
Member

Ok, removing the quotes is certainly getting me somewhere and it does not appear to be showing the correct rank based on the user who made the post.  Just need to work on some sizing, etc.

Any idea how I could widen the section on the left that displays the users’ info?

YS Yellow Swordfish
Yellow Swordfish
Member

It’s NOT showing the correct user? Check the ID being output… just echo that variable on it’s own line in the template – you should find it equates to the user ID of the post author.

FF Frank Fasano
Frank Fasano
Member

Sorry for the typo…it is displaying the correct user.  Just need to make that section fit the width.  Any way to widen that sidebar?