Solved

Fatal error: Call to undefined function username_exists()

Posted on 2009-04-09
16
1,413 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

WordPress can be pretty daunting, especially for a beginner, so I thought it might be a good idea to write an article to show how easy it is to get started in WordPress and to design a custom theme.  The first step is to check with your hosting comp…
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 users how to migrate an existing Wordpress website to a new domain.
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

751 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