Solved

Fatal error: Call to undefined function username_exists()

Posted on 2009-04-09
16
1,405 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
[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
  • 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: 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.

 
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 500 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Did you use a default hosting installation of wordpress with the intention of it being your actual site?  Maybe you’ve installed it as a Blog to your current site and recently converted it to be the main site and do away with the old .htm pages.  An…
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
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…

740 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