• Resolved kennyvg

    (@kennyvg)


    Hi,
    I want to build trackserver into a theme.

    I use code

    
    <?php echo do_shortcode('[tsmap user=admin live=yes ]'); ?>
    
    

    He is saying there is no track?

    If put the shortcut into a blogpost, show the correct location?

    View post on imgur.com

    what do i wrong?

    Greetz,
    Kenny

    • This topic was modified 5 years, 3 months ago by kennyvg.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author tinuzz

    (@tinuzz)

    Most likely, the reason is that the page you are doing this on doesn’t have an author. If author ID is not known, Trackserver cannot check the ownership of the page against the ownership of the track and refuses to serve it. It’s a security measure.

    You would have to change the code and disable the check to make it work.

    Best regards,
    Martijn.

    • This reply was modified 5 years, 3 months ago by tinuzz.
    Thread Starter kennyvg

    (@kennyvg)

    Hi,
    Where can i find this?

    Regards,
    Kenny

    Plugin Author tinuzz

    (@tinuzz)

    In class-trackserver.php, look for a function named ‘validate_user_ids’.

    It checks if a list of user-ids exist in the database, but if the author of the page isn’t allowed to publish other users’ tracks (i.e. s/he’s an admin), all user-ids except the author id are removed from the list before the check:

    if ( ! user_can( $author_id, 'trackserver_publish' ) ) {
    	$user_ids = array_intersect( $user_ids, array( $author_id ) );
    }
    

    If you wrap this code in something like:

    if ( $author_id != null ) {}

    It will probably work. You should check the actual value of $author_id in your case, because I don’t know if it is null or something else.

    Good luck,
    Martijn.

    Thread Starter kennyvg

    (@kennyvg)

    That solved the problem!

    Thank you

    • This reply was modified 5 years, 3 months ago by kennyvg.
    Plugin Author tinuzz

    (@tinuzz)

    Great!

    Cheers,
    Martijn.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘add shortcut in theme’ is closed to new replies.