WordPress.org

Ready to get started?Download WordPress

Forums

User Specific Content
[resolved] Put code in template? (5 posts)

  1. brianguerra
    Member
    Posted 2 years ago #

    I want to put this in a template file for single posts.. Basically, I want the author of every post and the admin to have a little div box near the top with some pertinent information about the post. But I can't find a way to dynamically set the user_name or user-id_ inside the loop so I don't have to go in and paste code at the top of every post.

    I'm currently echoing the shortcode, but perhaps there is a better way to do this and I may just be using the wrong code to get get the author's name?

    <?php echo do_shortcode('[O_U user_ID="<?php echo $curauth->ID; ?>,1" blocked_message=""]
    <div class="authorbox">Stuff for author and admin here</div>
    [/O_U]'); ?>

    It shows up for the admin user, but not the author.

    http://wordpress.org/extend/plugins/user-specific-content/

  2. Bainternet
    Member
    Plugin Author

    Posted 2 years ago #

    your code is wrong so the author's id is never passed to the shortcode, try:

    <?php echo do_shortcode('[O_U user_ID="'.$curauth->ID.',1" blocked_message=""]
    <div class="authorbox">Stuff for author and admin here</div>
    [/O_U]'); ?>
  3. Ross
    Member
    Posted 1 year ago #

    Not to bump up an old post, but this is what I need. Looking for a way to globally deny unless set on a page-by-page basis. I'm putting your code, Bainternet, in my theme's page.php before and after the content, but it's erroring out (500) every time. Thoughts?

  4. Ross
    Member
    Posted 1 year ago #

    So I got the global deny working, but is there a way to set the individual permit to be the people on each page that I set in wp-admin like before? Right now that doesn't work and it's still blocked even if the person is selected on the page.

  5. Bainternet
    Member
    Plugin Author

    Posted 1 year ago #

    what?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic