Solved

Help, need to compare 2 php files and fix the old one

Posted on 2014-04-08
8
23 Views
Last Modified: 2016-05-21
Hello, I have a big problem and I need help please.

After wordpress updating from 3.5.2 to 3.6+ I have a problem with a specific function of a php file.

This file is responsible for any extra user data (eg city, country, etc.) which are stored in wp_usermeta table.
My knowledge in php is minimal. I managed and found a newer file but has too many differences and I can not figure out which are the data I need.

The old one works fine for everything else except this piece of code:

        $_POST['form']['ID'] 		= $userdata->ID;
		$_POST['form']['jabber']  	= $_POST['address']['country']."**";
		$_POST['form']['jabber'] 	.= $_POST['address']['state']."**";
		$_POST['form']['jabber'] 	.= $_POST['address']['address']."**";
		$_POST['form']['jabber'] 	.= $_POST['address']['city']."**";
		$_POST['form']['jabber'] 	.= $_POST['address']['zip']."**";
		$_POST['form']['jabber'] 	.= $_POST['address']['phone'];

Open in new window


This piece of code if operated, would create inside wp_usermeta table, a meta_key "jabber" & a meta_value "country*state*address*city*zip*phone"

This file is also responsible for other things like User Name, Surname, email, orders etc. Everything works fine except the previous code.

I have also try to manually add the records in database and my sript read the user data without problems, the only problem is to save the data.

This is the old php file with the problem:
OldPhp

This is the new one I found but it has many changes:
NewPhp


Please help me, Nicolas
0
Comment
Question by:Nicolas Lagios
8 Comments
 
LVL 35

Expert Comment

by:Terry Woods
ID: 39987852
Can you describe in which way it is breaking? eg is it throwing an error?
0
 
LVL 15

Expert Comment

by:eemit
ID: 39988408
- Make a backup first then
- Update to WordPress 3.8.2
- Post here if error still occur
0
 

Author Comment

by:Nicolas Lagios
ID: 39988626
TerryAtOpus
No its not an error. The problem is that I can't save the user extra data, city country etc, but everything else works

eemit
After wordpress updating to 3.8.2, the problem still remains.


A guy in stackoverflow site told me:
ust realised it's a plugin (opened link). Are you sure it is those lines of code that's causing it? Steps to debug would be- check the $_POST data and then if that checks out, have a look at the $userdata variable and make sure it's not using a deprecated function

What should I do? My php knowledge are limited.
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 15

Expert Comment

by:eemit
ID: 39990977
1)
Files you have posted are the same

2)
As this is a commercial theme, you need to seek support from the theme vendors.
0
 
LVL 35

Accepted Solution

by:
Terry Woods earned 500 total points
ID: 39993206
@eemit, the posted files are different for me; maybe you made a mistake?

Anyway, I've made an attempt at modifying the "new" code to incorporate the post data like the old code does. My changes are clearly labelled.

Please find the code attached.
ee-new.php
0
 
LVL 35

Expert Comment

by:Terry Woods
ID: 39993208
It's reasonably likely that it won't work; it's clearly not meant to be modified in the way you've modified it.

However, it does look like the new code is intended to handle custom data (in a way that's meant to be done!). The code labelled with "// SAVE THE CUSTOM PROFILE DATA" indicates that. Perhaps you can find something that makes use of it for collecting your extra data?
0
 
LVL 8

Expert Comment

by:Sam Cohen
ID: 40334003
Download sublimetext http://www.sublimetext.com/
It has a excellent file comparing feature..
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question