Solved

Fatal error: Call to undefined function username_exists()

Posted on 2009-04-09
16
1,373 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 1

Author Comment

by:super786
Comment Utility
sorry that did not work
0
 
LVL 3

Expert Comment

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

Author Comment

by:super786
Comment Utility
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
Comment Utility
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
Comment Utility
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
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 1

Author Comment

by:super786
Comment Utility
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 500 total points
Comment Utility
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
Comment Utility
how would i code the "die and echo"?
0
 
LVL 3

Expert Comment

by:Denisvt
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
I hard coded the path and got the same error.
0
 
LVL 1

Author Closing Comment

by:super786
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
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. …

772 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

11 Experts available now in Live!

Get 1:1 Help Now