Solved

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

Posted on 2014-04-08
8
19 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now