0

How would you to post the 'last time viewed' or the 'last time modified' for a matrix row. Not just the whole entry but specific to Matrix. I also need this to appear in the Cpanel and not on the front end.

EDIT

So I updated this and am just using a form to update the Matrix Row when I click on the link to view the proof image.

Unfortunately it is not updating the row. Below is my code:

{exp:channel:entries channel="projects" entry_id="{last_segment}"}
                        <h2>{title}</h2>
                        <ul class="buttons">
                            {project_proof}
                                {if proof_file}
                                <li>
                                    {exp:channel:form
                                        channel="projects"
                                        entry_id="{last_segment}"
                                        return="images/uploads/proofs/{proof_file:filename}.{proof_file:extension}"
                                    }

                                    <input type="hidden" name="field_id_77[row_id_{row_id}][col_id_19]" value="{current_time format='%F %d, %Y - %g:%i:%s'}" />
                                    <button class="button" type="submit">View details</button>

                                    {/exp:channel:form}

                                </li>
                                {/if}
                            {/project_proof}
                                <li><a class="button" id="submitChanges">Submit changes</button></a></li>
                        {/exp:channel:entries}

Thanks!

3
  • Are you just editing in the Cpanel, or are you editing with Channel Forms on the front end? – Johann Dyck Dec 2 '13 at 9:54
  • Just editing in cpanel. I have a matrix custom field that i want to show the timestamp of when an image in that row was last viewed. – prosborne Dec 3 '13 at 4:58
  • Just kidding. After reading your post I realized that was the best way of doing it, so yes, I am using channel forms – prosborne Dec 7 '13 at 17:07
2

It looks like to view it, the user is submitting the form ...

When you want to update something specific in a Matrix row, I think you have to call the row first, like:

<input type="hidden" name="matrix_field_name_here[row_order][]" value="row_id_{row_id}">

If I remember right, you have to redo any other columns in the whole Matrix table or it update all of those to be blank. All the other columns can be preloaded and hidden.

But it looks like you are setting up something where you trust the users that would access this page. But if you are allowing anyone to basically update your entry by clicking a view button, someone could change the source of these hidden inputs and actually be able to overwrite more than just the "latest view" cell.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.