Closed (fixed)
Project:
Profile 2
Version:
7.x-1.3
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
10 Mar 2014 at 22:25 UTC
Updated:
26 Mar 2014 at 08:51 UTC
Jump to comment: Most recent
Comments
Comment #1
klequis commentedSometimes asking a question helps formulate the answer. I tried to solve this for hours but right after posting this request I googled the right phrase and found the answer
arg(1) contains the uid of the user whose profile is being viewed.
Since I'm new to Drupal, I don't really know where arg(1) is coming from. I assume Drupal is passing it into the page. If anyone can point me to doc where I can learn about this it would be greatly appreciated.
Thanks.
Comment #2
joachim commentedhttps://api.drupal.org/api/drupal/includes!bootstrap.inc/function/arg/7
arg() is considered a fairly heavy-handed way to get things done. Though it works!
Also, overriding page.tpl.php is something I'd advise against, as it means that changes to your overall site design now have to be made in two templates. Was the profile.tpl not suitable? If you're changing something about the whole page, have you considered using Context module to change the blocks that are shown?
Comment #3
klequis commentedThank you for the reply.
Don't remember as I did the override weeks ago. I used Theme Devel and looked around pretty carefully trying different things. It might not have been since I used Display Suite to give it a 2 col layout. I see in my notes I tried to override panels-twocol.tpl.php but this is a very sparse template that gave little opportunity to customize (or I just didn't know how).
I'm not familiar with Context but will look into it.
My current challenge, if it is OK to add to the question, is that I need to get uid for the profile being viewed. I don't know if there is another approach but I see uid is in the profile so I'm trying to load it. I'm working logged in as admin (uid=1, pid=15) and I can use profile2_load(15), it works fine. However, the pid of the profile being viewed it doesn't.
The pid from arg(1) is 21
var_dump returns false
(hard coding 21 only in the example :) )
Any suggestion?
Thanks!
Comment #4
klequis commentedSo I just realized that I really messed this thread up. I was looking for uid, found pid in arg(1) and wrote that I found uid there :(.
I'm really back to square 1, I still need uid. As I described in #3 I'm trying to get that by loading the profile. Any help on this would be greatly appreciated.
Comment #5
klequis commentedSet status back to Active
Comment #6
klequis commentedI've felt a little foggy with a dull headache all day and now I have to add a sense of embarrassment to that. I'm just getting uid and pid mixed-up. I am getting uid from arg(1) so that is solved. I still have a question about loading the profile but since I made a mess out of this issue I'll close it and ask the question on a new thread tomorrow - hopefully with a clear head.
Comment #7
klequis commentedComment #8
joachim commentedNo problem, happens to all of us :)