Customizing SMF > SMF Coding Discussion

Help needed! Updating of a db table on the fly

(1/2) > >>

vsync:
Hello,

The topic does not really describe my problem good, but I couldn't come up with a better topic. :(
I am writing / modifying SMF 1.1.16, and here's my plan:
I have a database table, which has all the users and additional data that I'm displaying on the "mini-profile" on the message pages. The one with user post counts and such... When a topic is viewed, I need to update the data on my db table for all those users who have posted on that topic, to refresh the data I'm displaying on the mini-profile. Now the best solution would probably be, to add the script that upgrades the database table to the integrate_pre_load -hook, or possibly if I can find a hook that fires on message-pages. But my problem is, how to find the user list for which to upgrade my table, (as in, the users that have posted on the topic that is being viewed).

I hope I managed to describe my problem good enough for people to understand it.

Suki:
Welcome to SMF.

SMF 1.1.x doesn't provide the hooks functionality, so, any change that you may add would have to be a manual edit.

If you want to update a table on a topic view, then the Best place to add your code would be on Display.php, that files loads a lot of info too, you can hijack some of that data to build your query.

vsync:
Yeah...
I'd rather do this without modifying the smf core itself.
Though this here:
http://www.simplemachines.org/community/index.php?topic=173483.0
says that hooks are implemented in 1.1

I guess I can always do a query of my own. But does integrate_pre_load fire before anything is loaded into the global variables, such as $context?

Suki:
Most of the hooks in 1.1 were designed with integration in mind rather than allowing code/feature changes.

Yes, some of them are included since 1.1, integrate_pre_include and integrate_pre_load are one of them, the actual integration is been done differently but it has the same final purpose.

vsync:
well hooks and versions aside, as that wasn't my question anyway.
how would you go about implementing the thing itself? As in, i need to update the database table for the users who have posted on the topic page when the topic page is viewed?

Navigation

[0] Message Index

[#] Next page

Go to full version