[wp-hackers] is there a way to make sure that a shortcode can be used only by certain userroles?

Jesse Friedman highfive at jesserfriedman.com
Tue Nov 12 20:08:17 UTC 2013


You could filter the content when the post is saved and if the user doesn't
have the right permissions, then I strip the shortcode or present a warning.

you could try using
http://codex.wordpress.org/Plugin_API/Filter_Reference/content_save_pre,
then maybe some regex to find the shortcode and strip it out


On Tue, Nov 12, 2013 at 2:57 PM, Haluk Karamete <halukkaramete at gmail.com>wrote:

> What I mean by that is that is this...
>
> let's say there is an admin-editors-only shortcode. let's call it "xyx"
> shortcode for the sake of an example.
>
> is it possible to have a contributor or author to not to be able to use
> that shortcode? they all get stopped with a warning that the post cannot be
> saved (or created)  because it contains the "xyx" shortcode!
>
> to cover all the possibilities (such as posting thru email, or thru some
> other esoteric ways) , what is the best hook(s) that I need to watch out so
> that there are no loop holes left...
>
> I hope it was clear and did not confuse you...
> thank you
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
thanks

*jesse friedman*
jes.se.com
Book: Web Designers Guide to WordPress -
http://wdgwp.com/onamazon<http://wdgwp.com/onamazon>
Twitter: @professor <http://twitter.com/professor>
Facebook: Like<https://www.facebook.com/pages/Jesse-Friedman/204793299545174>


More information about the wp-hackers mailing list