Firefox PHP

Topic Poll Module

Posted by Maurice Makaay 
Re: Topic Poll Module
October 11, 2010 05:38PM
The list page does not use the read hook, so it will not work from there indeed. The whole module was not designed for running it from the list page.

You can try and copy the info.txt line where the hook "read" is setup to another line, where you change "read" to "list" (only for the hook name, not for the hook function). No promise that this will work though, since I'm not sure if the poll form carries enough information to tell the module for what message a poll vote is done.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Topic Poll Module
October 11, 2010 05:56PM
Ya I tried to do this:

hook: read|phorum_mod_topic_poll_read
hook: list|phorum_mod_topic_poll_read

I'm not sure if this is even possible, but it didn't work anyway. I can try just hook: list|phorum_mod_topic_poll_read and see what happens.
Re: Topic Poll Module
October 11, 2010 06:04PM
Quote
Maurice Makaay
No promise that this will work though, since I'm not sure if the poll form carries enough information to tell the module for what message a poll vote is done.

You make a very good point here. I like Phorum as is, but I really want it to have a facebook feel to it; posts with message bodies and options as soon as the site loads up. I've already made progress on this, but the whole voting feature is absolutely necessary to the functionality of my website. I've gotta make this happen.
Re: Topic Poll Module
October 11, 2010 08:52PM
Ok, so I got it doing something, but you're right. No matter which poll I vote for on the page, the vote counts for the poll on the first message.

I have a theory for making image buttons work. It sends xy coordinates to post like you said. I'm going to turn each option into it's own form with it's own hidden values, the values required for phorum_mod_topic_poll_read($messages) to run correctly. I'll report back.

It worked. Now I have to figure out what values to pass to phorum_mod_topic_poll_read so that it knows which post is being voted on. Also...whenever I click preview, it comes up with some sort of hack warning...



Edited 2 time(s). Last edit at 10/11/2010 09:33PM by Meadock.
Re: Topic Poll Module
October 12, 2010 03:22AM
Separate forms? That can be done easier. You really just need to strip the coordinates at the module side. But if this works for you just as well, then good for you.

You might try changing action="" to action="{MESSAGES->URL->READ}" in the voting form template. That URL should contain all necessary variables for the poll module. You be redirected to the read page after voting when doing this.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Topic Poll Module
October 12, 2010 04:30PM
I just figured I'd try avoiding editing the server side code and stick to the template as much as possible. What I found the problem with image buttons is that they don't send a value to $_POST. All it sends is the coordinates of the click. This site has a list of valid settings for the image button: [www.echoecho.com]. No value setting. Thank you for the action tip. I will try it.
Re: Topic Poll Module
October 22, 2010 08:31PM
Alright just got a chance to try action="{MESSAGES->URL->READ}" and it didn't work. The data doesn't exist in voting_form. I ran print_r on the PHORUM data array and really couldn't find anything I could use to construct the urls necessary for the vote to go to the correct message. Am I missing something or will this involve some hacking on the server side code for topic poll? Thanks.
Re: Topic Poll Module
October 23, 2010 05:35AM
I guess that you're out of luck on this one then. I the read URL doesn't work, then I don't think that you can get this to work without implementing specific functionality for doing voting on the list page.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Topic Poll Module
October 24, 2010 11:47PM
Ok, good to know. I'll see what I can do about it. Thanks.
Re: Topic Poll Module
October 26, 2010 12:04AM
Alright, I'm having trouble figuring out how to get the required data for the Read URL; message_id and what not. I've been going over List.php and it appears message_id and the like are obtained from the $row array by a string replace statement. $row is an array obtained from $rows. $rows comes from phorum_db_get_thread_list($offset, $bodies_in_list). So I'm wondering, do I need to execute a phorum_db_get_thread_list statement to get the data I require in this mod or is there an easier/more efficient way of doing it? I just don't understand why the message data isn't in $GLOBALS["PHORUM"]["DATA"] or $PHORUM["DATA"] in topic_poll.php.

What I'm currently trying to do is add the required data straight into the template. I'd like to avoid editting topic_poll.php to make updating the mod possible without undoing my modification to the mod, assuming topic poll will be updated in the future. In order to get the data I need, do I have to modify topic_poll.php?

I greatly appreciate any thoughts on this subject. I'll continue to work on it in the meantime. Thank you.
Sorry, only registered users may post in this forum.

Click here to login