• Resolved parsec2

    (@parsec2)


    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)
Viewing 1 replies (of 1 total)

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