Disable matrix cells based on member group & changing entry author.
Posted: 14 September 2010 05:43 PM   [ Ignore ]
Wallflower
Rank
Total Posts:  5
Joined  2010-08-31

Short question first:
Is there a way to override the entry author?
I want the Super Admin account to be able to set/edit the entry author. 


Other question:
I was hoping to be able to disable matrix cells based on member group.
Super admin would have complete visibility of the matrix cells while other users would only see specific fields.

What I am trying to achieve is to have users create service request via saef. If an order is completed over the phone it is entered by a super admin who associates that entry with that users account - by changing the author of the entry.
The matrix has a couple of fields where files are added and states are changed etc… some visible to the client, others not.

I am away from my work computer, so I don’t have any code that I can put up to help explain at this time.

Profile
 
 
Posted: 14 September 2010 05:58 PM   [ Ignore ]   [ # 1 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29
greendesigned_ - 14 September 2010 05:43 PM

Short question first:
Is there a way to override the entry author?
I want the Super Admin account to be able to set/edit the entry author.

There’s no {author}-type tags (yet), but you can create your own form input to set the author_id:

<input type="text" name="author_id" value="2" /> 
Profile
 
 
Posted: 14 September 2010 06:08 PM   [ Ignore ]   [ # 2 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29
greendesigned_ - 14 September 2010 05:43 PM

I was hoping to be able to disable matrix cells based on member group.
Super admin would have complete visibility of the matrix cells while other users would only see specific fields.

Here’s some JS to get you started:

/* function to remove a matrix column */
function remove_matrix_col(col_id{
    
$('#your_matrix_field_name thead th').eq(col_id).hide();
    $(
'#your_matrix_field_name tbody tr').each(function(){
        
$(this).children('td').eq(col_id).hide();
    
});
}
$(document).ready(function(){
    {if logged_in_group_id 
== 5}
    
/* remove second column */
    
remove_matrix_col(1);
    
/* bind to the add row button */
    
$('#your_matrix_field_name .matrix-btn').click(function(){
        remove_matrix_col
(1);
    
});
    
{/if}
}
); 
Profile
 
 
Posted: 15 September 2010 04:34 AM   [ Ignore ]   [ # 3 ]
Wallflower
Rank
Total Posts:  5
Joined  2010-08-31

I ended up using the query module to grab the members…

<select name="author_id">
    
{exp:query sql="SELECT screen_name, member_id FROM exp_members"}
    
<option value="{member_id}">{screen_name}</option>
    
{/exp:query}
</select

And the JS worked well…  thanks so much.
Thanks Rob…  I really appreciate the quick response!

[ Edited: 15 September 2010 10:54 AM by greendesigned_ ]
Profile