DaveP Posted April 5, 2012 Share Posted April 5, 2012 Forgive me if this has been answered before, but the threads I have read have talked about upcoming features, which I am not sure whether they are available or not. What I am trying to do is have quite a comprehensive user profile available (I am attempting to build a simple forum with PW). I can sort of get it to work with a second user profile table, but there is always the possibility that the two will get out of step. Is there a way of adding fields to the existing 'users' pages? (Any other tips would be most welcome.) Link to comment Share on other sites More sharing options...
renobird Posted April 5, 2012 Share Posted April 5, 2012 Dave, You can add whatever fields you want to the user template. I'm building a fairly complex user profile setup as well. Go to: Setup > Templates, at the top of the page open the "filters" area and enable "show system templates". Now you can add any of your fields to the user template. 3 Link to comment Share on other sites More sharing options...
DaveP Posted April 7, 2012 Author Share Posted April 7, 2012 Thanks, Renobird. I hadn't noticed the 'filter' control! (As always, PW already has an easy way of doing something I was making difficult for myself.) Link to comment Share on other sites More sharing options...
DaveP Posted April 7, 2012 Author Share Posted April 7, 2012 Supplementary question - what's the best way to have some information from a user profile available for public viewing (ie to allow 'guest' viewing rights to some information)? Link to comment Share on other sites More sharing options...
renobird Posted April 7, 2012 Share Posted April 7, 2012 Hi Dave, Unless there's some method of showing profile info that I'm not aware of (entirely possible), you can choose to display or not display any profile information in your template. <h2><?=$user->name?></h2> <p><?=$user->job_title?></p> <p><?=$user->bio?></p> <p><?=$user->email?></p> Link to comment Share on other sites More sharing options...
Pete Posted April 8, 2012 Share Posted April 8, 2012 This comes back to everything in PW being a page, even users. For example, I can fetch myself using $pete = $pages->find('template=user, name=pete, include=hidden'); You might want to check that field name though since I'm on my phone, but I think that's right anyway. Either way the users section is hidden so you will need that bit on the end I think. Link to comment Share on other sites More sharing options...
ryan Posted April 9, 2012 Share Posted April 9, 2012 Pete is on the right track, but I think this is what you want instead: $pete = $users->get('name=pete'); or this also works: $pete = $users->get('pete'); 1 Link to comment Share on other sites More sharing options...
anttila Posted March 14, 2017 Share Posted March 14, 2017 <?php foreach($users->find($item->writer) as $usr); ?> Odd thing that my custom field not showing when using print_r or var_dump, but still works if using $usr->customfield. Sorry about this post, I had a question, but found an answer already. Can't delete my own posts. Link to comment Share on other sites More sharing options...
JeevanisM Posted November 10, 2019 Share Posted November 10, 2019 Hello, I have created a standard field type as userphone , then I added this field to the User template. I created a phone field type using Phone Field module. I added this field to the User template also. Now I used the below to create a test user $u = new User(); $u->of(false); $u->name = "saarun"; $u->email = "saarunthomas@example.com"; $u->pass = "123456"; $u->Phone = 9446196667; $u->userphone = 9446196667; $u->headline = "hello there"; $u->paid=1; $u->addRole("registered"); $u->save(); $u->of(true); and I tried to out put as below $item = $users->get("saarun"); echo $item->email; echo $item->Phone; echo $item->paid; echo $item->headline; echo $item->userphone; and I got the output a below. Neither the userphone value nor the Phone value are output ... what am I doing here wrong ? pls help Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted November 13, 2019 Share Posted November 13, 2019 Hey, @JeevanisM! Seems to be the same question as here. Please be patient and do not doublepost. That would probably do more harm than good (to receive a nice and thorough answer). 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now