Support Forum
I am now using sph_display_post_content_filter to add some content as a footer. The content is stored in the database sfposts in a separate column. In order to retrieve the data from the database I need to know the post_ID for the query, and was wondering how I could get that reference. Thanks.
not sure what you are really doing and what you want it for... are you in the topic view loop here (ie the outputting of a post)??
depending on the various page view type (ie group, forum, topic, etc), we have a defined some global objects that are available for you to use for looking at or getting data... can save on a db query...
I would suggest going to forum - toolbox - data inspector and turning on some of the 'debug' display of the available data so you can see what is already available...
I suspect what you want is $spThisPost->post_id but not sure what you are going to do with it... the 'real' data you want may already be available...
Visit Cruise Talk Central and Mr Papa's World
Thanks for your response the data inspector was really helpful. However, I just realized how vague my initial post was.
What I am trying to do is write a plugin that lets users thank another user and then display who has thanked the user. The plugin might eventually use the number of thanks, along with other factors (# of posts, activity, registration date) to give a user ranking. Right now in the sfmembers table I will have two extra columns one with the post ID's of what the user has thanked and another for the post ID's of the user that have been thanked by other users. I will also have an extra column in the sfposts table that will have the member ID's of those that have thanked that post. I have been able to get all the install and uninstall of the plugin and its database edits to work successfully.
I am now having trouble trying to figure out how I should display the users that have thanked the post during the post loop. I probably should not be using the sph_display_post_content_filter to do this, but didn't know what hook I could use that would let me get the post data object that is shown in the output of the data inspector for spThisTopic. Any suggestions would be appreciated.
The best way to do this is actually with a template function. These are the functions used in the theme templates to display data.
Take a look at the files in /simple-press/forum/content and you will find all of the functions used for the forum display in their various views.
These should help you with the structure we are using and you sound savvy enough to probably work that out.
With Sp plugins we would normally define a 'template-tags' folder to keep these functions in. A plugin like Subscriptions - for example - would be worth looking at so you can see the structure.
This kind of feature - or features like it - have been asked for by many users. I don't know if you would be willing to share when you have it all done but we would certainly be interested and willing to help you with it as far as possible.
YELLOW
SWORDFISH
|
please do. and let us know if you have any questions or issues.
Visit Cruise Talk Central and Mr Papa's World
1 Guest(s)