Title: Making shortcodes work &#8211; error in documentation
Last modified: May 19, 2022

---

# Making shortcodes work – error in documentation

 *  Resolved [parsec2](https://wordpress.org/support/users/parsec2/)
 * (@parsec2)
 * [4 years ago](https://wordpress.org/support/topic/making-shortcodes-work-error-in-documentation/)
 * Dear developers,
 * I came across an error in the documentation which really took me a few hours 
   to figure out what was going on. The result was that the shortcodes didn’t work
   for loggedin users.
 * I found the problem. The problem is that in your example
 * `[content_control roles=”subscriber,editor” logged_out=”0″ class=”custom-css-
   class” message=”You don’t have access to this.”]Logged in content[/content_control]`
 * the loggedout value is set to 0. In the code I found this on line 38 of the file
   Shortcodes.php
 * `$who = isset( $atts['logged_out'] ) ? 'logged_out' : 'logged_in';`
 * Basically this checks if the logged_out paramater is set and changes the value
   accordingly. The problem is when you set logged_out to 0 it is still set and 
   returns “logged_out” as a value.
 * The solution is; if you want to check if the user is logged_in; remove the logged_out
   parameter completely and it will return “logged_in”.
 * Other solution would be to add to the code to check if the value isset, and if
   it is, check if it is 1 or 0.
 * Anyway, knowing this, the plugin works like a charm. Thanks!
 * Best regards,
 * Parsec

Viewing 1 replies (of 1 total)

 *  Plugin Support [mark l chaves](https://wordpress.org/support/users/mlchaves/)
 * (@mlchaves)
 * [4 years ago](https://wordpress.org/support/topic/making-shortcodes-work-error-in-documentation/#post-15697559)
 * Hey [@parsec2](https://wordpress.org/support/users/parsec2/),
 * Sorry you ran into that shortcode issue. I was able to reproduce it.
 * I submitted an issue to the GitHub repo for this.
 * [https://github.com/code-atlantic/content-control/issues/65](https://github.com/code-atlantic/content-control/issues/65)
 * Feel free to follow that issue on GitHub.
 * Hopefully, we’ll get a fix for that in a future release.
 * Cheers!

Viewing 1 replies (of 1 total)

The topic ‘Making shortcodes work – error in documentation’ is closed to new replies.

 * ![](https://ps.w.org/content-control/assets/icon-256x256.gif?rev=2968535)
 * [Content Control - The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More](https://wordpress.org/plugins/content-control/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/content-control/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/content-control/)
 * [Active Topics](https://wordpress.org/support/plugin/content-control/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/content-control/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/content-control/reviews/)

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 1 reply
 * 2 participants
 * Last reply from: [mark l chaves](https://wordpress.org/support/users/mlchaves/)
 * Last activity: [4 years ago](https://wordpress.org/support/topic/making-shortcodes-work-error-in-documentation/#post-15697559)
 * Status: resolved