WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Current User ID in Plugin (3 posts)

  1. Nasir Zia
    Member
    Posted 2 years ago #

    Hi,
    I have used a code to get Current user id in various part of template Pages.
    Now i want to use the same code inside a plugin... But the same code which always worked like a charm is returning 0 rather than the logged in user id...
    The code i use is below.

    global $current_user;
    get_currentuserinfo();
    echo $current_user->ID;

    Is there anything wrong with the code, or do i have to make some changes in to it while using it inside a plugin.
    Thanks,

  2. RichardWPG
    Member
    Posted 2 years ago #

    what plugin is that?

  3. Nasir Zia
    Member
    Posted 2 years ago #

    Rate this page plugin...
    But i have sorted the issue...
    I was trying to make changes to the hooks file.. but that wasn't working well...
    Editing rtp-main.php worked..
    Thanks,
    Nasir

Topic Closed

This topic has been closed to new replies.

About this Topic