News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Profile editing account and profile permission and link

Started by ContLock, June 02, 2018, 07:02:26 PM

Previous topic - Next topic

ContLock

I removed admin_menu for editing profiles but have problem for admin and user. Here is my code:

if ($context['member']['is_owner'] || $context['user']['is_admin'])
echo '<a href="', $scripturl, '?action=profile;area=account;u=', $context['id_member'], '" class="btn_profile_settings">Account settings</a>';


This button/link should open account settings, administrator should be able to open and edit everything while user should be able to edit only default stuff (for example everything but not login name).

I also want to make other stuff for user like editing forum profile (administrator can edit all users but normal users can edit only their profiles).

Kindred

this would be handled by the permissions, not by the link...

normal users can not usually edit anyone else's profile -- unless you have screwed up the permissions
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

ContLock

Quote from: Kindred on June 05, 2018, 03:52:01 PM
this would be handled by the permissions, not by the link...

normal users can not usually edit anyone else's profile -- unless you have screwed up the permissions

I deleted admin_menu element where those buttons (lists) work great but I want to extract several that I only want to show in different way, not in lists. So in order to do that I can't edit current admin_menu because it is listed from for loop and can't find function from where it is listing those links, permissions and so on..

Aleksi "Lex" Kilpinen

Exactly what are you trying to achieve and why? I still don't really understand.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Kindred

you seem to be going about this all wrong.

You don't control access to things via a link.
You give the link and control access to functions on the page via permissions.

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Aleksi "Lex" Kilpinen

ContLock, I have a feeling you know what I'm about to ask.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

ContLock

Quote from: Aleksi "Lex" Kilpinen on June 06, 2018, 11:08:41 AM
Exactly what are you trying to achieve and why? I still don't really understand.

I'm creating custom profile using current smf variables and permissions.

I'm trying to create custom button "edit profile" which in case admin is viewing that user (as normal menu-list work) every admin should be able to edit it. Every normal user that is not admin should be able to edit only their profile.

Because if I'm right, the options on every profile is in admin_menu element which show all possible options for that profile.

I hope you understand what I'm saying.

I'm just trying to create custom button "edit profile" for example and being able to show it only to user if it is admin and tu normal user if it is his profile.


edit:

Quote from: Aleksi "Lex" Kilpinen on June 06, 2018, 12:38:29 PM
ContLock, I have a feeling you know what I'm about to ask.

Sorry but I don't. Do you mean for copyright or something else? SMF is mentioned in footer.

Aleksi "Lex" Kilpinen

If that is your site, the copyright statement is actually missing.
Granted it does mention Simple Machines Forum, but that's not the same.
Just wanted to make sure, if you removed the statement on purpose?
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

ContLock

Quote from: Aleksi "Lex" Kilpinen on June 06, 2018, 01:05:34 PM
If that is your site, the copyright statement is actually missing.
Granted it does mention Simple Machines Forum, but that's not the same.
Just wanted to make sure, if you removed the statement on purpose?

It was there before I got there on forums. I will fix that problem. Really didn't know. Could you guide me to fixing that problem and what is okay to be written there because I have seen some other communities and forums that event don't have any SMF 'tags' and copyright text? And also if it is possible to answer me here for the topic problem.

Aleksi "Lex" Kilpinen

Thank you for understanding.

It is actually legal for you to remove the statement, but not alter it - and we reserve the right to not provide support for those who choose to remove it. The statement if kept visible, should be kept whole and unaltered apart from the version number.

Could you attach your index.template.php?
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF


Aleksi "Lex" Kilpinen

#11
Try this, and do tell me if you think it looks terrible - as I don't know how your theme is actually coded.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Kindred

Regarding your profile questions...

I don't understand.
Everything you have stated that you want to do is a standard function in SMF.

1- a user can edit his own profile (correct)
2- an admin can edit any user's profile (correct)
3- normal users can not edit any other user's profile (correct)

as I have said twice, already... the ability to view and/or edit a profile is controlled by permissions.
There is no need to remove any button
There is no need to build a separate page or build extraneous links...   it's all controlled (already) through the existing system of display and permissions.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

GigaWatt

@ContLock: You can edit anything you like if you're an admin. Just open a user's profile, go to Modify Profile and edit anything you'd like.

Example: Account Settings



You can do the same with Forum Profile, Look and Layout, etc.
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

ContLock

I think none of you understood what I'm asking. I will try to explain it one more time.

I know there are buttons and it works very well. I know how to use them but that is not what I'm asking for.

I want to make CUSTOM BUTTON for example "Options" and than add when I click on it (open it or whatever) I am redirected to this image example in the previous post.

I don't want default 'button' design which is in element 'admin_menu' if I'm correct.

I want to be able to show custom button "Options" if the user is owner of current profile view and if the user is administrator.

I don't want this layout of button list (Profile Info, Modify Profile, Actions). I want to break that for loop which is adding elements to the list if the view is on profile.

I want to break it on for example:

Options (link to editing account settings like it is shown in image in previous post)
Delete account (if the user have permission to delete account or if it is admin)
Profile edit (button that opens forum profile editing)

I hope you understand now what I'm asking.

Kindred

If you are trying to control access, then what you are asking just doesn't work without a complete redesign of the SMF permissions and profile system.

If you just want to link TO the section, then just look at the existing links.

index.php?action=profile;area=account
index.php?action=profile;area=forumprofile
index.php?action=profile;area=deleteaccount;u=<usernumberhere>

however, making separate buttons for those seems silly...   and once you go TO those links, you are just inside the profile, and so have access to all the other areas... so why not just use the existing profile button?

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

GigaWatt

Quote from: ContLock on June 09, 2018, 08:13:26 AM
Options (link to editing account settings like it is shown in image in previous post)
Delete account (if the user have permission to delete account or if it is admin)
Profile edit (button that opens forum profile editing)

You want the drop-down menu to appear as separate buttons IF you're an admin or have adequate permissions to edit member's profiles. Correct?

If that's so, then you need to redesign the profile PHP files... I don't know which ones though: Profile.php, Profile-View.php, Profile-Modify.php or Profile-Actions.php. I haven't looked which one generates the drop-down menu above the profile.
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Advertisement: