Loading...
 
Skip to main content

Features / Usability


User and Registration tracker Help

// Initialization
require_once ('tiki-setup.php');
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
if ($user) $WEBlogin = $user;
else $WEBlogin='xxx';

Above script no longer works. It dosnt give $user and $WEBlogin is always set to "xxx"

Did something change in "tiki-setup.php" ??
We have used tiki since ver 1.x and this script has worked for up until the last few versions, we are running on 10.2 now.

Also, we are looking for some one who can tudour me and set up a User and Registration tracker so it works correctly.
I am not that good and cant get it to work.

Some one who is willing to work with me by the hour would be great.

Thank you

Try adding:

Copy to clipboard
global $user

after your "Initialization" comment to get access to the user name.

Have you tried following the Tiki documentation for setting up the User TrackerQuestion?

Tom


I added the global and it did nothing.

Yes, I did try the Tiki documentation for setting up the User Tracker.

Thanks


Sorry that didn't work. I guess I assumed it was being used in a plugin, the global should have worked in a plugin.

If the php program is not a tiki plugin, then I think the problem accessing the $user variable is because the called program is not inheriting the Tiki session variables.

I have a solution, if you have Admin -> General -> General Settings -> "Session cookie name" empty (not set to anything).

If you have Admin -> General -> General Settings -> "Session cookie name" set to something, then this will not work. But if Admin -> General -> General Settings -> "Session cookie name" is empty (which I think uses the default "PHPSESSID"), then you can add this to the top of your php program:

Copy to clipboard
session_start(); $userinfo=$_SESSION['u_info']; $user=$userinfo['login'];


Then $user will be set to the login.

If you want to see which session variables are available, you can add:

Copy to clipboard
print_r($_SESSION);


Note that changing Admin -> General -> General Settings -> "Session cookie name" durring a session will cause you to be logged out of that session.

There should be a way to do it if Admin -> General -> General Settings -> "Session cookie name" is set to something, but I don't know how to do it.

Does anyone else have a process to access the Tiki $user from a called php program?


For the user tracker, I will run through the steps that I think you need:

Admin -> Features -> Global features -> check Trackers and Apply.

Trackers -> List Trackers

Create Tracker

Enter Name, example: Users
Any Description text entered will display on the Register page.
click "OK" to finish creation

Click on the Fields icon for the tracker.
Add Field
Enter Name, example: User
From Type Dropdown, select "User Selector".
Checking "Restrict visibility to administrators" is probably a good idea.
Click on "ADD FIELD & EDIT ADVANCED OPTIONS".
Under Validation, "Type" dropdown, select "User Name".
Under Permissions, Visibility, select "Visible by administrators only".

You should add at least one more field:
Add Field
Enter Name, example: robot
From Type Dropdown, select "Drop Down".
Checking "Restrict visibility to administrators" is probably a good idea.
Click on "ADD FIELD & EDIT ADVANCED OPTIONS".
Under "Options for Drop Down", Option, enter: yes,no
And save.

In "Tracker fields" list check the "Mandatory" boxes for the fields they must use at registration and then with "Save All" selected, click on "Go".

Note the ID numbers of the fields you have in the tracker, you will need those latter.

Next:
Admin -> Login
Check "Users can register".
Check "Use tracker to collect more user information".
Click on "CHANGE PREFERENCES".

Now you have to add the tracker to the Registered group:
Click on "Admin Groups" (or Admin -> Groups).
Click on the Edit icon for Registered group.
In the "Users Information Tracker" drop down, select the tracker you created and then "SAVE".
Now under "Users Information Tracker", for "choose a field", select the name of your "User Selector" field.
Next, for "Users Information Tracker Fields Asked at Registration Time" put the field IDs of the fields you want asked at registration (you do not have to put the User Selector field ID number in there).

Now log out and go to Register and see if the tracker field has been added to the registration requests.

I hope this helped.

Tom


I dont know much about PHP.
I would thought redefining $user would mess up but I guess it ends up with same value.
Using your code allowed it to work and seems to work with the the default PHPSESSID in "Session cookie name".
Thank you very much Tom.

Yes it is a added PHP program to try and automate a separate database of member information.
We thought we could use a user tracker and eliminate this PHP program.
A few months ago I tried to set up a user tracker to tie in to the user name but I couldnt get it to work properly.
Maybe I was under the wrong impression that you could tie the tracker and user preferences together.
That is why I asked for help with tracker.
In admin Under user preferences "User's personal tracker information: View extra information" comes up with a blank page.
I will go thru your instrutions and see if I can get it to work.

Thanks


You are correct, if you shared the session variables and defined $user as a global, setting $user to something would mess up Tiki. I did that in a plugin once and it did not work well. But, since you are using it in a called program, I think it is OK. You can rename the variable to something else and it would still work.

It does talk about being able to change preferences in that User Tracker link that I gave above. It also talks about it here: User Preference FieldQuestion which uses the tracker field type of "User Preference" in a User Tracker. Sorry, but I have never tried that tracker option before. I have mainly used User Trackers to make it easier to identify who I am allowing to register.

Tom


I followed Toms instructions and installed user tracker on test site and entered a couple new users and got them verified, which was not simple.
This is results of both working and test site.
User Preferences: xxxx ->User's personal tracker information: View extra information
On working website
gives a blank page
On test website
gives "Fatal error: Call to a member function getFields() on a non-object in xxxx/tiki101/tiki-view_tracker_item.php on line 148"

both sites call same "tiki101/tiki-view_tracker_item.php"

Anyone got ideas, info or help?