?
Solved

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

Posted on 2014-04-08
8
Medium Priority
?
27 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

 
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 2000 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

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

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

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this article, we’ll look at how to deploy ProxySQL.
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
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…
Suggested Courses

752 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