Results 1 to 3 of 3

Thread: Pass Current User ID in Field's Custom Code

  1. #1
    GBSMarketing is offline Junior Member
    Join Date
    Jul 2009
    Posts
    6

    Default Pass Current User ID in Field's Custom Code

    Hi, I' hoping someone can help with this.
    I am trying to pass logged in user's Id via the url of an html field using the following:

    7 =>
    array (
    0 =>
    array (
    'name' => 'fav_c',
    'studio' => 'visible',
    'label' => 'Add to Favourites',
    'customCode' => '<a href="favorites.php?id={$fields.id.value}&u_id=<?p hp global $current_user;echo $current_user->id;?>" target="_blank">Favourites</a>',
    ),
    ),

    Which obviously isn't working.

    Any advice would be appreciated.

    John

  2. #2
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Pass Current User ID in Field's Custom Code

    You may have to pass the variable from a custom view. I thought it might have been automatically passed but don't recall. Anyone else?

  3. #3
    GBSMarketing is offline Junior Member
    Join Date
    Jul 2009
    Posts
    6

    Default Re: Pass Current User ID in Field's Custom Code

    Thanks for the reply.

    Turned out to be rather simple in the end

    'customCode' => '<a href="favorites.php?id={$fields.id.value}&u_id={$c urrent_user->id}" target="_blank">Favourites</a>',

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Change a custom field's type
    By fcolpron in forum Help
    Replies: 1
    Last Post: 2010-06-25, 02:21 PM
  2. Copy custom field's value
    By mychan in forum General Discussion
    Replies: 0
    Last Post: 2009-06-24, 02:07 AM
  3. Replies: 2
    Last Post: 2009-04-21, 09:35 PM
  4. Replies: 4
    Last Post: 2008-12-30, 12:05 PM
  5. Custom Code & assigned user
    By danisugar in forum Developer Help
    Replies: 4
    Last Post: 2008-03-11, 12:39 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •