document shortcode for private documents

220 views
Skip to first unread message

gamerc...@gmail.com

unread,
Jul 29, 2012, 9:47:21 AM7/29/12
to wp-documen...@googlegroups.com
I need to leave all my documents private, and have used Members to create roles, as well as Advanced Custom Fields to create a "Document type" (radio button: Class, contact list, goals and requirements, recipes, rituals, syllabus and misc)

I want a way to list all the documents like so:

Document type      Roles        Document name

then have all the Class documents listed (alphabetical by name, with the roles column listing the roles that have access.

What's the best way to do this?

Benjamin J. Balter

unread,
Jul 29, 2012, 6:36:40 PM7/29/12
to wp-documen...@googlegroups.com
There is no way to implement this functionality out of the box, but it would be trivial to do so using the `get_documents()` function via a shortcode. You should be able to query via the post_meta field (document type). The only tricky part would be reverse querying for the roles associated with that document. The easiest way may be to loop through each roll and just do a capability check against the document. Either way, there's going to be a bit of coding involved here.

Hope that helps,
- Ben



--
You received this message because you are subscribed to the Google Groups "WP Document Revisions" group.
To view this discussion on the web visit https://groups.google.com/d/msg/wp-document-revisions/-/7jFHEd1QNIYJ.
To post to this group, send email to wp-documen...@googlegroups.com.
To unsubscribe from this group, send email to wp-document-revi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/wp-document-revisions?hl=en.

gamerc...@gmail.com

unread,
Jul 30, 2012, 7:20:14 PM7/30/12
to wp-documen...@googlegroups.com
Is there a guide for the clueless on how to call this from within a shortcode or on how to query against roles? Never coded anything for WP before, not sure where to get docs on how to even begin.


On Sunday, July 29, 2012 6:36:40 PM UTC-4, Benjamin Balter wrote:
There is no way to implement this functionality out of the box, but it would be trivial to do so using the `get_documents()` function via a shortcode. You should be able to query via the post_meta field (document type). The only tricky part would be reverse querying for the roles associated with that document. The easiest way may be to loop through each roll and just do a capability check against the document. Either way, there's going to be a bit of coding involved here.

Hope that helps,
- Ben

Aaron Jorbin

unread,
Jul 30, 2012, 7:29:52 PM7/30/12
to wp-documen...@googlegroups.com
There is no single unified guide for this, however there are a handful of docs that should help you 


For the get_documents function, checkout the source code and inline documentation- https://github.com/benbalter/WP-Document-Revisions/blob/master/wp-document-revisions.php#L1470

For the roles, http://codex.wordpress.org/Roles_and_Capabilities is a good overview. http://codex.wordpress.org/Function_Reference/current_user_can is the function you use to check if a current user has a specific capability (I'm guessing read_private_documents will be the capability you are most interested in, but https://github.com/benbalter/WP-Document-Revisions/blob/master/wp-document-revisions.php#L1228 has all of them that WP Document Revisions adds).

I hope that helps.


http://aaron.jorb.in
twitter: twitter.com/aaronjorbin


--
You received this message because you are subscribed to the Google Groups "WP Document Revisions" group.

ericap...@gmail.com

unread,
Jan 18, 2015, 12:55:12 PM1/18/15
to wp-documen...@googlegroups.com, gamerc...@gmail.com

Buy your high quality real or fake passport,(fani...@gmail.com) Counterfeit Bills,Real and Fake Driver’s licenses, ID cards, visas, stamps, diploma, certificates, degrees, citizenship and other products for a number of countries like: USA, Australia, Belgium, Brazil, Canada, Italy, Finland, France, Germany, Israel, Russia,Mexico, Finland,Netherlands ,South Africa,Spain,United Kingdom.Japan when producing; magnetic encoded strips and/or scan able bar-code. UV-spectrum analysis test standards,magnetic strip,

Watch video here for more details........... http://vimeo.com/82973635

Contact us............... fani...@gmail.com

Email.......................... fani...@yahoo.com

SKYPE US for quick chat …………….. fandena.fandena

SKYPE US for quick chat …………….. fandena.fandena

SKYPE US for quick chat …………….. fandena.fandena

Contact e-mails: fani...@gmail.com Technical support: fani...@gmail.com

Reply all
Reply to author
Forward
0 new messages