Hi. First of all, you don’t need “logged=in” if you’re using pp_group=”12″ or the level=”whatever” attributes. Only those specified in pp_group= or level= will be able to see the content, so logged out users are excluded as well. Just for the record.
HTML doesn’t allow you to put code in between table-row tags like that, which is why WordPress is moving the eyesonly shortcode out of the table. It knows it doesn’t belong where you’re putting it. Here’s what you can do. Put the shortcodes inside the TD tags and do one shortcode to show to your PP group, and one shortcode to hide content from that same PP group:
<table>
<tr>
<td>[eyesonly pp_group="12"]Content for Group 12[/eyesonly][eyesonly pp_group="12" hide="yes"]Content for everyone else.[/eyesonly]</td>
<td>[eyesonly pp_group="12"]Content for Group 12[/eyesonly][eyesonly pp_group="12" hide="yes"]Content for everyone else.[/eyesonly]</td>
</tr>
</table>
That will work fine.
Thanks for the prompt reply!
I understand your solution but I’m trying to avoid presenting empty rows/cells in a table with multiple rows.
If I have a table with 20 potential rows and wish to display only rows 5 10 and 13 to a certain group, I would preferably like to present a table with only 3 rows instead of a 20 row table with 17 redacted rows.
Do you have any creative workaround for that?
Thanks again for the quick engagement.
Well, depending on how sensitive the info is in the table-row that you’re restricting, CSS may or may not be a solution for you. But you can apply two classes to the TR element and then follow up your HTML with some inline styles, where one of the two classes is defined inside eyesonly tags, like this:
<table>
<tbody>
<tr class="hide-default ppgroup-twelve-show">
<td>Stuff only for PP Group 12</td>
</tr>
<tr>
<td>Stuff for everyone</td>
</tr>
</tbody>
</table>
<style><!--
.hide-default {display:none;}
[eyesonly pp_group="12"]
.ppgroup-twelve-show {display:inherit!important;}
[/eyesonly]
--></style>
Alternatively, you can just create two completely different tables, and hide one of them from pp_group 12 and show the other one only to pp_group 12. It’s a bit clunkier, but it’s really just copy/paste work.
No worries. Let me know if you need any further help.