Private author.php
-
I’m working on using WP to act as a “client site” for a doggie daycare. Users register with a lot of personal info (address, phone #, etc.). I then have them adding “dog profiles” as posts with custom field inputs. One post per single dog.
To display the user’s info and their dogs’ “profiles” on one screen, I’ve coded a custom author.php that outputs all of the custom field stuff I’ve added to profiles and posts (renamed to “dogs”) on the author archive URL. What I need is to make the entire content of author.php only viewable if the user is logged in and viewing their OWN author archive. For example, if I’m logged in as “userA”, I’d see nothing (or some sort of “you are not authorized to view this content” message) if I somehow navigated to:
http://www.somedoggiedaycare.com/archives/author/userB
UserB would be the only user of the “author” level able to see the content spit out by that URL.
I’m not quite sure how to accomplish this. I’m thinking it will have something to do with conditionals, but I tried retrofitting some code meant to add an “edit profile” link to the author archive screen if it was the archive of the logged in user, and I kept getting errors due to the code getting confused with the post loop’s if/else statements.
Any help appreciated!
- The topic ‘Private author.php’ is closed to new replies.