Questions and Answers

How do I collect points?

  • +4
    Chosen as best answer
  • +1
    Posted answer
  • +1
    Posted question
  • +1
    Thumb up
  • -1
    Thumb down

by Sylar Bo in Coding about January 13, 2014 closed - report

Get User ID

I'm using SE 4.7.0

I have modified the Widget, which shows some Information about the User under the Profile picture on the "Profile Page". I mean the "Joined: ..." and the "Last Login: ... " information. I justed commented out these informations and wanted to add one information which I myself have added to the database in a specific table. This Information has a default start value and only i change the values of this information in the database.

Now i need to Get the User ID of the selected Profile to get my information of the User in the table. It is the table "engine4_user_fields_search" in which the information an the username and the User id and some other information are in. Now i need the User ID to read out the User i want to display my special Information.

At the moment i solve the Problem by read out the User ID in the URL. If i look up a profile in my community the domain includes

Where the number in the URL is the User ID i need to read out my information from the table.

This is not the best solution i think, maybe someone have a better solution, and can tell me how i can get the user id maybe with a function or something else.

I hope this is understandable and someone can tell me how to get the User ID in this widget.


Answer: 1  •  Score 0  •  Views: 1130

1 Answer
Browse by
  • 264

    by Gaurav Sharma about January 13, 2014 Best answer

    Check subject and get the user_id from subject


    if( Engine_Api::_()->core()->hasSubject() ) 


    $subject = Engine_Api::_()->core()->getSubject('user');



    1 comment
    • Sylar Bo
      by Sylar Bo
      January 13, 2014

      You are great!

Question was closed.