Admin Edit Profile action on profile pages

Hi, 

 

Just wondering if it would be possible to add an admin only action to edit the current user's profile? Would save a lof of back and forth from the profile page and administration pages after finding a profile that needs to be edited to remove stuff.

 

Thanks

Quote · 26 Apr 2013

Is there some how to add to the existing action to allow it to also be shown to the admins?

Quote · 26 Apr 2013

You could try adding code around the action, either using an action manager module or editing the action in the database.

Geeks, making the world a better place
Quote · 26 Apr 2013

http://myniftysite.tld/pedit.php?ID=X where X is the id of the member.  Now how to turn this into an action on a profile page that gets X and have the action button only visible to admins?

Geeks, making the world a better place
Quote · 26 Apr 2013

 

You could try adding code around the action, either using an action manager module or editing the action in the database.

 The action to edit the profile is already there in the database, however it only shows when you view your own profile... it need like an if profile = Admin, then show it too...

 

but yeah... I just don't know what to add around it :)

Quote · 26 Apr 2013

OK, the code is to add an or, || ifadmin(); I am not a coder so need to go look at the code.  Can you post the code here for me to see?  Maybe one of the coders will stop by and give a helping hand.  I think this would be an improvement and make it easier to maintain the site; I have found myself having to jump to the backend to perform this and just clicking on the front end would be quicker.

Geeks, making the world a better place
Quote · 26 Apr 2013

if ({ID} != {member_id}) return;

return _t('{cpt_edit}');

Quote · 26 Apr 2013

See if this will work, I may not have the syntax correct.

if ({ID} != {member_id} || !isAdmin()) return;

return _t('{cpt_edit}');

Geeks, making the world a better place
Quote · 26 Apr 2013

hrmm it looked promising... 

Quote · 26 Apr 2013

I tried adding it using an action manger but I am getting an error with the module.  Try it and see if it works for you, you may have to clear the caches.

Geeks, making the world a better place
Quote · 26 Apr 2013

If you all aren't able to figure it out....

Isn't this something that Deano's Tools enables you to do easily?

Quote · 26 Apr 2013

 

If you all aren't able to figure it out....

Isn't this something that Deano's Tools enables you to do easily?

 defeats the purpose. I'm trying to avoid having to go into the admin area to search for a profile (which I'm already viewing) just so I can edit it.

Quote · 26 Apr 2013

OK, I don't think I got the syntax correct.  Try this:

if (({ID} != {member_id}) || (!isAdmin())) return;

return _t('{cpt_edit}');

 

Note the extra pairs of ()

Geeks, making the world a better place
Quote · 26 Apr 2013

It is not working for me.

Folks, this is what we want, we want it so when an admin visits a profile page, the admin can see the profile edit action button.  That way, if we go to the profile page and see something we don't want there, we can click on the edit button and make the change without going to the backend and then clicking on members, and then clicking on the pedit link.  From click, click, click to just one click; and the reduce in wait times as each page loads in the backend to the profile edit page load.

Geeks, making the world a better place
Quote · 26 Apr 2013

exactly :)

Quote · 26 Apr 2013

if (!isAdmin()) return;
return _t('{cpt_edit}');

Now, this will allow an admin to see the button.  However, trying to combine it with the other condition is not working.

if (!isAdmin() || {ID} != {member_id}) return;
return _t('{cpt_edit}');

Does not work.  If condition one || condition two is true, or both conditions are true, shouldn't it return true and let us see the button?  I am not a php programmer, so if someone that is could step forward, we would appreciate it.  This should be such a simple problem to solve.  I see answers to much more in-depth problems getting answered.

Or is it the ! that are confusing me on how I should check?

Geeks, making the world a better place
Quote · 27 Apr 2013

if ({ID} != {member_id} && !isAdmin()) return;
return _t('{cpt_edit}');

This works for me.

Notice BOTH must be true to NOT get the edit button.

Let me know if this works for you!

http://www.mytikibar.com
Quote · 27 Apr 2013

works great! 

 

Thanks!

Quote · 27 Apr 2013

I tried that last night and it was NOT working.  Wait, I think I didn't use the && for and.  Now I really look stupid.

I know I tried this and it was showing the edit button to everyone; however, I was working at 1 am so may have wrote something wrong.  I guess the main thing is not me looking stupid but it working.

Geeks, making the world a better place
Quote · 27 Apr 2013

Your quantifiers are usually doubled up ==, &&, ||,  !=, <>.

I don't think you are stupid, you definitely come up with some good stuff!

http://www.mytikibar.com
Quote · 27 Apr 2013
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.