Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Re: [davidnavigator] indicating posted thread

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
Subject Author Views Date
Thread indicating posted thread davidnavigator 5591 May 3, 2004, 5:05 AM
Post Post deleted by agaffin
agaffin 5438 May 3, 2004, 7:54 AM
Thread Re: [davidnavigator] indicating posted thread
Jagerman 5439 May 3, 2004, 4:15 PM
Post Re: [Jagerman] indicating posted thread
davidnavigator 5442 May 4, 2004, 2:56 PM
Thread Re: [Jagerman] indicating posted thread
sangiro 5395 May 5, 2004, 11:12 AM
Thread Re: [sangiro] indicating posted thread
Jagerman 5388 May 5, 2004, 12:22 PM
Thread Re: [Jagerman] indicating posted thread
sangiro 5385 May 5, 2004, 1:27 PM
Thread Re: [sangiro] indicating posted thread
Jagerman 5418 May 5, 2004, 2:10 PM
Post Re: [Jagerman] indicating posted thread
sangiro 5335 Aug 5, 2004, 12:36 PM