Firefox PHP

Topic Poll Module

Posted by Maurice Makaay 
Re: Topic Poll Module
August 07, 2009 11:19PM
The AMIPP forum is Phorum version 5.1.22 and has been running for some years now.
As the newish admin I would like to start a poll.
The forum had been hacked by a previous admin in various folders and files.
I understand that I need version 5.1.23 to use a poll.
How may I retain the appearance and content of the AMIPP forum and add a poll to it please?

Many thanks in advance

Mike
Re: Topic Poll Module
August 08, 2009 09:41AM
Quote
welshmike
The forum had been hacked by a previous admin in various folders and files.
I understand that I need version 5.1.23 to use a poll.
How may I retain the appearance and content of the AMIPP forum and add a poll to it please?

Hi Mike,

You should avoid hacks in the main code. Phorum is built is such a way that you can do everything using modules, then upgrading is a piece of cake.
My recommendation:
1. move all the hacks in one or several modules.
2. upgrade Phorum
3. install whatever module you want, such as the poll one, and keep putting your hacks in modules.

Cactus : [www.cactuspro.com]
Re: Topic Poll Module
October 07, 2010 11:46PM
I'm in the process of making poll display in a more compact form. I'd like to put it in the upper right hand corner of the posts. Do I need to use a different hook to get it up there? If so, what is it?
Re: Topic Poll Module
October 08, 2010 12:59AM
Why a different hook? The way in which the poll is put in the message is directed by a combination of HTML and CSS. You need to modify that to get a different output.

I am not sure if you can get things to work like you want it with only some CSS changes, but I would start out with making the poll smaller and letting it use float:right as a style to let it align to the right hand side.

If the HTML code is not providing enough handles to make the formatting do what you like, then you'll have to modify the HTML formatting code in topic_poll.php.

In the default output, there is a poll separator (a line that separates the two of them). This line is created by the mods/topic_poll/templates/emerald/body_and_poll_separator.tpl. You probably want to get rid of this separator. You can do so by copying the module's emerald template to a directory that uses the same directory name as your main template. Then you can modify the template files in your custom module template directory.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Topic Poll Module
October 08, 2010 05:14AM
I suppose I thought a different hook would put it in the "header" of the post messages. As it is now it's positioned below that and above the body of the message, pushing the message down quite a ways. I already have a template going and I made an attempt at it by setting it's positioning to relative. That didn't do much so I tried using negative top, left values but the overflow appears to be hidden and it doesn't do much about the textarea still being down so low. What if I absolutely positioned it? I suppose I just have to tinker around with it for a while. I just wanted to make sure there wasn't an easier way of going about it with hooks and what not. Thanks.
Re: Topic Poll Module
October 09, 2010 12:18AM
I'm not quite sure where the form is submitting the votes. There's nothing in the form action attribute. I've removed the radio buttons and replaced them with image submit buttons so that voting requires a single click. I need to know where this form is being submitted to so that I can modify the script to handle this change. At least that's what I think I'm suppose to do. Thanks!
Re: Topic Poll Module
October 09, 2010 01:14AM
An empty action means that the form is posted to the currently active URL. There's nothing special about that. But why do you need to know the action URL? You have to POST the data, so you need a form anyway. Why not fill a form variable with the correct value and trigger a post on the poll form?

Processing of the vote is done from the "read" hook in the poll module (function: phorummod_topic_poll_read)


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Topic Poll Module
October 09, 2010 03:01AM
I see. As you can probably already tell, I'm a novice programmer. I'm not use to the whole template system. I guess I just needed to see how the script handeled the vote to figure out what's wrong with my code. This is the major thing I changed in voting_form.tpl:

<table border="0" cellpadding="0" cellspacing="0">
{LOOP POLL->ANSWERS}
<tr>
<td valign="top">
<input type="image" name="topic_poll:vote"
src = "<?php echo($PHORUM["http_path"].'/mods/topic_poll/images/'); ?>{IF POLL->ANSWERS->ID "0"}bright_light_bulb.png{ELSEIF POLL->ANSWERS->ID "1"}light_bulb.png{/IF}"
alt = "{POLL->ANSWERS->ANSWER}"
title = "{POLL->ANSWERS->ANSWER}"
width = "30px"
height = "30px"
id="topic_poll_answer_{POLL->ANSWERS->ID}"
class="topic_poll_button"
value="{POLL->ANSWERS->ID}" />
</td>

</tr>
{/LOOP POLL->ANSWERS}
</table>

{POLL->ANSWERS->ID} is the value being passed through depending on which button you click. Am I doing this correctly?
Re: Topic Poll Module
October 09, 2010 10:58AM
The issue has little to do with templating. It's about HTML forms. Im you use an image based submit button, you might have to do some server-side work to get the correct value. Some browsers will include click coordinates in the field data, so you can determine server side where the image was clicked exactly. As a result, the value is not what the topic_poll module expects.

I didn't check, but this is the first thing that comes to mind. You might want to investigate the content of $_POST to see if my assumption is right. Check what $_POST["topic_poll:vote"] is set to. If there is coordinate data included in the value, then you'll have to strip that data before the topic poll module trips over it.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Topic Poll Module
October 11, 2010 11:27PM
So I think I figured out part of the problem. Voting doesn't work in list.php for some reason. Something to do with the hook? Is this easily correctable? Thank you for your help.
Sorry, only registered users may post in this forum.

Click here to login