Forums / Setup & design / problem with forum in my own site

problem with forum in my own site

Author Message

Alessandro Cipriani

Thursday 18 March 2004 8:15:57 am

hi all
i created a forum in my site, copying the forum, forum_topic, forum_reply classes from the forum demo package and linking the proper templates.
in this way i had the same 3 classes of the demo site, but with different classid. in particular:
- the forum class id is 31 (in the demo site was 20)
- the forum_topic class id is 32 (in the demo site was 21)
- the forum_reply class id is 33 (in the demo site was 22)

when i tried to insert a new topic in a forum i got a permissio denied error, then i noticed that in the forum.tpl file there was a kind of reference to the class 21 here:
"<input type="hidden" name="ClassID" value="21">"
i tried to change "value="21"" to "value="32"" (the real forum_topic classID) and it worked.

My problem is that when i insert a new topic by pressing the post button no topic is really added to the forum, while creating a new one in the administration section works perfectly.
Anyone got a solution?

best regards
alessandro

Alessandro Cipriani

Friday 19 March 2004 1:57:03 am

i thought it was a permission error, but i checked the forum demo site at
http://demo.ezpublish.no/forum, created a user group with the same user roles as my site and there everithing is ok...
if anyone could help please!!
icq 326457502

best regards
alessandro

Paul Forsyth

Friday 19 March 2004 2:41:24 am

if i remember correctly you need to check through all of the forum templates for other class references, and change them to your own. you mention one such reference but there are more:

http://ez.no/community/bug_reports/demo_forum_templates_should_not_contain_hard_coded_node_and_class_ids
http://ez.no/community/bug_reports/forum_package_should_contain_correct_role_info

hope this helps,

paul

Alessandro Cipriani

Friday 19 March 2004 3:24:11 am

hi paul,
your answer helped, because now i'm sure i've pointed the real problem.
anyway my problem isn't resolved
in forum.tpl i modified al the class references and this allowed me to get the edit_forum_topic form.
now here is the problem: data are not stored!
any advice?

alessandro

Paul Forsyth

Friday 19 March 2004 3:31:26 am

Did you update the class ids in the other templates?

Alessandro Cipriani

Friday 19 March 2004 3:49:11 am

i didn't find any class id in edit_forum_topic file
anyway below there are the two file's codes:

forum.tpl:

{let child_list=fetch('content','list',hash( parent_node_id, $node.node_id,
limit, 20,
offset, $view_parameters.offset))
child_count=fetch('content','list_count',hash(parent_node_id,$node.node_id))}

<h1>{$node.name}</h1>

{attribute_view_gui attribute=$node.object.data_map.description}

<div class="selectedsearch">
<form action={"/content/search/"|ezurl} method="get">
<input class="searchbox" type="text" size="8" name="SearchText" id="Search" value="" />
<input class="button" name="SearchButton" type="submit" value="Search this forum" />
<input type="hidden" name="SearchContentClassID" value="33" />
<input type="hidden" name="SubTreeArray[]" value="{$node.node_id}" />
</form>
</div>

<form method="post" action={"content/action/"|ezurl}>

{switch match=$node.object.can_create}
{case match=1}
<div class="buttonblock">
<input class="button" type="submit" name="NewButton" value="New topic" />
<input type="hidden" name="ContentNodeID" value="{$node.node_id}" />
<input type="hidden" name="ContentObjectID" value="{$node.contentobject_id.}" />
<input class="button" type="submit" name="ActionAddToNotification" value="Keep me updated" />
</div>
{/case}
{case match=0}
<p>
You need to be logged in to get access to the forums. You can do so <a href={"/user/login/"|ezurl}>here</a></p>
{/case}
{/switch}
<input type="hidden" name="NodeID" value="{$node.node_id}" />
<input type="hidden" name="ClassID" value="32" />

</form>

parte la table
<div class="forum_level3">
<table class="forum" cellspacing="0">
<tr>
<th>
{"Post"|i18n("design/forum/layout")}
</th>
<th>
{"Author"|i18n("design/forum/layout")}
</th>
<th>
{"Replies"|i18n("design/forum/layout")}
</th>
<th>
{"Last reply"|i18n("design/forum/layout")}
</th>
</tr>

{section name=Child loop=$child_list sequence=array(bglightforum,bgdarkforum)}
<tr class="{$Child:sequence}">
<td class="post">
<p>
{section show=$Child:item.object.data_map.sticky.content}<img src={"sticky_icon-red.gif"|ezimage} height="20" width="20" align="middle" alt="" />{/section}
<a href={$Child:item.url_alias|ezurl}>{$Child:item.object.name|wash}</a>
</p>
</td>
<td class="author">
<p>
{$Child:item.object.owner.name|wash}<br />
<span class="forumdate">({$Child:item.object.published|l10n(shortdatetime)})</span>
</p>
</td>
<td class="replies">
<p>
{fetch('content','tree_count',hash(parent_node_id,$Child:item.node_id))}
</p>
</td>
<td class="lastreply">
{let last_reply=fetch('content','list',hash(parent_node_id,$Child:item.node_id,sort_by,array(array('published',false())),limit,1))}
{section name=Reply loop=$Child:last_reply show=$Child:last_reply}
<p class="lastreply">
Last reply: <a href={concat($Child:Reply:item.parent.url_alias,'#msg',$Child:Reply:item.node_id)|ezurl}>{$Child:Reply:item.name|wash}</a><br />
<span class="date">({$Child:Reply:item.object.published|l10n(shortdatetime)})</span> by <span class="author">{$Child:Reply:item.object.owner.name|wash}</span>
</p>
{/section}
{/let}
</td>
</tr>
{/section}
</table>
</div>

<form method="post" action={"content/action/"|ezurl}>

{switch match=$node.object.can_create}
{case match=1}
<div class="buttonblock">
<input class="button" type="submit" name="NewButton" value="New topic" />
<input type="hidden" name="ContentNodeID" value="{$node.node_id}" />
<input type="hidden" name="ContentObjectID" value="{$node.contentobject_id.}" />
<input class="button" type="submit" name="ActionAddToNotification" value="Keep me updated" />
</div>

{/case}
{case match=0}
<p>
You need to be logged in to get access to the forums. You can do so <a href={"/user/login/"|ezurl}>here</a></p>
{/case}
{/switch}
<input type="hidden" name="NodeID" value="{$node.node_id}" />
<input type="hidden" name="ClassID" value="31" />

</form>

{include name=navigator
uri='design:navigator/google.tpl'
page_uri=concat('/content/view','/full/',$node.node_id)
item_count=$child_count
view_parameters=$view_parameters
item_limit=20}

{/let}

_________________________________

editforumtopic:

{concat("/content/edit/",$object.id,"/",$edit_version,"/",$edit_language|not|choose(array($edit_language,"/"),''))}
<form enctype="multipart/form-data" method="post" action={concat("/content/edit/",$object.id,"/",$edit_version,"/",$edit_language|not|choose(array($edit_language,"/"),''))|ezurl}>
<h1>{"Edit %1 - %2"|i18n("design/standard/content/edit",,array($class.name|wash,$object.name|wash))}</h1>

{include uri="design:content/edit_validation.tpl"}

<input type="hidden" name="MainNodeID" value="{$main_node_id}" />

<div class="block">
<label>{"Subject"|i18n("design/forum/layout")}</label>
{attribute_edit_gui attribute=$object.data_map.subject}
</div>

<div class="block">
<label>{"Message"|i18n("design/forum/layout")}</label>
{attribute_edit_gui attribute=$object.data_map.message}
</div>

<div class="block">
<label>{attribute_edit_gui attribute=$object.data_map.notify_me_about_updates} Notify me about updates</label>

{let user_group_array=$object.current.creator.parent_nodes
show_sticky_group_array=ezini('StickyGroup','GroupID','forum.ini')
show_sticky=false()}

{section loop=$user_group_array}
{section show=$show_sticky_group_array|contains($:item)}
{set show_sticky=true()}
{/section}
{/section}

{section show=$show_sticky}
<label>{attribute_edit_gui attribute=$object.data_map.sticky} Sticky</label>
{section-else}

{/section}

{/let}
</div>

<div class="buttonblock">
<input class="button" type="submit" name="PreviewButton" value="{'Preview'|i18n('design/standard/content/edit')}" />
<input class="button" type="submit" name="DiscardButton" value="{'Discard'|i18n('design/standard/content/edit')}" />
<input class="defaultbutton" type="submit" name="PublishButton" value="{'Post'|i18n('design/standard/content/edit')}" />
</div>

</form>

Paul Forsyth

Friday 19 March 2004 3:59:06 am

If you look at the three files i link to in the bug report there are hard coded node and class ids. I should have mentioned node ids ealier. Note, i dont mention 'edit_forum_topic'.

Alessandro Cipriani

Friday 19 March 2004 4:05:21 am

paul
i know you never mentioned edit_forum_topic
do you think that my problem is in the files you mentioned?
to store the new topic do i use the file you mentioned or only forum and edit_forum_topic?

best regards
alessandro

Paul Forsyth

Friday 19 March 2004 4:29:28 am

I seem to remember having a similar problem but the solution escapes me. Do you have debugging on? After you have submitted your edit can you find the item in the admin interface?

paul

Alessandro Cipriani

Friday 19 March 2004 5:18:49 am

in the admin interface i don't see anything. for that i'm sure nothing is stored in the db.
the debug doesn't return nothing. only
"Error: EzTemplate @ design/corporate/override/templates/forum.tpl:62[4]
no such attribute for array(3):sticky
Choose one of following: name, description, image
"

i'm quite desperate...

Paul Forsyth

Friday 19 March 2004 5:36:20 am

There should be a content object for the forum topic. If you are in the edit view when creating a new topic you are creating a new content object. the id for that object should be in the url, like 'content/edit/95/1', where 95 is the content object id, should help you find the object in your admin structure.

But, im not sure what else to suggest. :(

paul

Lars Imsland

Friday 19 March 2004 6:54:57 am

Hi Alessandro,

Following your hint about the hard-coded class-references, I actually got it to work ("it" being adding a forum to my pages (based on a "plain" installation), by copying the forum templates one by one).

I still have some problems (like that the URL in the confirmation mail is wrong), but I'm working on that (or will ask in another tread). But I can register a user (without using the admin pages), and this user can post to the forum.

A problem that stopped me for a while, was that I had to assign the "guest accounts" to the "guest" role. (I thought it was so obvious that it had to be that way, that I didn't check in the beginning).

I also made some changes to the "user" class, since they were different. I don't know how critical this was.

Alessandro Cipriani

Friday 19 March 2004 7:42:21 am

hi lars
i'm happy you resolved something following my hints
now i hope i can resolve my problems to! :)
as you read, i'm still not able to make this forum work... i don't know why but no topics are stored in my db...

cheers
alessandro

Lars Imsland

Friday 19 March 2004 11:42:48 pm

Alessandro,

Another thing I did, was changing the "forum" class, since I noticed the original class was different than the one in the forum package. Can this be a reason?

Paul mentioned the bug report about correct role settings:
http://ez.no/community/bug_reports/forum_package_should_contain_correct_role_info

Could someone give the correct role settings for a forum? Using the ones I have now, it works somehow, but I'm pretty sure they are not correct.

Alessandro Cipriani

Monday 22 March 2004 12:22:24 am

lars,
i copied the 3 classes from the demo forum package...
it would be important to know where is placed the function that stores the new topic into the db

cheers
alessandro

Alessandro Cipriani

Monday 22 March 2004 12:35:45 am

another thing i noticed:
the fetch function in the original forum.tpl was

let child_list=fetch('content','list',hash( parent_node_id, $node.node_id,
limit, 20,
offset, $view_parameters.offset,
sort_by, array( array( attribute, false(), 190 ), array(published,false()))))

but i was not able to see any topic of this forum (while in the admin interface i was...)

only once i deleted the row
"sort_by, array( array( attribute, false(), 190 ), array(published,false()))" i've been able to see the topics...

could this be linked to my problem?
best regards
alessandro

Alessandro Cipriani

Monday 22 March 2004 2:14:11 am

Attention my friends!!
i've noticed a new, important thing:

if i edit a new forum topic logged as administrator (not in the administration interface!) i'm the topic IS inserted into the forum!!
while if i set the SAME policies to the guest group (* * *) the topic isn't inserted into the forum!!!

please help me!!!!!
alessandro

Lars Imsland

Monday 22 March 2004 11:21:27 am

Hi Alessandro,

In the line

sort_by, array( array( attribute, false(), 190 ), array(published,false()))))

190 refers to the "sticky" attribute in the forum_topic class (so that "sticky" posts comes first). Change this to the value in your class.

To your last post: As I mentioned earlier, are you sure that you have assigned your "guest accounts" user group to the "Guest" role?

Alessandro Cipriani

Tuesday 23 March 2004 12:38:45 am

hi lars
thank you for the advices!
ok, i changed "190" to "251" (the id of the sticky attribute) and then worked.
the only thing still doesn't work is to store the topic written by other users (not administrator)

i have my user belonging to the guest accounts
the guest role is related the guest accounts and all the policies are enabled (* * *) exactly as the admin role (the can do anything to any class in any section etc).

i'm quite desperate, because i get this strange behavior!
if you can/want you can contact me at icq# 326457502

Alessandro Cipriani

Tuesday 23 March 2004 1:00:08 am

another question:
in my forum.ini file i have:
[StickyGroup]
GroupID[]=13

what is stickygroup?
is it another hardcoded reference i must change?
cheers
alessandro