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.
Allow users to edit their profiles?
In profile members can click the preferences button to modify their preferences. Which is great but they can't edit the fields that we added through Profile Extender. However if they modify the url to their profile : https://site.com/forums/profile/edit/Username they can get to the edit screen where they can edit the profile extender fields.
Is there a way I can change that preferences button so that they go to the edit screen instead of the default preferences settings page? Or is there a way that I can add a link to the edit profile page and show it only if the profile page belongs to the logged in user?
0
Comments
Apparently they just need to go to the following link: https://site.com/forums/profile/edit
Surely there must be a way to display this on their profile if the user browsing is the owner of the profile?
They should have a memodule with links to their profile and to edit, you can also add an extra link on the menu for that if it is not visible enough for you.
there are plugins to add more links to the menu
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
I don't see anything with that menu item. I modified the "me" module to point to edit rather than preferences but that only works for non-mobile versions.
Hmmm but if I add a link to the menu will others see it? Or is that the user menu?
the edit profile link uses permissions to edit and also requires that users be signed in to show. If you add the link to the menu without permissions, it will always show, but only to logged in users.
Not sure what theme you are using, but if it's outdated it may not have those links ..
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Moddified default embed theme
Oh I used your addon addmenuitem. That works.
That's really strange and you should try to solve the problem instead of finding ways to live with it.
The code which determins if a user sees "Preferences" or "Edit Profile" link looks like that:
hasEditProfile
is a helper function which checks if the user has the appropriate rights to change his profile. The most interesting lines in that functions are the following:That means that your users will see the "Edit Profile" link whenever:
Their user role has the Garden\Profiles\Edit permission checked (also check the Garden\Profiles\View permission) AND in the config there is a line
$Configuration['Garden']['UserAccount']['AllowEdit'] = true;
AND
Either of the following is true:
a) You have a line
$Configuration['Garden']['Profile']['Titles'] = true;
in the configOR
b) You have a line
$Configuration['Garden']['Profile']['Locations'] = true;
in the configOR
c) Your registration method is not "Connect"
Thanks R_J I will dig into it and post my findings here. I am on a family vacation for the 4th so I will need to find time here and there to look.
R_J I am digging into this finally. One thing I am not certain of is where to find the code that you reference above? Like which files are they located in.
The first bit of code you listed with the profile/edit and profile/preferences links I found at: /applications/dashboard/views/modules/me.php
In that file I find:
if (hasEditProfile(Gdn::session()->UserID)) { echo wrap(Anchor(sprite('SpEditProfile').' '.t('Edit Profile'), 'profile/edit', 'EditProfileLink'), 'li', array('class' => 'EditProfileWrap link-editprofile')); } else { echo wrap(Anchor(sprite('SpEditProfile').' '.t('Preferences'), 'profile/preferences', 'EditProfileLink'), 'li', array('class' => 'EditProfileWrap link-preferences')); }
But I don't know where to find the helperfunction file that contains
hasEditProfile
Ummm my registration method is connect. I thought it had to be that for SSO to work?
Correct. But if there is a SSO solution, you have to have one "master" and it appears to me that this is/has to be/should be Wordpress. So I would say that the correct way to do things like that would be to create additional fields in Wordpress, create that same fields in Vanilla, but for editing the fields users would have to go to their "master" profile.
As a user I would find it confusing to have to edit some fields in my forum profile and others in the cms profile.
But I would agree that having the Vanilla notification preferenes available in the wordpress profile settings would be very sexy...
Ummm R_J was your last two responses to my problem?
At least I thought so, yes
Your problem is that your users cannot change the fields that have been added with the profile extender, nor?
I think, they shouldn't edit it. There is a function which checks if your registration method is "connect" and if that is true, your users shouldn't be allowed to edit their profile.
As a result, they should edit the original profile, which is the Wordpress profile. In order to be able to sync fields available in the Wordpress profile, you have to create those fields with the profile extender in Vanilla.
The last sentence is assumption, all the rest appears to be obvious to me
Oh ok I see where you were going now.
We don't use the wordpress profile for our users. I disable to WP top bar for them because it was just too confusing for a lot of our users. (we are an older forum group)
I believe this connect registration thing is also why I had to create the role in wordpress when I was having problems assigning people that role in vanilla. Now I just assign the role to them in wordpress and that seems to be fine. Anyways that is a different subject but I think it helps me understand why this profile issue is what it is.
But I would like users to be able to edit their profile extended field... and you are probably going to eyeroll me bigtime because of this but here goes.....
The profile extended field allows users to set a field to enable or disable the viewing of discussions from a category we have called Sensitive Topics. I realize I could have just had people put into different groups but people in our forum switch between wanting to view those types of discussions on the fly and then revert back to not wanting to view them. I know it is sort of a crazy thing but our forum users really enjoy it.
I modified the helperfunctions file in discussions (under my theme) as the following to check the value of the extended profile field and to suppress the discussion from being displayed if the elected to not view those types of discussions. It is just an if statement wrapped around the writeDiscussion function:
hmmm well the code formatting broke obviously.
Oh dear - if you just have asked...
Look at that: https://open.vanillaforums.com/categories, hover over one of the categories and you will see a cog wheel which gives you a context menu with the option to "mute" a category.
Do you still need your construct?
I have just checked it: in Vanilla 2.3 that feature works similar but it is called "hiding" categories.
By the way: I fixed your code snippet copy. Enclose longer code blocks with
~~~
like that:~~~
your
code
here
~~~