Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

indicating posted thread

Quote Reply
indicating posted thread
One of your competitors has a feature that I'd like to reproduce, but I don't know if it's possible.
When viewing a list of threads, currently there is a icon that indicates their status, moved, hot, new post etc. This other board additionally indicates if I have posted anything to that thread. Would this be possible to do in GF ?
Post deleted by agaffin In reply to
Quote Reply
Re: [davidnavigator] indicating posted thread In reply to
Yes, it would be possible by using a global; the following should do the trick:

Code:
sub {
my ($post, $root, $current_user) = @_;
$root ||= $post;
return { user_contributed => 0 } unless $current_user;
my $contributed = $DB->table('Post')->count({ post_root_id => $root, user_id_fk => $current_user })
|| $DB->table('Post')->count({ post_id => $root, user_id_fk => $current_user });
return { user_contributed => $contributed ? 1 : 0 };
}

Then, in your template, simply do something like:

Code:
<%global_name($post_id, $post_root_id, $current_user_id)%>
<%if user_contributed%>... HTML here to display the icon ...<%endif%>

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] indicating posted thread In reply to
Many thanks, works a treat
Quote Reply
Re: [Jagerman] indicating posted thread In reply to
Jason,

I tried to give the users the option to switch this feature on or off. Created a column for them to set a yes/no value and wrapped your code like this:

Quote:
<%if user_thread_mark eq Yes%>

<%contributed($post_id, $post_root_id, $current_user_id)%>
<%if user_contributed%>
<img src="<%image_url%>/check_posted.gif" border="0" width="13" height="15">
<%endif%>

<%endif%>

This seems to casue some threads to be marked and others not. Completely inconsistent. Any idea why that is?

Safe swoops
Sangiro

Last edited by:

sangiro: May 5, 2004, 11:41 AM
Quote Reply
Re: [sangiro] indicating posted thread In reply to
I tried this out, and it seems to be working for me - where did you add the global?

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] indicating posted thread In reply to
Added the global to the forum_view template. Works fine when I remove the <if> statement that I've put around it. Once I add that back in to check to see if the user has this turned on, then things become erratic.

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] indicating posted thread In reply to
Try changing:

<%if user_thread_mark eq Yes%>

to:

<%if current_user_thread_mark eq Yes%>

Otherwise, user_thread_mark will be the value for the user who posted; current_user_* are the values for the currently-logged in user.


Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] indicating posted thread In reply to
Jason,

Can you tell me how resource heavy this feature is? I implemented it and had some resource issues so I switched it off again. There were some other things going on at the time as well. Now I'm not certain if this contributed to my resource issues. I don't want to switch this back on just to switch it off again...

Thoughts?

Safe swoops
Sangiro