Skip to main content
15 events
when toggle format what by license comment
May 10, 2014 at 14:44 comment added ashash Fixed it! this is my code : function YOURTHEME_preprocess_username(&$vars) { $account = $vars['account']; if ($profile = profile2_load_by_user($account, 'machine_name_of_your_profile')) { $type = $profile->type(); $vars['link_path'] = profile2_page_get_base_path($type) . '/' . $account->uid; } } , as taken from socialseomanagement.com/… . I've had to clear my cache too.
May 10, 2014 at 11:59 comment added ashash I'm having problems with this, can you please clarify what you did to make this work? the preprocess doesn't seem to be working when I've pasted it in my template.php and replaced the name with my theme. Thanks :)
Jul 15, 2013 at 20:56 vote accept vintorg
Jul 15, 2013 at 20:56 comment added vintorg That did 'er. One thing I am struggling with in Drupal is when something gets themed, rendered, etc. I wish there was a comprehensive diagram that helped break that down. Anyway, thanks again David!
Jul 15, 2013 at 9:17 comment added David Thomas Answer also updated to use $type = $profile->type(); for profile2_page_get_base_path object param
Jul 15, 2013 at 9:14 history edited David Thomas CC BY-SA 3.0
added 8 characters in body
Jul 15, 2013 at 9:13 comment added David Thomas @vintorg it needs $variables['user_picture'] = render($image); - answer updated
Jul 15, 2013 at 6:42 comment added vintorg To clarify, the field is populated, but the text 'Array' is rendered where the image should be.
Jul 15, 2013 at 6:04 comment added vintorg For some reason, the field_view_field call isn't working right.
Jul 15, 2013 at 5:49 history edited David Thomas CC BY-SA 3.0
added 1 characters in body
Jul 15, 2013 at 5:33 comment added vintorg Perfect. Thanks David! (note to other viewers: don't forget the '&' in the variables argument on the preprocess_username fx). Also, profile2_page_get_base_path() expected an object. I'll have to look at it later (or post if you know).
Jul 15, 2013 at 5:31 vote accept vintorg
Jul 15, 2013 at 6:03
Jul 15, 2013 at 4:49 history edited David Thomas CC BY-SA 3.0
added 95 characters in body
Jul 15, 2013 at 4:33 history edited David Thomas CC BY-SA 3.0
added 2 characters in body
Jul 15, 2013 at 4:27 history answered David Thomas CC BY-SA 3.0