How to use in most of the world

Questions related to installing Zuluru 1: Locked now, all new installations should use Zuluru 3
dcrobertson01
Posts: 20
Joined: Tue Mar 22, 2016 12:24 am

How to use in most of the world

Post by dcrobertson01 »

Hi - I am having trouble getting past the Edit Your Profile screen while installing Zuluru.

First, Zuluru required a Canadian post code. I posted a question to face book, and followed the instructions there - for anyone here, they were

Update the code

Code: Select all

cd /path to zuluru/
sudo git pull
Edit the models/behaviors/formatter.php file, adding return $num;" right after "$num = clean($num);"

Code: Select all

	// Reformat a phone number into a standard format.
	// Returns the original input if the input is not something we recognize as being a phone number.
	// This function explicitly does *not* handle extensions.
	function phone_format ($num)
	{
		$num = clean ($num);
		return $num;

		if (empty ($num))
			return '';

		// Trim off leading "1", we all know it

		if (substr ($num, 0, 1) == 1)
			$num = substr ($num, 1);

		// Check for area code
		if (strlen ($num) == 10)
		{
			$new = '(' . substr ($num, 0, 3) . ') ';
			$num = substr ($num, 3);
		}
		else
		{
			$new = '';
		}

		// Check for local number
		if (strlen ($num) == 7)
		{
			$new .= substr ($num, 0, 3) . '-' . substr ($num, 3, 4);
			return $new;
		}


		return $num;
	}
Now, when I fill out the profile, I get a warning at the top of the page:

The account could not be saved. Please correct the errors below and try again.

But there are no errors highlighted in the form - they all appear to be fine.

I have had a look at the code, and the changes made to models/person.php are showing up, and if I put in an incompatible NZ post code, I get an error showing up. Also if I put in a incompatible Home Phone Number, I get an error - so that bit seems to work.

But when I put in compatible numbers, I just get the warning and no error showing up on the page.

Any help appreciated

Cheers

Don
GregS
Site Admin
Posts: 240
Joined: Thu Jan 06, 2011 4:58 pm

Re: How to use in most of the world

Post by GregS »

Strange, I've tested the changes here, and it works okay for me. Let's see what we can do to fix this for you.

First question is always whether you have debug set to 2 in config/core.php. It's possible that there are PHP warnings or errors being hidden from you if this is set to 0; if you're using a recent version of PHP, CakePHP 1.3 (which Zuluru uses) has some minor issues. This should also let you see the SQL log, in case it's somehow an error inserting the new record.

Next, if debug is set to 2 and you're still not seeing anything that gives you any clues, try adding these "pr" calls (which generate debug output) into controllers/users_controller.php immediately before the final "else" in "create_account" (this should be at about line 255) so that it looks like this:

Code: Select all

...
                    $this->redirect('/');
                }
            }
            pr('These are the validation errors:');
            pr($this->Auth->authenticate->validationErrors);
            pr($this->Person->validationErrors);
            pr($this->Person->Skill->validationErrors);
            pr($this->Person->Group->validationErrors);
            pr($this->Person->Affiliate->validationErrors);
        } else {
            // By default, select the first group
...
(Note: This assumes that you're trying to create an account, not edit an existing profile. If you're doing the latter, there will be similar changes to try in controllers/people_controller.php)

One way or another, this should give us some additional information to track down the problem.
dcrobertson01
Posts: 20
Joined: Tue Mar 22, 2016 12:24 am

Re: How to use in most of the world

Post by dcrobertson01 »

I am using the latest cake 1.3 release. I think 1.3.20. I don't have time to investigate further right now - if you want me to use cake 1.3.6, let me know.

Do you plan to update to a more recent cake release? I don't know a lot about cake, but see they are on version 3.something now.
GregS
Site Admin
Posts: 240
Joined: Thu Jan 06, 2011 4:58 pm

Re: How to use in most of the world

Post by GregS »

I haven't tried with Cake 1.3.20, but I expect that it should work there, as I don't believe they've made any incompatible changes.

I've been working for a while now on upgrading to CakePHP 3 (3.2 now), but with the size of the application and the number of backward-incompatible changes they have made in going from 1.x to 2.x and then 3.x, it's a pretty massive project. Hoping to have it ready for general release in June. You'll be happy to hear that it is much better at handling the various international standards for phone numbers and postal codes!
dcrobertson01
Posts: 20
Joined: Tue Mar 22, 2016 12:24 am

Re: How to use in most of the world

Post by dcrobertson01 »

Hi - I set debug to 2, and got a lot of sql statements, but nothing in the 'error' column. Then I added the pr calls, and did not get any more info. I didn't see anything in the apache logs either.

I can send you the sql statements if you would like. I just installed cake 1.3.6, and got a page full of errors - cake 1.3.6 is incompatible with my version of PHP (5.5.9), so cannot try with that.

Just reinstalled on cake 1.3.21. Same as on 1.3.20. I do notice in the listed sql statements there are no insert statements.

Code: Select all

Nr	Query	Error	Affected	Num. rows	Took (ms)
1	SHOW FULL COLUMNS FROM `users`		6	6	1
2	SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE COLLATION_NAME= 'utf8_general_ci';		1	1	1
3	SHOW FULL COLUMNS FROM `people`		38	38	1
4	SHOW FULL COLUMNS FROM `skills`		6	6	1
5	SHOW FULL COLUMNS FROM `allstars`		3	3	1
6	SHOW FULL COLUMNS FROM `games`		27	27	1
7	SHOW FULL COLUMNS FROM `divisions`		28	28	1
8	SHOW FULL COLUMNS FROM `leagues`		16	16	1
9	SHOW FULL COLUMNS FROM `affiliates`		3	3	1
10	SHOW FULL COLUMNS FROM `badges`		9	9	1
11	SHOW FULL COLUMNS FROM `badges_people`		13	13	1
12	SHOW FULL COLUMNS FROM `attendances`		10	10	1
13	SHOW FULL COLUMNS FROM `teams`		23	23	1
14	SHOW FULL COLUMNS FROM `fields`		15	15	1
15	SHOW FULL COLUMNS FROM `facilities`		19	19	1
16	SHOW FULL COLUMNS FROM `regions`		3	3	1
17	SHOW FULL COLUMNS FROM `game_slots`		6	6	1
18	SHOW FULL COLUMNS FROM `division_gameslot_availabilities`		3	3	1
19	SHOW FULL COLUMNS FROM `incidents`		5	5	1
20	SHOW FULL COLUMNS FROM `team_events`		13	13	1
21	SHOW FULL COLUMNS FROM `activity_logs`		9	9	1
22	SHOW FULL COLUMNS FROM `notes`		11	11	1
23	SHOW FULL COLUMNS FROM `stats`		6	6	1
24	SHOW FULL COLUMNS FROM `stat_types`		14	14	1
25	SHOW FULL COLUMNS FROM `franchises`		4	4	1
26	SHOW FULL COLUMNS FROM `franchises_people`		3	3	1
27	SHOW FULL COLUMNS FROM `franchises_teams`		3	3	1
28	SHOW FULL COLUMNS FROM `teams_people`		8	8	1
29	SHOW FULL COLUMNS FROM `teams_facilities`		4	4	1
30	SHOW FULL COLUMNS FROM `preregistrations`		3	3	1
31	SHOW FULL COLUMNS FROM `events`		13	13	1
32	SHOW FULL COLUMNS FROM `event_types`		3	3	1
33	SHOW FULL COLUMNS FROM `questionnaires`		4	4	1
34	SHOW FULL COLUMNS FROM `questions`		7	7	1
35	SHOW FULL COLUMNS FROM `answers`		5	5	1
36	SHOW FULL COLUMNS FROM `questionnaires_questions`		5	5	1
37	SHOW FULL COLUMNS FROM `prices`		17	17	1
38	SHOW FULL COLUMNS FROM `registrations`		12	12	1
39	SHOW FULL COLUMNS FROM `payments`		11	11	1
40	SHOW FULL COLUMNS FROM `registration_audits`		17	17	1
41	SHOW FULL COLUMNS FROM `responses`		6	6	1
42	SHOW FULL COLUMNS FROM `events_connections`		4	4	1
43	SHOW FULL COLUMNS FROM `credits`		8	8	1
44	SHOW FULL COLUMNS FROM `settings`		6	6	1
45	SHOW FULL COLUMNS FROM `uploads`		9	9	1
46	SHOW FULL COLUMNS FROM `upload_types`		3	3	1
47	SHOW FULL COLUMNS FROM `subscriptions`		5	5	1
48	SHOW FULL COLUMNS FROM `task_slots`		9	9	1
49	SHOW FULL COLUMNS FROM `tasks`		8	8	1
50	SHOW FULL COLUMNS FROM `categories`		3	3	1
51	SHOW FULL COLUMNS FROM `groups`		5	5	1
52	SHOW FULL COLUMNS FROM `groups_people`		3	3	1
53	SHOW FULL COLUMNS FROM `waivers`		12	12	1
54	SHOW FULL COLUMNS FROM `waivers_people`		6	6	1
55	SHOW FULL COLUMNS FROM `affiliates_people`		4	4	1
56	SHOW FULL COLUMNS FROM `divisions_people`		4	4	1
57	SHOW FULL COLUMNS FROM `people_people`		5	5	1
58	SHOW FULL COLUMNS FROM `holidays`		4	4	1
59	SHOW FULL COLUMNS FROM `mailing_lists`		5	5	1
60	SHOW FULL COLUMNS FROM `newsletters`		13	13	1
61	SHOW FULL COLUMNS FROM `leagues_stat_types`		2	2	1
62	SHOW FULL COLUMNS FROM `pools`		5	5	1
63	SHOW FULL COLUMNS FROM `pools_teams`		8	8	1
64	SHOW FULL COLUMNS FROM `days`		3	3	1
65	SHOW FULL COLUMNS FROM `divisions_days`		2	2	1
66	SHOW FULL COLUMNS FROM `score_details`		8	8	1
67	SHOW FULL COLUMNS FROM `score_detail_stats`		4	4	1
68	SHOW FULL COLUMNS FROM `score_entries`		11	11	1
69	SHOW FULL COLUMNS FROM `spirit_entries`		20	20	1
70	SHOW FULL COLUMNS FROM `provinces`		2	2	1
71	SHOW FULL COLUMNS FROM `countries`		2	2	1
72	SELECT `Configuration`.`id`, `Configuration`.`affiliate_id`, `Configuration`.`person_id`, `Configuration`.`category`, `Configuration`.`name`, `Configuration`.`value` FROM `settings` AS `Configuration` WHERE `category` != '' AND `affiliate_id` IS NULL AND ((`category` != 'personal') OR (`person_id` = 1)) 		116	116	0
73	SELECT COUNT(*) AS `count` FROM `people` AS `Person` LEFT JOIN `affiliates_people` AS `AffiliatePerson` ON (`AffiliatePerson`.`person_id` = `Person`.`id`) WHERE `Person`.`status` = 'new' AND `Person`.`complete` = 1 AND `AffiliatePerson`.`affiliate_id` = (1) 		1	1	0
74	SELECT COUNT(*) AS `count` FROM `uploads` AS `Upload` LEFT JOIN `people` AS `Person` ON (`Upload`.`person_id` = `Person`.`id`) LEFT JOIN `upload_types` AS `UploadType` ON (`Upload`.`type_id` = `UploadType`.`id`) WHERE `approved` = 0 AND `type_id` IS NULL 		1	1	0
75	SELECT `Group`.`id`, `Group`.`name` FROM `groups` AS `Group` WHERE ((`id` = 1) OR (`active` = 1)) ORDER BY `Group`.`level` ASC, `Group`.`id` ASC 		7	7	0
76	SELECT `Province`.`id`, `Province`.`name` FROM `provinces` AS `Province` WHERE 1 = 1 		1	1	0
77	SELECT `Country`.`id`, `Country`.`name` FROM `countries` AS `Country` WHERE 1 = 1 		1	1	0
78	SELECT `Group`.`id`, `Group`.`name`, `Group`.`active`, `Group`.`level`, `Group`.`description` FROM `groups` AS `Group` WHERE ((`id` = 1) OR (`active` = 1)) ORDER BY `Group`.`level` ASC, `Group`.`id` ASC 		7	7	0
79	SELECT `Affiliate`.`id`, `Affiliate`.`name`, `Affiliate`.`active` FROM `affiliates` AS `Affiliate` WHERE `active` = 1 AND NOT (`id` IS NULL) ORDER BY `name` ASC 		1	1	0
80	SELECT `Person`.`id`, `Person`.`user_id`, `Person`.`first_name`, `Person`.`last_name`, `Person`.`publish_email`, `Person`.`home_phone`, `Person`.`publish_home_phone`, `Person`.`work_phone`, `Person`.`work_ext`, `Person`.`publish_work_phone`, `Person`.`mobile_phone`, `Person`.`publish_mobile_phone`, `Person`.`alternate_first_name`, `Person`.`alternate_last_name`, `Person`.`alternate_email`, `Person`.`publish_alternate_email`, `Person`.`alternate_work_phone`, `Person`.`alternate_work_ext`, `Person`.`publish_alternate_work_phone`, `Person`.`alternate_mobile_phone`, `Person`.`publish_alternate_mobile_phone`, `Person`.`addr_street`, `Person`.`addr_city`, `Person`.`addr_prov`, `Person`.`addr_country`, `Person`.`addr_postalcode`, `Person`.`gender`, `Person`.`birthdate`, `Person`.`height`, `Person`.`shirt_size`, `Person`.`status`, `Person`.`has_dog`, `Person`.`contact_for_feedback`, `Person`.`show_gravatar`, `Person`.`twitter_token`, `Person`.`twitter_secret`, `Person`.`complete`, `Person`.`updated`, `User`.`id`, `User`.`user_name`, `User`.`password`, `User`.`email`, `User`.`last_login`, `User`.`client_ip` FROM `people` AS `Person` LEFT JOIN `users` AS `User` ON (`Person`.`user_id` = `User`.`id`) WHERE `Person`.`id` = 1 LIMIT 1		1	1	0
81	SELECT `Skill`.`id`, `Skill`.`person_id`, `Skill`.`sport`, `Skill`.`enabled`, `Skill`.`skill_level`, `Skill`.`year_started` FROM `skills` AS `Skill` WHERE `Skill`.`person_id` = (1) 		0	0	0
82	SELECT `Affiliate`.`id`, `Affiliate`.`name`, `Affiliate`.`active`, `AffiliatesPerson`.`id`, `AffiliatesPerson`.`affiliate_id`, `AffiliatesPerson`.`person_id`, `AffiliatesPerson`.`position` FROM `affiliates` AS `Affiliate` JOIN `affiliates_people` AS `AffiliatesPerson` ON (`AffiliatesPerson`.`person_id` = 1 AND `AffiliatesPerson`.`affiliate_id` = `Affiliate`.`id`) 		1	1	0
83	SELECT `Group`.`id`, `Group`.`name`, `Group`.`active`, `Group`.`level`, `Group`.`description`, `GroupsPerson`.`id`, `GroupsPerson`.`person_id`, `GroupsPerson`.`group_id` FROM `groups` AS `Group` JOIN `groups_people` AS `GroupsPerson` ON (`GroupsPerson`.`person_id` = 1 AND `GroupsPerson`.`group_id` = `Group`.`id`) 		1	1	0
84	SELECT `Province`.`id`, `Province`.`name` FROM `provinces` AS `Province` WHERE 1 = 1 		1	1	0
85	SELECT `Country`.`id`, `Country`.`name` FROM `countries` AS `Country` WHERE 1 = 1 		1	1	0
86	SELECT `Upload`.`id`, `Upload`.`person_id`, `Upload`.`type_id`, `Upload`.`filename`, `Upload`.`approved`, `Upload`.`valid_from`, `Upload`.`valid_until`, `Upload`.`created`, `Upload`.`updated` FROM `uploads` AS `Upload` WHERE `person_id` = 1 AND `type_id` IS NULL LIMIT 1		0	0	0
87	SHOW FULL COLUMNS FROM `notices`		7	7	1
88	SHOW FULL COLUMNS FROM `notices_people`		5	5	1
89	SELECT `Configuration`.`id`, `Configuration`.`affiliate_id`, `Configuration`.`person_id`, `Configuration`.`category`, `Configuration`.`name`, `Configuration`.`value` FROM `settings` AS `Configuration` WHERE `category` != '' AND `affiliate_id` IS NULL AND ((`category` != 'personal') OR (`person_id` = 1)) 		116	116	0
dcrobertson01
Posts: 20
Joined: Tue Mar 22, 2016 12:24 am

Re: How to use in most of the world

Post by dcrobertson01 »

I am seeing this in the apache error log. It appears to refer to an install problem - I did not see any errors on the web page while installing though. When I submit the edit your profile form, I don't see any errors - though I have not upped the error reporting for php.

This post http://zuluru.org/forums/viewtopic.php?f=3&t=84 didn't help :-(

Code: Select all

[Thu Mar 24 10:12:06.448821 2016] [:error] [pid 9204] [client 10.0.0.140:59464] PHP Fatal error:  Class name must be a valid object or a string in /var/www/html/cakephp-1.3.21/cake/libs/class_registry.php on line 142
[Thu Mar 24 10:12:11.003260 2016] [:error] [pid 16269] [client 10.0.0.140:59466] PHP Fatal error:  Class name must be a valid object or a string in /var/www/html/cakephp-1.3.21/cake/libs/class_registry.php on line 142, referer: https://www.rnet.duckdns.org/cakephp-1.3.21/zuluru/install
[Thu Mar 24 10:12:11.008745 2016] [:error] [pid 4905] [client 10.0.0.140:59470] PHP Fatal error:  Class name must be a valid object or a string in /var/www/html/cakephp-1.3.21/cake/libs/class_registry.php on line 142, referer: https://www.rnet.duckdns.org/cakephp-1.3.21/zuluru/install
[Thu Mar 24 10:12:11.012912 2016] [:error] [pid 14768] [client 10.0.0.140:59468] PHP Fatal error:  Class name must be a valid object or a string in /var/www/html/cakephp-1.3.21/cake/libs/class_registry.php on line 142, referer: https://www.rnet.duckdns.org/cakephp-1.3.21/zuluru/install
[Thu Mar 24 10:12:21.737090 2016] [:error] [pid 9204] [client 10.0.0.140:59474] PHP Fatal error:  Class name must be a valid object or a string in /var/www/html/cakephp-1.3.21/cake/libs/class_registry.php on line 142, referer: https://www.rnet.duckdns.org/cakephp-1.3.21/zuluru/install/install/settings
[Thu Mar 24 10:12:21.749793 2016] [:error] [pid 9093] [client 10.0.0.140:59478] PHP Fatal error:  Class name must be a valid object or a string in /var/www/html/cakephp-1.3.21/cake/libs/class_registry.php on line 142, referer: https://www.rnet.duckdns.org/cakephp-1.3.21/zuluru/install/install/settings
[Thu Mar 24 10:12:21.749793 2016] [:error] [pid 9231] [client 10.0.0.140:59476] PHP Fatal error:  Class name must be a valid object or a string in /var/www/html/cakephp-1.3.21/cake/libs/class_registry.php on line 142, referer: https://www.rnet.duckdns.org/cakephp-1.3.21/zuluru/install/install/settings
GregS
Site Admin
Posts: 240
Joined: Thu Jan 06, 2011 4:58 pm

Re: How to use in most of the world

Post by GregS »

The fact that there are no inserts is a strong indication that it's validation that's failing somewhere, not a SQL error. I've added a few more pr()s in the code previously posted, though I wouldn't expect them to be the problem. Also included a little header message so that you can be sure that you are hitting the code as expected; if you don't see that message then you've got the code in the wrong spot! From the SQL you posted, it looks like you're editing the admin profile, not adding a new account? If that's true, the pr() calls need to be in controllers/people_controller.php around line 1060. It will look like this:

Code: Select all

...
                } else {
                    $this->Session->setFlash(sprintf(__('The %s could not be saved. Please correct the errors below and try again.', true), __('person', true)), 'default', array('class' => 'warning'));
                }
            } else {
                $this->Session->setFlash(sprintf(__('The %s could not be saved. Please correct the errors below and try again.', true), __('account', true)), 'default', array('class' => 'warning'));
            }
            // Make the insertions right here
        }
        if (empty($this->data)) {
...
dcrobertson01
Posts: 20
Joined: Tue Mar 22, 2016 12:24 am

Re: How to use in most of the world

Post by dcrobertson01 »

I will try to take a look tomorrow. But yes, I am trying to get past the first configure user page for the admin user. At the moment I cannot do anything until the admin profile is saved.

I could install a VM and put an older php on it, then use the older cake, but that wouldn't work on my budget hosting. And my machines are not that fast.
dcrobertson01
Posts: 20
Joined: Tue Mar 22, 2016 12:24 am

Re: How to use in most of the world

Post by dcrobertson01 »

Okay - adding the pr lines to the people controller gives me

These are the validation errors:

Code: Select all

Array
(
)

Array
(
    [gender] => You must select a gender.
    [birthdate] => You must provide a valid birthdate.
    [height] => You must enter a valid height.
    [shirt_size] => You must select a valid shirt size.
)

Array
(
)

Array
(
)

Array
(
)
GregS
Site Admin
Posts: 240
Joined: Thu Jan 06, 2011 4:58 pm

Re: How to use in most of the world

Post by GregS »

Those are all fields that are required for players, but should not be for non-players. Am I correct that you do not have the "Player" box checked at the top of the page in the "Account Type" section? If you check that, these fields should show up, and if you fill them in you should be able to proceed. If that works for you, I can look into why it's not working correctly.
Locked