Solved

Fatal error: Call to undefined function username_exists()

Posted on 2009-04-09
16
1,430 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

How to install BuddyPress on your self-hosted WordPress site It’s been called everything from “social networking in a box” to “Facebook without the terms of service,” but until Feb. 16, BuddyPress was a relatively unknown outside the WordPress MU…
Wordpress Horizontal Drop-Down Menu In this tutorial I will show you had to add a WordPress horizontal navigation menu to your theme. I have searched and searched for a good tutorial on creating a WordPress nav menu without adding a plug-in or us…
The purpose of this video is to demonstrate how to properly insert a Vimeo Video into a WordPress site or Blog. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…

623 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