11
Tarik
Re: Looking to get current user information and some fields from user profile.
  • 2011/1/25 12:36

  • Tarik

  • Not too shy to talk

  • Posts: 170

  • Since: 2010/2/3 1


global $xoopuser;

this line is used when you ant to use $xoopuser in a function, class...
because it make her a global variable accessed from anywhere
further explanation here
Some people like what you do,
-- some people hate what you do,
---- but most people simply don’t give a damn.

12
xoobaru
Re: Looking to get current user information and some fields from user profile.
  • 2011/1/27 1:34

  • xoobaru

  • Just can't stay away

  • Posts: 494

  • Since: 2010/12/2


Disregard this fat finger.
password?

13
redheadedrod
Re: Looking to get current user information and some fields from user profile.

Quote:

noobaru wrote:
Disregard this fat finger.
password?


What do you mean?

You can not call up the password as it is a hashed value and the actual password is never stored. The password has to be entered, then hashed and then it can be compared to the one in the database. If they match then you have the correct password. You can do a query and pull the password as a hashed value but as I said, the password its self is never stored.

14
xoobaru
Re: Looking to get current user information and some fields from user profile.
  • 2011/1/28 23:58

  • xoobaru

  • Just can't stay away

  • Posts: 494

  • Since: 2010/12/2


By fat finger it was sent accidentally due to a "fat finger" hitting more keys than one (plus maybe too many hours of doing this). Disregard the related message as it was sent in error.

But that said....

I am attempting to assign uname and uid xoops variables into javascript username and userid ones respectively. All web research, xoops dev site research, and examination of the xoops source code suggests that the correct syntax for this should be as follows: (<script and </script omitted).


var name = "<?php echo xoopsUser->getVar("uname");?>";
var id = "<?php echo $xoopsUser->getVar("uud");?>";

But when the JS is executed the JS variables remain empty ("") in the Firebug trace. If I substitute a literal string such as roadrunner for everything between the <?php and ?> the JS variable gets loaded with the data (i.e. "roadrunner').

Can anyone explain why the above JS variable assignment syntax would fail to assign the data to the JS variables and suggest any syntax correction I can try?

Much appreciated

15
redheadedrod
Re: Looking to get current user information and some fields from user profile.

Quote:

noobaru wrote:
By fat finger it was sent accidentally due to a "fat finger" hitting more keys than one (plus maybe too many hours of doing this). Disregard the related message as it was sent in error.

But that said....

var name = "<?php echo xoopsUser->getVar("uname");?>";
var id   = "<?php echo $xoopsUser->getVar("uud");?>";


Much appreciated



First of all.... You are missing the $ on the first xoopsuser..

Second.. You do realize that if you look at your use of " that your code will not work even if it is the right syntax otherwise. You will either have to "escape out" the inner "'s or you should try using '.. So would look more like...

var name = "<?php echo $xoopsUser->getVar('uname');?>";
var id   = "<?php echo $xoopsUser->getVar('uud');?>";


Assuming you want uname and uud

16
xoobaru
Re: Looking to get current user information and some fields from user profile.
  • 2011/1/29 17:13

  • xoobaru

  • Just can't stay away

  • Posts: 494

  • Since: 2010/12/2


both the missing $ and uud were only present in this thread, but okay in the executable script. Tried with ('uname') and many other variants including (uname) with same result.... empty target variables.
If you have the inclination and use the Firefox extension Firebug (or Opera Dragonfly) script tracers you can see the results on your own system using and exact same script.

--------CUT HERE----------
// <?php
// // Simple Javascript file to test assignment of xoops user variables
// ?>
// <script language="JavaScript">
// var name = "<?php echo $xoopsUser->getVar('uname');?>";
// var id = "<?php echo $xoopsUser->getVar('uid');?>";
// // -->
// </script>
--------CUT HERE----------

Create a new text file and rename as anynameyouwant.php then cut and paste code above removing the // and double space added at the start of each line to prevent negative interaction with php mailer. Try running from a folder under modules when logged in to xoops. I am betting you will see either no javascript trace activity or empty name and id variables when trace is run.

17
xoobaru
Re: Looking to get current user information and some fields from user profile.
  • 2011/1/29 17:15

  • xoobaru

  • Just can't stay away

  • Posts: 494

  • Since: 2010/12/2


By the way Rodney did I say thanks? If not, thanks for helping with that last message.

18
Tarik
Re: Looking to get current user information and some fields from user profile.
  • 2011/1/29 17:28

  • Tarik

  • Not too shy to talk

  • Posts: 170

  • Since: 2010/2/3 1


if it's in a template you can use

<{$xoops_userid}>
User ID of the member

<{$xoops_uname}>
Uname for the member
Some people like what you do,
-- some people hate what you do,
---- but most people simply don’t give a damn.

19
xoobaru
Re: Looking to get current user information and some fields from user profile.
  • 2011/1/30 19:54

  • xoobaru

  • Just can't stay away

  • Posts: 494

  • Since: 2010/12/2


Not in a template, just trying to use Javascript within a small php file to get uname and uid info into Javascript variables when the file is executed from a link in the logged on side. Tried the above variables anyways but no success. I wonder if XOOPS security features are interfering somehow. This should be simple.

20
redheadedrod
Re: Looking to get current user information and some fields from user profile.

Can someone tell me what is wrong with this code?

I am trying to use this to remove a user from a group. It is not working.

I will have a similar function to add a person to the group as well.

The $xoopsModuleConfig['ugroup'] line pulls up the right group and I am forcing the UID 1 which is a valid user number. I have some other code to add after I get this working but at the moment when I run this code it returns ok but no actual removal of the user.

If I am reading things right the right format for calling the method is...

removeUsersFromGroup(groupid, array(uid));

where array(uid) can be 1 user or many users.

This method is a little different than the similar method if I am understanding this which is called like this...

addUserToGroup(groupid, uid)

The snippet of code I am using...

$xrosterhMember =& xoops_gethandler('member');

function 
Members_Delete($id){
    global 
$xrosterhMember$xoopsModuleConfig;
    
$result =& $xrosterhMember->removeUsersFromGroup($xoopsModuleConfig['ugroup'], array(1));
}



Another note... I do get this following error...
Quote:

Warning: Database updates are not allowed during processing of a GET request in file /class/database/mysqldatabase.php line 397


This is the LAST thing I need to add to my roster program before I move onto the next thing so I would greatly appreciate any help someone can give me.

I want to thank ghia, iHackCode, zyspec, and tarik for helping me out so far. I didn't expect to do this much with this module because I want to totally rewrite it but the experience was useful.

Login

Who's Online

234 user(s) are online (137 user(s) are browsing Support Forums)


Members: 0


Guests: 234


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