1
lelkins
Profile field display somewhere else
  • 2008/11/30 20:43

  • lelkins

  • Just popping in

  • Posts: 19

  • Since: 2008/11/26


Howdie guys and gals.

So, I have been tinkering with XOOPS for about a week, and so far I am loving it, just a few little dead ends I have come up to so far, but I am sure a bit more tinkering will allow me to jump over the rule or go through it...

Anyway, on to the point of why I am posting. I have used PHP in the past, but not for a long time, same with mySQL and I have pretty much forgot most of what I knew (new info in, old info out..)
So,I have installed the Profile mod that comes with the most recent XOOPS install and have created a new profile field and it seems to be working great.
So, scenario, lets say I add a new field with the following details: Title = testField, Name = testField, Type: Text Field.
How do I then add the value of that field to any page on my site, say for example I have a block displayed on every page, how would I go about having that string in there read from the db?

I hope this make sense.

Sorry if this has been asked before or if I have posted in the wrong area, I assume it is pretty basic and I am just missing what is right in front of me.

Anyhow, any help will be greatly appreciated.

Have a good 1.

2
ghia
Re: Profile field display somewhere else
  • 2008/11/30 22:04

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Try
$myField '';
if (
is_object$xoopsUser )) {
  
$myField $xoopsUser->getVar('testField') ;
}

3
lelkins
Re: Profile field display somewhere else
  • 2008/11/30 22:05

  • lelkins

  • Just popping in

  • Posts: 19

  • Since: 2008/11/26


thanks for the reply.
i'll have a whack at it now and will probably be back in a minute.

4
lelkins
Re: Profile field display somewhere else
  • 2008/11/30 22:11

  • lelkins

  • Just popping in

  • Posts: 19

  • Since: 2008/11/26


OK, probably another simple question, but where would i need to add that so that the variable is available anywhere that I want to use it?

Or alternatively, how would I add that into an HTML page?

Cheers

5
lelkins
Re: Profile field display somewhere else
  • 2008/11/30 23:34

  • lelkins

  • Just popping in

  • Posts: 19

  • Since: 2008/11/26


anyone?
I won't be able to sleep until I get this done, and I am knackered so I really do need to sleep...yawn...

6
lelkins
Re: Profile field display somewhere else
  • 2008/12/1 9:52

  • lelkins

  • Just popping in

  • Posts: 19

  • Since: 2008/11/26


Lets try again...
With the code that ghia gave me, how would I make that available to every page? or how would I put it into a block?

Anyone? I won't be able to eat until I get this done, and I am starving so I really do need to eat...

7
ghia
Re: Profile field display somewhere else
  • 2008/12/1 9:55

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


It is php code. You can use it in module php code, in custom (php) blocks, or in smarty templates with the proper tags.

8
lelkins
Re: Profile field display somewhere else
  • 2008/12/1 9:59

  • lelkins

  • Just popping in

  • Posts: 19

  • Since: 2008/11/26


OK, I'll give it a bash.
I was trying it in a php block last night, but when I went to the main page it wouldn't show up, so to check the block was actually working I changed it to HTML and it did display on the page that I wanted it to.. any idea what I am doing wrong?

Again, big thanks for the reply.

9
ghia
Re: Profile field display somewhere else
  • 2008/12/1 10:22

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


You have to show some code for that.
You can find inspiration for block code by examining some simple existing blocks or by looking in some code on this forum provided for custom blocks.

10
lelkins
Re: Profile field display somewhere else
  • 2008/12/1 10:24

  • lelkins

  • Just popping in

  • Posts: 19

  • Since: 2008/11/26


Cheers ghia, I will give it a look now.

Login

Who's Online

110 user(s) are online (76 user(s) are browsing Support Forums)


Members: 0


Guests: 110


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits