[development] Getting uid of current profile page

Adam B. Ross grayside at gmail.com
Sun Mar 11 03:03:18 UTC 2012


Current User != Current Profile Page User

This is a frequent mistake made, ends up showing site administrators their
own information instead of the user they are reviewing.

On Sat, Mar 10, 2012 at 4:19 AM, Erlend Klakegg Bergheim <erlend at klakegg.net
> wrote:

> To edit page:
> hook_user_view_alter
>
> To get current user:
> global $user;
> edit $user->uid;
>
> - Erlend
>
> Den 15:01 9. mars 2012 skrev Aaron Winborn <winborn at advomatic.com>
> følgende:
> > Assuming user/[uid], it would be arg(1). Then you could use user_load()
> to
> > get the object.
> >
> >
> > On 3/9/12 7:46 AM, Andreas Laesser wrote:
> >>
> >> -----BEGIN PGP SIGNED MESSAGE-----
> >> Hash: SHA1
> >>
> >> Hi @all
> >>
> >> Lets assume, that i want to something like:
> >>
> >>   <?php
> >>   $currentProfileUser="Here happens some magic"
> >>
> >>   print("<H3>  $currentProfileUser is Member of ...</H3>");
> >>   ?>
> >>
> >> in the file: /drupal/modules/user/user-profile.tpl.php
> >>
> >> Can someone provide my some ideas how to get the uid from the current
> >> user profile page? I do not need the uid from the logged in viewing
> >> user, i need the uid from the user displayed at the current profile
> page.
> >>
> >>
> >> Thanks a lot for help!
> >> regards Andreas
> >>
> >> - --
> >>
> =========================================================================
> >>         _____________
> >>        / ___________/    Andreas Laesser
> >>       / //_// /____/     Signal Proc.&  Speech Communication Lab.
> >>    __/ /___/ / __        Graz University of Technology
> >>  /___//____//___/        Inffeldgasse 16c/EG | A-8010 Graz | Austria
> >>
> >> http://www.spsc.tugraz.at Tel: +43 (0)316 873 -4443 Fax: DW 104439
> >>
> =========================================================================
> >> -----BEGIN PGP SIGNATURE-----
> >> Version: GnuPG v1.4.9 (GNU/Linux)
> >> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> >>
> >> iEYEARECAAYFAk9Z+7QACgkQ1nmbrmNF2lN2bQCfa5kiat9cXkmiSbs1KEcX7NEi
> >> 4KYAoIRQm8l2z7lepHoCbs+FisMmK/zp
> >> =xAq1
> >> -----END PGP SIGNATURE-----
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20120310/0354d1b0/attachment.html 


More information about the development mailing list