Conflict WPMUDEV Set Password and Profile Builder

I installed the WPMUDEV Set Password (SP) plugin and then Profile Builder (PB). Order is important there. I don’t know if I’m going to keep PB yet, I just need custom fields in user profiles.

I started seeing this error:

Fatal error: Cannot redeclare signup_password_random_password_filter() (previously declared in /home/gamechat/ in /home/gamechat/ on line 28

Looking at the code, it definitely seems like either PB or ST borrowed code from one another (no prob, FOSS rite?), but the ST code is more robust.

I searched the WPMUDEV forum for signup_password_random_password_filter and didn’t get a hit so I googled to see if there was an easy solution. That led me back here to this thread which didn’t show up with the local search. :slight_frown:

The two functions are similar but not enough to justify getting PB to use the ST function, or vice versa. (Hmm, I just noticed a couple bugs in the PB code.)

I’m wondering if ST needs this:

if ( ! function_exists( 'signup_password_random_password_filter' ) ) {
function signup_password_random_password_filter() {
return wpmu_signup_password_random_password_filter();

Unless something in WPMU code actually needs that non-namespaced function “signup_password_random_password_filter”, is there a reason to define it as a wrapper around the WPMU version? If not then I recommend simply removing it.

I don’t know if I can rely on PB registering before ST registers the wrapper, so I can’t count on the ST function to not get registered. For now I’ve just commented out the ST function and at least pages are loading again.

I’m hoping WPMUDEV can collaborate with Cozmoslabs on this so that we can get one function that does what we all need. Until then – any other suggestions?



  • Tony G
    • Mr. LetsFixTheWorld

    It looks like someone already modified the code between the time Vinod provided his solution and the current v1.1.2.3. So the solution needs minor reconsideration. (Would be nice if forum threads had comment trackbacks so that anyone seeing Vinod’s post would automatically get referred here, but I digress…:wink:

    Right now with the wpmu_ function registered as a random_password filter, both the PB and SP plugin functions will be executed, so the $password value could be generated twice. Since the priority is not set by either plugin in the add_filter, the last one executed would seem to be the lucky winner.

    The “! function exists” check is executed when the plugin loads. I believe the plugin load order is determined by the active_plugins array which is sorted alphabetically. It’s unknown if it was planned or luck that “profile builder” sorts before “set password”. But since PB (if activated) will be loaded before SP, that function_exists will be true, so the signup_password_random_password_filter wrapper will not be registered by SP. OK. It’s not being used by SP anyway. If PB is not activated, function_exists returns false, the function is registered … but it’s still not being used because add_filter now uses the wpmu_ version.

    See what I mean? There’s no reason for SP to register that function at all, so just remove that wrapper so that no one gets a conflict anymore and no one needs to consider Vinod’s solution.

    There’s still the issue of which version of signup_password_random_password_filter is better, or if they really both can or should be executed. That’s why I’m encouraging some discussion with the PB developers.

    This situation may need to be considered for all of the other wrappers in the SP plugin. The reasoning for the wrappers might be outdated.


  • Luís
    • Support

    Hi @tony,

    I hope had been good today!

    Thanks for your great advise and explanation.

    The functions have been modified in the version Set Password (as refered in the changelog) probably because of that situation.

    I’ve just moved this over to our Features and Feedback, so it can be taken into consideration for the next plugin updates. Doing this our developers will be informed about your suggestion.

    Cheers, Luís

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.