Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Fatal error: Call to undefined function username_exists()

Posted on 2009-04-09
16
Medium Priority
?
1,477 Views
Last Modified: 2012-08-13
Hi,
I am using Yaab Autoblogger plugin (you can google it to get the zip) for my site (breakingjist.com) and I am getting the following error when this plugin tries to fetch rss feeds automatically:
Fatal error: Call to undefined function username_exists() in /xxx/xxx/xxx/xxx/wp-content/plugins/Yaab/Yaab.php on line 5706. It used to work in version 2.7 and prior but i wanted to see if there was a simple fix for this before i consider downgrading.

Code on line 5706 in yaab.php:
if(!username_exists($thisauthor)) { wp_create_user($thisauthor,$pseudoauthor_pass,$pseudoauthor_email); }

Open in new window

0
Comment
Question by:super786
  • 9
  • 7
16 Comments
 
LVL 3

Expert Comment

by:Denisvt
ID: 24110534
username_exists()  is probably a simple function that does what it says. I fail to see why it would not be in 2.7.1 anymore, but by checking differences with the previous WP you could probably find it there and copy it to your blog ?
0
 
LVL 1

Author Comment

by:super786
ID: 24112660
it is there in both 2.7 and 2.7.1. I think the issue lies with the yaab.php
0
 
LVL 3

Expert Comment

by:Denisvt
ID: 24113597
It could be an issue with paths so now your plugin does not include that function as it used to.
At worst I believe you could copy that function from WP and paste it directly above that code you quote, at least the plugin would find it.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 
LVL 1

Author Comment

by:super786
ID: 24116395
sorry that did not work
0
 
LVL 3

Expert Comment

by:Denisvt
ID: 24116806
More details such as messages, errors or descriptions would help...
0
 
LVL 1

Author Comment

by:super786
ID: 24116881
Error message:
Fatal error: Call to undefined function username_exists() in /xxx/xxx/xxx/xxx/wp-content/plugins/Yaab/Yaab.php on line 5706.

I think it is referencing registration.php which has the function so not sure what is happening. I will attach the files ( registration and the yaab).
Yaab.txt
registration.txt
0
 
LVL 3

Expert Comment

by:Denisvt
ID: 24119134
You have to copy the function directly in the file trying to find it, this is what I suggested so if Yaab.php  keeps saying "Call to undefined function username_exists()" then the function was not copied in it.
I suggest you try and then report the results.
0
 
LVL 3

Expert Comment

by:Denisvt
ID: 24119180
Based on line 5705 the main script should indeed call "'/registration.php' )"

It does so with

require ( ABSPATH . WPINC . '/registration.php' );

so if it fails to include it, it will miss many required functions. You must make sure that file can be found at
ABSPATH . WPINC . '/registration.php
so when the path is correct your script will work.
0
 
LVL 1

Author Comment

by:super786
ID: 24127042
The problem is with the file trying to find "registration.php". The file exists at home/wp-includes/ but for some reason yaab.php is not finding it. I am not a php expert so not sure how to move forward with this. Can i hard code the path to registration.php instead of using ABSPATH . WPINC ?
0
 
LVL 3

Accepted Solution

by:
Denisvt earned 2000 total points
ID: 24127072
You could make your PHP display which values it finds for ABSPATH . WPINC (die and echo), or yes hard-code the path. What you have is a simple path issue, a file not found because the way it is referenced, your script does not find it.
0
 
LVL 1

Author Comment

by:super786
ID: 24127310
how would i code the "die and echo"?
0
 
LVL 3

Expert Comment

by:Denisvt
ID: 24128632
Just above the "require" line, make the script display the expected values:

die("I am looking for the required file below at ".ABSPATH . WPINC);

0
 
LVL 1

Author Comment

by:super786
ID: 24130288
The results were: "I am looking for the required file below at /hermes/web07d/b937/moo.spatel6549/wp-includes" which is correct. How would i hard code this?
0
 
LVL 1

Author Comment

by:super786
ID: 24130323
and this is the code in 'registration.php'
if(!username_exists)
{
function username_exists( $username ) {
	if ( $user = get_userdatabylogin( $username ) ) {
		return $user->ID;
	} else {
		return null;
	}
}
}

Open in new window

0
 
LVL 1

Author Comment

by:super786
ID: 24131237
I hard coded the path and got the same error.
0
 
LVL 1

Author Closing Comment

by:super786
ID: 31568581
i am no longer pursuing this issue. I have removed this plugin as it was not worth the hassle. The points will still be awarded for the time and effort.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Now that you've installed WordPress 2.9 (http://www.experts-exchange.com/articles/Web_Development/Blogs/WordPress/WordPress-2-9-What-to-Expect-When-Upgrading-to-WordPress-2-9.html?) on your site, you need to install some plugins to get the most out …
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
Suggested Courses

926 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