WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Customize Your Community] Error on the profile page shows backend (19 posts)

  1. adam.codefor
    Member
    Posted 5 years ago #

    I am using customize-your-community plugin and have a custom profile page which works great - however if a users removes the email field and clicks submit the errors and form appears on the backend and not in the frontend site anyone know of a quick fix?

    Cheers

  2. blade.runner
    Member
    Posted 5 years ago #

    Same Problem here.

  3. adam.codefor
    Member
    Posted 5 years ago #

    It's a pretty big bug to be honest, the idea of the plugin is to block backend access this is a massive hole that lets users in...

  4. houseofstrauss
    Member
    Posted 5 years ago #

    I have the exact same probelm, when users make a mistake, the error page loads in the original backend of wordpress. Unfortunately the URL is the same as profile.php so I don't know how to redirect users away from it.

    This is a major problem for my setup as I'm using the prologue theme. Really looking for some help to resolve this...

    Many thanks anyone!!

  5. acescence
    Member
    Posted 5 years ago #

    i'm trying to solve this myself. as a quick hack i added a bit of javascript to prevent submitting the form if the email field is blank.

  6. houseofstrauss
    Member
    Posted 5 years ago #

    There is another check on the password fields as well. If they are not the same or one is missing it reports an error also :(

    Please post here if you get a result. Thanks...

  7. do77
    Member
    Posted 5 years ago #

    Yeah, I just figured out the problem with the new password too! At least I found a "solution" for the E-mail thing. I just don't give my users the chance to change their E-mail address afterwards and added disabled="disabled" to the input field. How often do you really want to change your E-mail address?

  8. do77
    Member
    Posted 5 years ago #

    Just figured out that you get an error after the second login when you try to change something :(

  9. houseofstrauss
    Member
    Posted 5 years ago #

    http://wordpress.org/extend/plugins/theme-my-login/ is a similar plugin that works and appears to be supported. Takes the current theme template for login/profile/(including error messages) password reset and registration screens.

  10. adam.codefor
    Member
    Posted 5 years ago #

    its a shame to stop using the CYC plugin because it is great, but after a month of no word or solution to what is a pretty big problem, it looks like I will be using the theme-my-login as it is pretty similar and more frequently updated. Cheers for the link houseofstrauss

  11. adam.codefor
    Member
    Posted 5 years ago #

    do77 - i guess if you add some javascript to validate the matching passwords too that would work, but dont forget people can just disable javascript and get round it, it needs to be sever side really.

  12. houseofstrauss
    Member
    Posted 5 years ago #

    @ adam.codefor No problem ... I am very surprised it was never debugged sooner than this. Anyways, theme-my-login does the job quite well.

  13. adam.codefor
    Member
    Posted 5 years ago #

    yeah I have been using theme-my-login for a week or so now and it is far better, no problems at all =D

  14. nomatteus
    Member
    Posted 5 years ago #

    I ran into the exact same problem, and it's pretty much a dealbreaker if it can't be fixed. So I played around with the code and managed to put together a fix. (I haven't tried the alternative plugin mentioned above--it may be better, but regardless this is a fix for anyone that wants to keep using the CYC plugin!)

    Nothing elegant, but prevents users seeing the admin screen!

    This involves editing the following two files:

    1. /wp-admin/user-edit.php -- CORE WordPress file
    2. /wp-content/plugins/customize-your-community/cyc.php -- Main Plugin File

    As you should always do, be sure to make a backup to these files before going in and editing them!

    In /wp-admin/user-edit.php, find the following (~line 143):

    if ( !is_wp_error( $errors ) ) {
    	$redirect = ($is_profile_page? "profile.php?" : "user-edit.php?user_id=$user_id&"). "updated=true";
    	$redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
    	wp_redirect($redirect);
    	exit;
    }

    and change it to (adding an elseif statment):

    if ( !is_wp_error( $errors ) ) {
    	$redirect = ($is_profile_page? "profile.php?" : "user-edit.php?user_id=$user_id&"). "updated=true";
    	$redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
    	wp_redirect($redirect);
    	exit;
    } elseif ($is_profile_page) {
    	$redirect = "profile.php?" . "errors=" . urlencode(implode('||',$errors->get_error_messages()));
    	wp_redirect($redirect);
    	exit;
    }

    What this does it redirects back to the profile.php page (which will be the non-admin styled one), and sends a get variable with the output text of the errors. It's sent as a "piped" array.

    Second, open up /wp-content/plugins/customize-your-community/cyc.php, and find the following (~line 275):

    if ($_GET['updated'] == true) {
    	echo '<p class="message">Your profile has been updated.</p>';
    }

    and change it to (again adding an elseif statment):

    if ($_GET['updated'] == true) {
    	echo '<p class="message">Your profile has been updated.</p>';
    } elseif ($_GET['errors'] != "") {
    	$error_messages = explode("||", $_GET['errors']);
    	echo '<p class="message">';
    	foreach ($error_messages as $the_msg) {
    		echo "$the_msg<br />";
    	}
    	echo '</p>';
    }

    This looks for the errors GET variable and if found, prints out each error message. This code can be changed to display the errors however you like, for example in a red box, etc.

    This should solve the problem. If anyone tries this out let me know if it works for you!

    An important note: Since you've changed a core WordPress file and also the plugin code, you'll have to be careful when upgrading both the WordPress core and the plugin. You either will have to upgrade manually, or make the above changes again after doing an automatic upgrade.

    That should be it! Hopefully a real fix will make it into a future CYC version...

    Matt

  15. randyhoyt
    Member
    Posted 5 years ago #

    @nomatteus

    I cannot thank you enough for providing this fix. I was too far into a project with CYC to switch to something different, though I expect I will be trying Theme My Login for future projects.

    Thanks again!
    ~randy

  16. anupamjain
    Member
    Posted 5 years ago #

    nomatteus ! You are a saviour !

    I have been struggling with the code to get around this CYC bug for I-dont-know-how-many-hours now !

    Your logic works pretty well !!

    I dont know how to thank you for this. Thanks a lot !

    Regards
    Anupam

  17. soso
    Member
    Posted 5 years ago #

    On WordPress 2.8 and above the code provided by nomatteus does not work.

    To make it work you have to change elseif ($is_profile_page) to elseif (IS_PROFILE_PAGE) in /wp-admin/user-edit.php

    Regards, Sorin

  18. Rodrigo Primo
    Member
    Posted 4 years ago #

    I have the same issue trying the last version of Customize Your Community (1.2.1) plugin with WordPress 2.8.6. If an error occurs the error message appear in the default WordPress profile page and not in the customized one. Is this fix on the roadmap of the plugin?

  19. jebmusic
    Member
    Posted 4 years ago #

    This is the plugin I'm looking for. Has anyone managed to fix the bugs yet?

Topic Closed

This topic has been closed to new replies.

About this Topic