1
Probez
Using xoops variables in blocks
  • 2005/8/18 10:54

  • Probez

  • Just popping in

  • Posts: 11

  • Since: 2005/8/15


I have tried to make a costum block and it works fine with static information. But it could be nice to use the XOOPS variables. I whant to write out the users name with the line
{$xoops_uname} but XOOPS does not replace the text and simply writes {$xoops_uname}, a have tried editning some php files and here it works fine.

I running version 2.2.2

2
romdg
Re: Using xoops variables in blocks
  • 2005/8/24 22:38

  • romdg

  • Just popping in

  • Posts: 10

  • Since: 2004/6/9 1


I may be mistaken, but I believe the smarty tags must be encapsulated in <>, therefore use <{$xoops_uname}>.

Hope this works for ya,
Cheers,
Gregg

3
romdg
Re: Using xoops variables in blocks
  • 2005/8/24 22:47

  • romdg

  • Just popping in

  • Posts: 10

  • Since: 2004/6/9 1


actually came accross some more data on bringing in user name.. SEE THIS THREAD.

Cheers,
Gregg

4
romdg
Re: Using xoops variables in blocks
  • 2005/8/25 17:00

  • romdg

  • Just popping in

  • Posts: 10

  • Since: 2004/6/9 1


ok last post..

I was wrong in my forst post but after some research I have a queick method to bring in variables to a custom block. The block has to have 'content type' to php script. You van then bring in XOOPS variables, below I provide an example of code I am using on my site:

global $xoopsUser;
if (
$xoopsUser) {
  
//User is logged in, display welcome message
  
$uname $xoopsUser->getVar('uname');
  
$userid $xoopsUser->getVar('uname');
  
$avatar $xoopsUser->getVar('user_avatar');
 
$last_login formatTimestamp($xoopsUser->getVar('last_login'), 's');
  echo(
"<b>Welcome $uname</b><br /><br />");
  echo(
"<img src="{X_SITEURL}/uploads/$avatar" />");
  echo(
"<br /><br /><b>Your Last Login: $last_login");
} else {
  return 
false;
}


Hope this helps...

5
Probez
Re: Using xoops variables in blocks
  • 2005/10/14 20:05

  • Probez

  • Just popping in

  • Posts: 11

  • Since: 2005/8/15


Thanks romdg, it works. sorry for my long time to response, I had a system down on my 2.2.3RC I sorry I updated, but ofcause i should have the lates version with all the new nice features.

To others remember to do something about the avatar, if the user dont have any you will get an error so do a check, or leave it out.

Thanks again romdg

6
Probez
Re: Using xoops variables in blocks
  • 2005/10/17 8:51

  • Probez

  • Just popping in

  • Posts: 11

  • Since: 2005/8/15


Since you are seems to know a lot just another question. How do you write out the users groups. f.ex

you are member of following groups
Administrator
Superuser

I tried a lot of the examples on the site but nothing seems to work on my 2.2.2, many of the posts is more than one year old. I got one working but I only get an array with the group id's. I have no knowledge of php, just jsp but i working on it.

There is examples of smarty task script but I would really like to have it as block.

Hope we could have this Thread open for this question because it also ref. to XOOPS variables in blocks

7
romdg
Re: Using xoops variables in blocks
  • 2005/10/28 18:42

  • romdg

  • Just popping in

  • Posts: 10

  • Since: 2004/6/9 1


After a bit of research I found the following forum entry.. have yet to try it out though but some core XOOPers appear to give their ok on the method used.

https://xoops.org/modules/newbb/viewtopic.php?topic_id=17703&forum=7&post_id=74646

You will have to modify your header.php file as described, as that queries the group information based on the uid. I may add the feature to my support site and will post with the results...

Let me know how this works...

Cheers,
Gregg

Login

Who's Online

222 user(s) are online (144 user(s) are browsing Support Forums)


Members: 0


Guests: 222


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