1
The_DoubleU
Re: Finding out what group a user belongs to.
  • 2004/12/6 22:37

  • The_DoubleU

  • Just popping in

  • Posts: 9

  • Since: 2004/11/28


Thanks all of you for helping me out with this one.
Using .XOOPS_URL. works fine.

I als removed the check if it is a xoops_user and modified the code now to $groups = $xoopsUser->getGroups();

The main problem I had with implementing this solution is "when to use what?", it was very hard to find it in any XOOPS documentation.
For example.
<{$xoops_url}> is used in html
.XOOPS_URL is used in PHP
Are there any other variations?

Also getting the info is difficult.
I understand from the php manual that I can get a variable with the command. Getvar(). But is there any documentation on what variables xoops_user has?
When trying to get the username I tried ('name'), {'username'}, etc. Only to find out after a lot of searching that the variable was called uname. If would be great if there is some document that would explains this.
For example:
xoops_session can contain xoops_url, xoops_user, xoops_database, etc
With all the variables linked to their documentation.
xoops_user can contain uname, uid, etc, etc.

I have been developing with Lotus Notes, and I started with xoops/php to expand my programming skills and I don't have the money to buy a Notes server :)
So if you take a look at this documentation you might understand what I mean with the comments above.

[Disclaimer]
If there is such documentation I will remove all comments above, smack my forhead 10 times on my keyboard and not abuse you guys anymore.
[/Disclaimer]

Thanks again for your quick replies and great help. Keep up the good work!
Willem.



2
The_DoubleU
Re: Finding out what group a user belongs to.
  • 2004/12/6 21:03

  • The_DoubleU

  • Just popping in

  • Posts: 9

  • Since: 2004/11/28


Thanks ackbarr, now it makes sense :)

As said before, I can now find out in which group a user is in and display a different message for each group.
Now I'm trying to add some html + smarty tags in a php echo command, and it miserably fails. :(

When typing this post I got an idea, and it worked.
I now can get the username with the command
$name = $xoopsUser->getVar('uname');
But how can I get the xoopsurl value?

Is there a list with these value's.
I checked API Doc, wiki. But couldn't find anything.

I have the following code in my theme.html.
<td id="login">
  <{if 
$xoops_isuser}>
    <{
php}>
      global 
$xoopsUser;
      
$user_group '2';
      
$admin_group '1';
      
$name $xoopsUser->getVar('uname');
      
$groups $xoopsUser $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
      if (
in_array($admin_group$groups)) {
        echo 
'Welcome&nbsp;<a href="',$xoops_url,'/user.php">',$name,'</a>&nbsp<a href="',$xoops_url,'/user.php?op=logout">Logout</a>';}
      elseif (
in_array($user_group$groups)) {
        echo 
'You are member of user group';}
      else {
        echo 
'you are member of no group';}                                        
    <{/
php}>



3
The_DoubleU
Re: Finding out what group a user belongs to.
  • 2004/12/6 19:12

  • The_DoubleU

  • Just popping in

  • Posts: 9

  • Since: 2004/11/28


Thanks Mithrandir, your tip helped me on my way indeed.
As I'm new with php and xoops. I searched a bit further on how to implement this and I have it now working.

But could you translate this line for me.
$groups = $xoopsUser ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);

what does the ? do in this function, does it mean query?
And is this a php function or XOOPS specific. I searched php.net but couldn't find anything about it.
What does array(xoops_group_anonymous) do?
Is there a website, documentation where I can find more about this and other functions.
I'm familiar with Lotus and Java script and have a general understanding on how programming languages work but php and XOOPS are new for me and would like to learn more for myself then going here everytime and asking questions answered a miljoen times :)

Does the $Groups array, only contain the groupid as described in the MySQL database (1,2,3,etc) or can I also search on the name of the group



4
The_DoubleU
Finding out what group a user belongs to.
  • 2004/12/6 15:16

  • The_DoubleU

  • Just popping in

  • Posts: 9

  • Since: 2004/11/28


I have modified my theme.html to show only a header, a 1 column center and a footer.
In the header I want to create a dynamic menu with javascript.
Something like Xoops2.org.
But I want the menu really dynamic, so if a user is not logged in I want a menu with a few options, but no link to "My account".
If a user is logged in then I want to use a different menu.
I also want to make a different menu for people in different groups. Like moderators <-> normal users.

The way I thought of doing it is by calling a different Javascript depending on userlevel.
I found out that with <{if $xoops_isuser}> I can check if the user is logged in or not.

But is there a function like <{if $xoops_group="groupname}>?

If somebody has other suggestion on how to accomplish this, you are welcome to post them.

Willem.



5
The_DoubleU
Re: Questions about layout and themes/templates
  • 2004/12/1 20:13

  • The_DoubleU

  • Just popping in

  • Posts: 9

  • Since: 2004/11/28


Thanks all for the info!
It is really a nightmare to find out "what is stored where", in the beginning.
But I'm used to work with Lotus Notes, that can be nightmare also :)



6
The_DoubleU
Re: Questions about layout and themes/templates
  • 2004/12/1 12:42

  • The_DoubleU

  • Just popping in

  • Posts: 9

  • Since: 2004/11/28


Quote:

Herko Coomans wrote:
2. They are saved in the database. That's why you need to edit them in the Template Manager n your system admin.

Herko


Thanks Herko for your quick reply.
Your answer to question number 2 has developed a few more questions and would explain why I didn't see any changes after I edit the template files directly on the filesystem.

Is everything of a module saved in the database or only the templates?
If I want to make a modification to mymodule.php. Do I edit this document on the filesystem (/modules/mymodule/mymodule.php) or can you edit this also via template manager?

If module templates are stored in the database, does this mean I can delete them from the module folder?

What exactly is stored in the database and what not?
Is there a link where this is described somewhere?

Thanks again!
Willem.



7
The_DoubleU
Questions about layout and themes/templates
  • 2004/12/1 10:44

  • The_DoubleU

  • Just popping in

  • Posts: 9

  • Since: 2004/11/28


Just started with XOOPS and so far things are running smoothly.
I can install modules and themes and beginning to figure out how I can modify them to my liking.
Ofcourse I want to create my own theme and I have a few questions about this before I proceed with this.

1. Site layout.
Have read Anatomy of the Default Theme I understand that this is the default layout of xoops. But ofcourse this can be modified.
So is it possible to move these blocks around?
So a layout would be.
-------------------
|
Header           |
-------------------
|
Block_left       |
-------------------
|
block   |block   |      
|
right   |center  |
|        |        |
|        |        |
-------------------
|
footer           |
-------------------

Block_left would contain all the menu's for example.
Will XOOPS protest if I leave a block out?
For example I don't want to use blockright at all. And I just make a layout like this.
-------------------
|
Header           |
-------------------
|
Block_left       |
-------------------
|
Block_center     |
|                 |
|                 |
-------------------
|
footer           |
-------------------


If I don't configure any modules to show in the missing block, this should work?

2. Themes and templates.
I have cloned the default theme, according to these instructions, so I can modify the theme to my liking.
I also installed a module, which was cloned also.
When I now change the template file of that module in xoops. Where are these changes saved?
Is it in /modules/modulename/some_template.html
or somewhere else?
I checked in my themes/my_theme folder but couldn't find it there.

Thanks in advance for your reaction.

Willem



8
The_DoubleU
Re: Database problem
  • 2004/11/29 0:29

  • The_DoubleU

  • Just popping in

  • Posts: 9

  • Since: 2004/11/28


I have found the problem why I was unable to connect with XOOPS to MySQL.
MySQL was rejecting the authentication because I had an "old client".
After I installed phpMyAdmin, I got also an error during connecting but at least this was an error that explained me something. "mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client"
Then I searched on google and found this Post
In that thread you find the solution on how to setup MySQL to use old style passwords.

Soltion:
First edit my.ini and add the line
#Use old password encryption method (needed for 4.0 and older clients).
old_passwords

If you now create a new user the old password will be used.
If you want to change your existing users then use the following command.
SET PASSWORD FOR user@localhost OLD_PASSWORD('mypassword');


I hope this helps some people around here.
And a suggestion to the XOOPS developers. Is it possible to create a more clearer error message? "Can't connect, because......."
This will help a lot of people I think.



9
The_DoubleU
Re:Database problem
  • 2004/11/28 20:13

  • The_DoubleU

  • Just popping in

  • Posts: 9

  • Since: 2004/11/28


Hi all,
First post here and it looks like that I'm not the only one with this "could not connect to the database server".
My system (everything running on local host)
Windows XP pro
Apache/2.0.52 (Win32)
PHP/4.3.9 Server
Mysql 4.1.7-nt

I have created a new user called XOOPS and I'm able to connect to the MySQL database via the dos prompt.
C:Program FilesMySQLMySQL Server 4.1bin>mysql -u XOOPS -p mysql
Enter password
: *******
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 5 to server version4.1.7-nt

Type 
'help;' or 'h' for helpType 'c' to clear the buffer.

mysqlstatus
--------------
mysql  Ver 14.7 Distrib 4.1.7, for Win95/Win98 (i32)

Connection id:          5
Current database
:       mysql
Current user
:           xoops@localhost
SSL
:                    Not in use
Using delimiter:        ;
Server version:         4.1.7-nt
Protocol version
:       10
Connection
:             localhost via TCP/IP
Server characterset
:    latin1
Db     characterset
:    latin1
Client characterset
:    latin1
Conn
.  characterset:    latin1
TCP port
:               3306
Uptime
:                 17 min 32 sec


But if I try to connect with the same user/pw I get the "can't connect to database server" error.
Database Hostname localhost
Database Username xoops
Database Name website
Table Prefix xoops

One time I was able to fix this but that was because I disabled the grant tables of mysql. Not a wise thing to do.
But why can I connect via a dos prompt but not during XOOPS install?

I'm completely new with mysql/xoops. But I have tried several options. Read several tutorials but no avail.
Thanks for your help in advance!




TopTop



Login

Who's Online

202 user(s) are online (85 user(s) are browsing Support Forums)


Members: 0


Guests: 202


more...

Donat-O-Meter

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

Latest GitHub Commits