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

  • lelkins

  • Just popping in

  • Posts: 19

  • Since: 2008/11/26


OK, as we have figured out I am a dunse.... I searched the forum and can't find what I am after, and also checked my blocks, but nothing is making sense to me at the moment..

So, created a custom block, set to PHP script and added the following code.

<{php}> $myField ''; if (is_object$xoopsUser )); { $myField $xoopsUser->getVar('user_from') ; } <{/php}> <{$myField}>


This is obviously wrong. Can anyone please correct this for me. Thank you.

12
lelkins
Re: Profile field display somewhere else
  • 2008/12/1 11:28

  • lelkins

  • Just popping in

  • Posts: 19

  • Since: 2008/11/26


After a bit more reading I am totally lost, so just trying every snippet that I can find. So I added the following code to class/xoopsblock.php hoping it might help..
function getUserFrom($myField){                 if (is_object($xoopsUser) && $xoopsUser->getVar('uid') > 0){                     $myField $xoopsUser->getVar('user_from');                                   }                 return $myField;             }


Funny to say, I am still stuck... is what I have done right? If it is, how do I then call $myField in a custom block?

Please guys, I really need some help with this because I need to replicate this principle throughout my site numerous times, so if I can just get it right once, I will follow suit for the rest.

Cheers

13
lelkins
Re: Profile field display somewhere else
  • 2008/12/1 12:00

  • lelkins

  • Just popping in

  • Posts: 19

  • Since: 2008/11/26


OK, so I have found something else that I can get to work in an HTML page. Code is

<{if $xoops_isuser}>
<{php}>global $xoopsUser; echo($xoopsUser->testField());<{/php}>
<{/if}>

So, first question, how do I put that into a block?
And second, how can I adapt it to say something along the lines of, if $xoopsUser->testfield = "TEST" then echo "BLAH BLAH"
else echo "12345"

I would be very grateful for some help with this. Thanks.

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

  • lelkins

  • Just popping in

  • Posts: 19

  • Since: 2008/11/26


More info. I have extended the code to include the if var = blah blah blah which is working, but only if I put it in HTML page. The code is

<{if $xoops_isuser}>
<b>Email:&nbsp;</b><{php}>global $xoopsUser; if(($xoopsUser->testField() == "12345"))
{
echo "TEST";
}
<{/php}>
<{/if}>

Problem is, I can not get this to work in a block and have tried searching for examples but I am pretty stumped with this 1. Anyone can let me know how to adapt this to add it in a block? Cheers

15
lelkins
Re: Profile field display somewhere else
  • 2008/12/1 16:34

  • lelkins

  • Just popping in

  • Posts: 19

  • Since: 2008/11/26


Is there not anyone that can help me? I have the code below which works if I add it to the header, but how can I put it into a block from the block admin page?

<{if $xoops_isuser}>
<b>Email:&nbsp;</b><{php}>global $xoopsUser; if(($xoopsUser->testField() == "12345"))
{
echo "TEST";
}
<{/php}>
<{/if}>

Anyone? Please, this is driving me crazy!!!! ARGHH!!!

16
alfred
Re: Profile field display somewhere else
  • 2008/12/1 16:49

  • alfred

  • Quite a regular

  • Posts: 249

  • Since: 2005/10/29


<{php}> 
  if (
is_object$xoopsUser )) { 
    
$GLOBALS['xoopsTpl']->assign('myField'$xoopsUser->getVar('user_from')); 
  } 
<{/
php}> 

<{
$myField}>

17
lelkins
Re: Profile field display somewhere else
  • 2008/12/1 16:55

  • lelkins

  • Just popping in

  • Posts: 19

  • Since: 2008/11/26


Thanks for the reply, but when I put it in a PHP Script custom block it shows the following error.

Parse error: syntax error, unexpected '<' in *********\xoopsblock.php(147) : eval()'d code on line 1

When I put it in an HTML custom block, it just shows the script.

What am I doing wrong?

18
alfred
Re: Profile field display somewhere else
  • 2008/12/1 17:28

  • alfred

  • Quite a regular

  • Posts: 249

  • Since: 2005/10/29


in a Block

global $xoopsUser;
$myField '';
if (
is_object$xoopsUser )) { 
  
$myField $xoopsUser->getVar('user_from'); 

echo 
$myField;

19
lelkins
Re: Profile field display somewhere else
  • 2008/12/1 17:35

  • lelkins

  • Just popping in

  • Posts: 19

  • Since: 2008/11/26


Quote:

by dhsoft on 2008/12/1 17:28:44

in a Block


global $xoopsUser;
$myField = '';
if (is_object( $xoopsUser )) {
$myField = $xoopsUser->getVar('user_from');
}
echo $myField;


WOOHOO!!! Now, one last question for you dhsoft...where do you live so I can give you a big fat sloppy man love kiss?

Cheers.

20
alfred
Re: Profile field display somewhere else
  • 2008/12/1 18:28

  • alfred

  • Quite a regular

  • Posts: 249

  • Since: 2005/10/29


tsts

Login

Who's Online

236 user(s) are online (143 user(s) are browsing Support Forums)


Members: 0


Guests: 236


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