Title: Shortcode only when user logged in
Last modified: June 14, 2017

---

# Shortcode only when user logged in

 *  Resolved [Brian](https://wordpress.org/support/users/raceybe/)
 * (@raceybe)
 * [9 years ago](https://wordpress.org/support/topic/shortcode-only-when-user-logged-in/)
 * Is there a hook available within the plugin that will prevent the presentation
   of the shortcode/buttons when a user is not logged in?
 * For example, in my scenario, after processing the charge, I hook in and use the
   payment description to automatically grant voting tokens based on how they pay.
   However, this makes use of the current user id. I would want the shortcodes/buttons
   to not be visible if a user is not logged in.
 * If this is not available now, is this something that could be added in the free/
   paid versions in the future? One option I suppose I could use now is adding a
   filter to the post content and searching for the shortcodes and removing them
   if a user isn’t logged in, but that would be a bit tricky I think.
 * Thanks again for the great plugin. I’m considering the pro version because it
   is so easy to work with. I would hope the pro version maintains this ease of 
   use.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Brian](https://wordpress.org/support/users/raceybe/)
 * (@raceybe)
 * [9 years ago](https://wordpress.org/support/topic/shortcode-only-when-user-logged-in/#post-9232270)
 * So I used an add filter to modify the shortcode output if a user is not logged
   in (and replaced it with text about logging in). It is a little clunky, but it
   works. Still, an associate between the logged in account and making payments 
   would be a very useful option.
 * Any comment?
 *  [Nick Young](https://wordpress.org/support/users/nickyoung87/)
 * (@nickyoung87)
 * [9 years ago](https://wordpress.org/support/topic/shortcode-only-when-user-logged-in/#post-9232815)
 * Sounds like you did what we would have suggested – a custom solution.
 * Not sure what we have on the roadmap as far as actually making that built into
   the plugin. But it is a great idea and I will mark it down for us to discuss.
 * Thanks for the feedback.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Shortcode only when user logged in’ is closed to new replies.

 * ![](https://ps.w.org/stripe/assets/icon-256x256.png?rev=2784844)
 * [Stripe Payment Forms by WP Simple Pay - Accept Credit Card Payments + Subscriptions with Stripe](https://wordpress.org/plugins/stripe/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/stripe/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/stripe/)
 * [Active Topics](https://wordpress.org/support/plugin/stripe/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/stripe/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/stripe/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Nick Young](https://wordpress.org/support/users/nickyoung87/)
 * Last activity: [9 years ago](https://wordpress.org/support/topic/shortcode-only-when-user-logged-in/#post-9232815)
 * Status: resolved