Sign Up! Login: Password: New User? Forgot? Support
Top Mods!
Wowhead Search
by sonofsamedi
Digital Clock
by Wolfar15
Admin Forums
Welcome to the GuildPortal Help Community! These forums are for admin-to-admin help.
Available Forums
Forums : Pimp My Site! > Hiding the admin Edit buttons
Mottie (MVP) 11/19/2008 9:23 AM EST : RE: Hiding the admin Edit buttons
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

If you look above the footer editor window, you'll see this:
Required Elements:

$block[boilerplate]
This is what's missing in the footer area - add that and you should get your image back.
TopBottom

Ayiana (New Admin) 11/20/2008 2:11 AM EST : RE: Hiding the admin Edit buttons
Ayiana
Posts: 1498
Zomgawsh Poster

I can believe that is all there is to it.  I saw that up there, but figured surely there was some syntax to a following argument like $block[boilerplate] {img src="yadda yadda" }.  Nope, just copy that line to the top and all works great.  Thanks once again.
 

~Ayiana
TopBottom

Xeyda (New Admin) 1/14/2009 9:59 AM EST : RE: Hiding the admin Edit buttons
Xeyda
Posts: 153
Posts With Wolves

Mottie said:
Try this:
Also, this script isn't perfect, it looks for text INSIDE the content box (NOT the title of the box). If you want to show other edit buttons, just add a "|" (shift-\) between the key words. Example: On my test site calendar page, if I wanted to show the edit button in my Info Box and the Event Calendar, I would use:
var dontHide = "monthlyCalendar|Test";
Note: Those are key words INSIDE the content box (NOT the title).



Hi there!  This is very shiny... but for the life of me, I cannot get it to stop hiding the edit button for certain areas of my site (corruptionofreverie.guildportal.com); specifically the Gallery and Quotes box on the first page and Calendar on the calendar page.  I tried every word inside the various content boxes I could think of, with and without the pipe ( | ) and had no luck.

Any ideas what I'm doing wrong?
TopBottom

Mottie (MVP) 1/16/2009 5:32 AM EST : RE: Hiding the admin Edit buttons
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Hi Xeyda!

Sorry it took me so long to reply... I had to manually add edit buttons to your site to test this LOL. Anyway, add the following code into your footer to get it to work (Control Panel > Stlye & Colors > Footer)
<script type="text/javascript">
function hideEditButtons() {
// true = hide all edit buttons
// false = show all edit buttons
var hideButtons = true;
var dontHide = "tblMonthlyCalendarTable|_lblQuote|_pnlNoImages|_pnlImagesExist";
// Don't change anything below!
// *****************************
if (!hideButtons) return;
x = document.getElementsByTagName("input");
 try {
  for (j=0; j < x.length; j++) {
   if( x[j].value == "Edit" && !(x[j].parentNode.innerHTML.match(dontHide)) ) {
    x[j].style.display = "none";
   }
  }
 } catch (err) {}
}
setTimeout("hideEditButtons();", 1);
</script>
The "dontHide" variable contains key portions of the ID from those specific content boxes, so it should work for all sites.
  • "tblMonthlyCalendarTable" - ID of the calendar
  • "_lblQuote " - ID of the Quote Box
  • "_pnlNoImages" - ID of the Gallery (without images)
  • "_pnlImagesExist" - ID of the Gallery (with images)

TopBottom

Xeyda (New Admin) 1/16/2009 6:20 AM EST : RE: Hiding the admin Edit buttons
Xeyda
Posts: 153
Posts With Wolves

Hi!

No worries about the delay.  You've got a lot on your plate. 

It seems to work great, except for the quotesbox, but I can add those through the control panel so no hurry in troubleshooting.

Thanks so much, Mottie!
TopBottom

EQ2Ballzz (New Admin) 11/9/2009 11:34 AM EST : RE: Hiding the admin Edit buttons
EQ2Ballzz
Posts: 2477
Zomgawsh Poster

I love this! I really hated those annoying edit buttons. I added the code and it worked great. It removed all edit buttons but one. For some reason the "Recruiting Info" edit button remains. Any tips to get that one gone as well?
TopBottom

Mottie (MVP) 11/13/2009 7:49 AM EST : RE: Hiding the admin Edit buttons
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Hi EQ2Ballzz!

It's hard to believe that I wrote that at the beginning of this year (before I knew jQuery, I guess)...

Anyway, here is an updated version. Add this code to your footer HTML.
<script type="text/javascript">
$(function(){
 var dontHide = "Calendar|Quotes|Guild Info|Gallery|Random Images";
 $('.adminButton,button:contains("Edit")').each(function(){
  if (!$(this).closest('.gpWidget').find('.ContentBoxTitle,.ContentBoxTitleNoBackground').text().match(dontHide)) {
   $(this).remove(); 
  }
 })
})
</script>
Notes
  • The dontHide variable contains the title of the widget where you don't want the edit button hidden.
  • You must separate these titles with a pipe "|" (shift-\, above the enter key).
  • These titles can contain spaces and apostrophes.
  • All words are case sensitive.
Edit (11/15/2009): Updated script to include all types of admin edit buttons (hopefully)
Edit (11/21/2009): Updated to hide the widget container.
Edit (11/21/2009): Modified the code to completely remove the edit button, to prevent the button from fading back in.
TopBottom

EQ2Ballzz (New Admin) 11/14/2009 11:34 AM EST : RE: Hiding the admin Edit buttons
EQ2Ballzz
Posts: 2477
Zomgawsh Poster

OK, I tried the new code and removed all the "dontHide" variables but it still doesn't remove the recruiting info edit button. Actually, now it's not working to hide any of the edit buttons. Maybe I'm doing something wrong.

Hmm..when I open the Recruiting Info widget it says this, "This content type is either display only or no content editor is currently available." Is that why it can't be hidden?
TopBottom

Mottie (MVP) 11/14/2009 2:12 PM EST : RE: Hiding the admin Edit buttons
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Hi EQ2Ballzz!

It seems to work fine for me on my test site that has no extra coding...
  • Are you using the widget titles?
  • Did you change your boxes custom HTML? If you did, could you please share a link to your site as I have lost my list of everyone's web site page.
  • I've just noticed that this script doesn't work with the allied guilds widget... I'll fix this in the next version.
TopBottom

EQ2Ballzz (New Admin) 11/15/2009 3:24 AM EST : RE: Hiding the admin Edit buttons
EQ2Ballzz
Posts: 2477
Zomgawsh Poster

Sure thing. Link is here: Sinister
TopBottom

Admins Online
There are   members online.
So-and-so has logged on!
%title%
%message%