Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Edit Profile in menu

I have a problem, my users can't see "Edit Profile" in this menu:

Admin:

User:

This is very strange, because I have the permissions so that the user can edit their profile.

I have using "Pure" Theme, but too don't work on Default theme.

Comments

  • I am having the same problem.

  • This is so sad.

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP
    edited February 2016

    @akira_txt

    What happens if, as a logged-user, you visit yourforum.com/profile/edit ?

    I can only think that there is a theme or plugin issue.

    The link shows on my custom theme, and with default theme.

  • I switched back to the default theme and it worked fine. My developers were able to fix the glitch on our other theme but I am not sure what they did to fix it...

  • edited February 2016

    @whu606

    Now I can see the edit profile with that link, but now Im using default theme and not show me Edit Profile in menu.

    Dont show me the link with Default Theme:

  • edited February 2016

    Im testing with all plugins disabled and don't show "Edit Profile"

    Plugins Enabled and same:

    If I change the role for a user "Member to Administrator", the user can see "Edit Profile".

  • R_JR_J Ex-Fanboy Munich Admin

    The html code is generated if a) the user is logged in and b) he has the Garden.Users.Edit or Moderation.Profiles.Edit permission.

    If you do not see it, but can access the edit profile page, I can think of only the following problems:
    1. You use some CSS that hide the menu entry: inspect the html source and search for "SpEditProfile". If you find it in the html source, you have a "CSS problem"
    2. Something is still overriding the view of the me module. Delete the ini files in the /cache folder and try again.
    3. You've messed around with core files. Re-upload Vanilla (backup your .htaccess if you've made changes to it) and try again.

  • noncenonce Necro-on Forensics
    edited February 2016

    @akira_txt based on logic and reading the code. all good answers above, if still you have an issue.

    you are using the default theme and no plugins and have the problem.
    you have a problem with members but not admins.

    Garden.Users.Edit or Moderation.Profiles.Edit permissions allow presentation of the edit profile link (but this would only help admin and moderators) and you only have problems with members not seeing the link.

    the profile edit check box in the role is checked.

    the next step is to check and see if when you upgraded to 2.2 is if you properly copied over the config-defaults.php
    which has a config statement which controls editing profile being added to the menu.

    $Configuration['Garden']['UserAccount']['AllowEdit'] = TRUE; // allows profile edit line to appear.

    if this line above is in config-defaults.php as it should be, then check your config.php and see if you added

    $Configuration['Garden']['UserAccount']['AllowEdit'] = FALSE; // prevents profile edit line from appearing

    if it says FALSE in config.php or if you don't have the "TRUE" line in config-defaults.php then this is the reason for your problem.
    $Configuration['Garden']['UserAccount']['AllowEdit'] = TRUE;

    points being always copy the new config-defaults.php when upgrading and don't modify it.

    the other possibility is if your permissions column in the user table for the specific user.

    you followed good steps

    • use default theme and disable plugins when troubleshooting.
    • delete ini files in cache folder.
    • reset permissions for role (re-check and save role permissions).
    • if problem still occurs recopy core files (which would update your config-defaults.php)
    • check your config.php to see if a config statement creates your issue.
  • edited February 2016

    I see the problem, when I set the method of registration via "Connect" :

    Can't see "Edit Profile" and I see "Preferences", but If I change the method to "Basic" can see "Edit Profile".

    How can I fix this? I want accept only users via Connect.

    Sorry for my bad english btw.

  • jackmaessenjackmaessen ✭✭✭
    edited February 2016

    Well it seems that the link Edit Profile is disabled by default in library/core/functions.render.php

    There is this function about line 555 in the file:

    function hasEditProfile($userID) {
            if (checkPermission(array('Garden.Users.Edit', 'Moderation.Profiles.Edit'))) {
                return true;
            }
            if ($userID != Gdn::Session()->UserID) {
                return false;
            }
    
            $result = checkPermission('Garden.Profiles.Edit') && C('Garden.UserAccount.AllowEdit');
    
            $result &= (
                C('Garden.Profile.Titles') ||
                C('Garden.Profile.Locations', false) ||
                C('Garden.Registration.Method') != 'Connect'
            );
    
            return $result;
        }
    

    Disable Connect on line 14 above by leaving it empty between the ''

    So:

    C('Garden.Registration.Method') != ''

    NOTE:

    This is a core file, so better do not change this in the file functions.render.php
    To achieve the same result, without modifying the core file create a file bootstrap.before.php
    and put this function in it:

    if (!function_exists('hasEditProfile')) {
        /**
         * Determine whether or not a given user has the edit profile link.
         *
         * @param int $userID The user ID to check.
         * @return bool Return true if the user should have the edit profile link or false otherwise.
         */
        function hasEditProfile($userID) {
            if (checkPermission(array('Garden.Users.Edit', 'Moderation.Profiles.Edit'))) {
                return true;
            }
            if ($userID != Gdn::Session()->UserID) {
                return false;
            }
    
            $result = checkPermission('Garden.Profiles.Edit') && C('Garden.UserAccount.AllowEdit');
    
            $result &= (
                C('Garden.Profile.Titles') ||
                C('Garden.Profile.Locations', false) ||
                C('Garden.Registration.Method') != '' /* do not trigger anymore on Connect method */
            );
    
            return $result;
        }
    }
    

    Now add the file bootstrap.before.php into your conf folder in your webroot.
    Now the function will be overwritten

    ( a special thank to @hgtonight who teached me this way to override a function without modifying a core file)

  • Update: better is change line 18- 22 above to this:

     $result &= (
                C('Garden.Profile.Titles') ||
                C('Garden.Profile.Locations', false) != 'Connect' /*||
                C('Garden.Registration.Method') != 'Connect'*/
            );
    
  • noncenonce Necro-on Forensics
    edited February 2016

    Excellent ideas all around Jac but I offer another simple option.

    I still want to pursue the config statement idea as indicated in my last line item in my last comment.

    @akira_txt

    said: I see the problem, when I set the method of registration via "Connect" :

    thanks for further information I thought it would be a config statement that might be the issue,
    so as you have proven that with the ['Garden']['Registration']['Method'] set to Connect and the visibility of edit profile option when you set it to Basic. that there is no problem with
    ['Garden']['UserAccount']['AllowEdit'] and it is set to true as we hoped.

    if you decide not to override the hasEditProfile function in the functions.render.php by creating an extra file and potentially creating issues down the road. you can always solve the problem via config.php and an optional css change.

    so you see that there are 3 statements that can be configured via config.php

    $result &= (
    C('Garden.Profile.Titles') ||
    C('Garden.Profile.Locations', false) ||
    C('Garden.Registration.Method') != 'Connect'
    );

    so we have an logical OR statement 3 config statements. one of these statements must be TRUE in order for the
    AND assignment operator aka &= to result in a TRUE for your result.

    so if

    $result = checkPermission('Garden.Profiles.Edit') && C('Garden.UserAccount.AllowEdit');

    results in a TRUE

    and if all statements are false ( false || false || false )

    $result &= (
    C('Garden.Profile.Titles') ||
    C('Garden.Profile.Locations', false) ||
    C('Garden.Registration.Method') != 'Connect'
    );

    (true && false) is false
    results in false you will not see the option for profile edit.

    so you need to change it so (true && true) is true and assigned to result.

    $result &= (
    C('Garden.Profile.Titles') || // false if not set in config
    C('Garden.Profile.Locations', false) || // false if not set in config
    C('Garden.Registration.Method') != 'Connect' // false if your registration method is Connect.
    );

    we don't want to change your registration method. so that leaves the following 2 config statements.

    one of these needs to be true.

    Garden.Profile.Titles') ||
    C('Garden.Profile.Locations', false) ||
    );

    You will be able to solve your problem via one config statement change
    $Configuration['Garden']['Profile']['Titles'] = true;

    without the need to override a function or create an extra bootstrap file.

    the side effect is $Configuration['Garden']['Profile']['Titles'] = true;
    will give you an option for a User Title on the profile edit page.

    you can hide this with css and the user title will be blank, or if you want to give users the option for a user selectable title no need for a css change.

    As usual, please debate the need to override a function vs a simple config statement change.

  • LincLinc Detroit Admin
    edited February 2016

    There's nothing in core that would ever show "Edit Profile" but disable it as an option. If you can't do anything, Vanilla hides it. So I'm inclined to blame this on a faulty theme or third-party plugin.

    I'll also fully admit I did not read any of the config tweaking or code hacking of the last few posts because the core problem is rotten.

  • My guess is, Edit option is not showing because Registration may be set to New users are only registered through SSO plugins. This is because edit should be done on external site.
    If it is changed to any other then it will start showing!

  • There's nothing in core that would ever show "Edit Profile" but disable it as an option. If you can't do anything, Vanilla hides it. So I'm inclined to blame this on a faulty theme or third-party plugin.

    I dont know, this is a fresh install with Default Theme with plugins disabled.

    Thanks @nonce and @jackmaessen for your solutions.

  • noncenonce Necro-on Forensics
    edited March 2016

    in theory:

    profile edit NOT appearing in menu and ability to edit profile options ≠ profile edit option appearing in the menu but not allowing the profile to be edited.

    the issue is the menu option. not the ability to edit the profile.

    yes the coding is very odd. the only explanation is they have not taken a close look or the code is old (pre profile extender), or figure the profile extender plugin should not be used with Connect registration.

    Why would you see an edit profile option in the menu if profile.location or profile.title config options are true and registration method is Connect?
    but
    Conversely if site admin added profile fields using profile extender and site uses the Connect registration method you do not have the profile menu option and link available. Yet you can manually enter the url to profile edit and edit the fields.

    makes no sense. any additional profile fields should be editable if you want them editable and a menu option "edit profile" for that.

    if the fields are editable in the profile (as desired), the registration method should not impact whether either "user preferences link" or "profile edit" link appears.

    Registering users theoretically should have no impact on profile options that are added via profile extender.

  • LincLinc Detroit Admin
    edited March 2016

    @nonce said:
    yes the coding is very odd.

    I'd agree.

    @nonce said:
    makes no sense.

    Not following the logic is not the same as there being none. It's a kludge, but a rational one based on typical SSO workflows we see. It will get reworked at some point, but it's a very delicate point to refactor it without blowing up existing installs.

    Anyone could rewrite that code to "make sense" to themselves. Doing it without breaking 1000 jsConnect installs is a finer point.

Sign In or Register to comment.