Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Jay955528 on
I want to be able to insert the userid of the logged in user into an html string to an affiliate program . The idea being that when a registered user clicks on the shopping icon it will put his userid into the html string as the affiliate.
Is this possible? easily?
Comments
$user is a global variable
So you can use it in a function like this:
}
Thanks
Thanks,
Where would this work? Static Pages? Blogs? Do I need any other mocules running? I am just a cut and paste programmer so you can't insult me with too basic an explaination.
I am getting this error message
Parse error: parse error, unexpected '.' in /home/advance/public_html/drupal/includes/common.inc(1813) : eval()'d code on line 5
$user->name
If you are trying to get the user's name, use $user->name not $user->uid (which is the numerical user id)
This would work anywhere that you can execute php code (for example, a block that is configured to run php code, or while writing code for your own module)
thanks
Only in blocks not on the main page? My infantile understanding of drupal leads me to believe that a block can only be displayed on the sections to the left and righ of the main area.
... and you can execute PHP code in most content
... that shows up on the front page.
If you are using PHPTemplate, just inline it where you want.
If you have a 'sticky' story at the top of your front, The content could have been entered using input-format:PHP.
Ditto if your front page is a specific node.
Dunno about other templates, I'm sure it can be done. Input-format:PHP Code.
.dan.
http://www.coders.co.nz/
.dan. is the New Zealand Drupal Developer working on Government Web Standards
Look here
For accessing 'my account' you can also use user/profile or any user/blablabla like path - it will be redirected to user profile page.
Look here also: http://drupal.org/node/29000
--
Building bands and music communities sites, thanks to Drupal !
Ukrainian vocalists portal