Support Forum
Hello,
I am attempting to add an achievement badge under the user name on a post (please see attached image). I am able to query the database with the user id so I have two questions:
1. How do you suggest I insert new html into the template file? I am worried that if I just add it into the template that when the plugin is updated the code will be lost.
2. Where should the function that grabs this data be defined? If i define it in the sp_functions.php file will it have the correct scope to be available in the template file?
Thanks for your help!
yes, you can insert any custom php or html where you would like it in your sp theme template files... As long as the theme is your theme and not one of ours, no changes will be lost on updates...
see: http://codex.simple-press.com/.....g-a-theme/ for more info on creating your own theme from one of ours...
you can create the php function for grabbing the data in the template file itself if only used there... remember, the template file itself is php so you can put any php code there that you like... as you probably know, this is the spTopicView.php template file...
or the spFunctions.php template file is available on all forum pages that get loaded so it has much greater scope and the functions could be put there... the only downside to spFunctions.php is that it is loaded on all forum pages (very minimal impact unless the function size is quite large)...
out of curiosity, is this a custom or homegrown achievements thing? or are you using the wp achievements plugin and subsequently our sp achievements integration plugin?
Visit Cruise Talk Central and Mr Papa's World
Thank you for that info! That should point me in the right direction.
Yes I am using the wpAchievements plugin and may use the simple:press integration plugin in the future. As I understand it, the sp achievements integration plugin allows for tracking events from simple:press like posting, but it doesn't allow for any custom theming using the data.
Thanks again.
yes, you can track forum events with our achievements integration plugin.... but if the core wp plugin for it has template tags for displaying a badge, you should just be able to use that function in our template file...
you are welcome!
Visit Cruise Talk Central and Mr Papa's World
1 Guest(s)