allow comments on bug tracker
Posted: 26 December 2008 05:19 AM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  267
Joined  02-14-2008

I’m working on a bug tracker as described by Lisa Wess.

However, it hasn’t been divulged how you would go about allowing only the author and admin comment on a raised bug.

Has anyone taken it this far?

Profile
 
 
Posted: 26 December 2008 11:12 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  24513
Joined  05-20-2002

Let’s see- entries are simply weblog entries.  So an easy way- I’d use an embed to include the comment form- nest it inside the weblog tag- conditionally embed it only if the author_id is the same as the logged in member id OR group_id==1 (or whatever ids your admins have).  Not as ironclad as checking during the actually submission (which wouldn’t be particularly hard using a hook/extension), but I suspect it would do the trick in most situations. 

Make sense?

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 27 December 2008 02:52 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  267
Joined  02-14-2008

would

{if author_id == logged_in_username}
{embed
="inc/.bugreply"}
{
/if}

work? Can’t see too many examples of this type of conditional.

Profile
 
 
Posted: 27 December 2008 05:18 AM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRank
Total Posts:  2474
Joined  01-07-2008

That should work, except that you need to compare an id to an id (you’re doing id-username).

So something along these lines:

{if author_id == logged_in_member_id}
    {embed
="inc/.bugreply"}
{
/if}

That still leaves you with the check for group id, which should be similar.  As Robin mentions, this isn’t foolproof since you’re just hiding the form and not actually checking on submission.  So if someone works out the submission url they can (in theory) still post.  If this isn’t mission critical it probably isn’t a problem though.

 Signature 
Profile
MSG
 
 
Posted: 27 December 2008 04:59 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  267
Joined  02-14-2008

Hmmm - no joy with that.

The existing bugs are ones that I’ve created yet the comment form doesn’t appear.

Profile
 
 
Posted: 27 December 2008 08:12 PM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  267
Joined  02-14-2008

after more searching I found that entry_author_id isn’t available to me at that point.

Robin, you stated elsewhere about:

php parsed on output to set the author_id- then embed and pass that variable as an embed- could put just the comment form or the comment entries and form on the embedded template.

how would I go about that?

Profile
 
 
Posted: 29 December 2008 08:12 AM   [ Ignore ]   [ # 6 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  24513
Joined  05-20-2002

If you definitely prefer the php?  (And sometimes you might, for easy placement.)  It’s basically just putting

<?php $a_id = '{author_id}'; ?>

Inside the weblog tag.  At which point, you’ve got a php variable $a_id you could pass as an embed variable, use as a conditional, etc.

On the flip side- the conditional inside the weblog tag should be workable- just a bit quirky due to some parse order issues.  This worked for me in a quick test:

{exp:weblog:entries limit="1"}
<h3>{title} = {author_id} : '{logged_in_member_id}' </h3>
{if logged_in_member_id == author_id OR logged_in_group_id == 7}
{embed
="site/test2}
{/if}
{/exp:weblog:entries}

But either approach should be fine for the display issue.

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 77568 Total Logged-in Users: 40
Total Topics: 101557 Total Anonymous Users: 26
Total Replies: 544401 Total Guests: 258
Total Posts: 645958    
Members ( View Memberlist )
Newest Members:  ColeJLinskitnealsemperjrawhallshiusbozzlynobluffkatiejameshsmith101dddougal