Recent Topics

random hack

Started by on Feb 06, 2009 – Contents updated: Feb 06, 2009

Feb 06, 2009 07:57    

hi, i have a request for a random hack. i want to place a link somewhere that can only be viewed by writers of my blog. the link would be to a forum for the writers that i wouldn't want readers to have access to. i was thinking that the best place to put it would be under the 'write' tab in the back office next to the text 'new post in blog: blog name'. even if it's not possible to put a hyperlink there, it was still be great to put the address. any ideas?

Feb 06, 2009 08:07

Hi bobzarzal,

I can't fimd the location you are referring to. What version of b1evolution are you using? Can you provide a (small) screenshot?
The link itself should be easy.

Good luck

Feb 06, 2009 08:27

I thought so ;)
I don't maintain a 1.10 setup, so I won't help you with this one.
Easiest is to add a link with jQuery. You remember the name of the div where the text is and do

PHP

<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
  // Load jQuery
  google.load("jquery", "1");
  
  jQuery('<a href="http://forums.b2evolution.net">Forums</a>').insertAfter(".yourDiv"); 
</script>

and add it to /skins_adm/_html_header.inc.php between <head> and </head>. I didn't test the code and I'm pretty sure you want to tweak it.

Good luck

*EDIT* correct jQ syntax

Feb 06, 2009 08:43

i don't have a file '_html_header.inc.php' the only php file in the skins adm folder is _adminUI_general.class.php'

inside this file i found:

/**
* Display doctype + <head>...</head> section
*/
function disp_html_head()
{
global $view_path;

require $view_path.'_menutop.php';

should i paste it in there?

Feb 06, 2009 08:53

See if you can find a file called _menutop.php and see if that has the headers.

*EDIT*
/inc/VIEW/_menutop.php

The correct syntax is

PHP

jQuery('<a href="http://forums.b2evolution.net">Forums</a>').insertAfter(".yourDiv");

Feb 06, 2009 09:04

found the file and pasted the code in the <head> but nothing happened...

Feb 06, 2009 09:06

Pls reread, I edited the code.
You can PM me URL plus login/password and I'll have a closer look. Really I'm not going to set up an 1.10 install just for your question.

Feb 06, 2009 09:11

sorry, i'm still new to this all... you said before "You remember the name of the div where the text is" what is the "div"?

Feb 06, 2009 09:18

View the page source of the page. You will find the text "New post in blog" plus the three buttons. These are wrapped in a div. Foe example:

PHP

<div id="buttons"><p>New post in blog ...

In a line that's bound to be very different from this example you are looking for an id. Remember that.

In the code replace '.yourDiv' by '#buttons" or whatever name the id has. The . would denote a class, the # an id.

Feb 06, 2009 09:29

I found a 1.10 blog. Thanks ¥åßßå.
In the code replace '.yourDiv' with '#TitleArea h1'
If it has loaded the jQuery library properly I think this will work.

The line is now:

PHP

jQuery('<a href="http://forums.b2evolution.net">Forums</a>').insertAfter("#TitleArea h1");

If it *does* appear but it appears on all pages, try:

PHP

if( document.location.indexOf"ctrl=edit" ) != -jQuery('<a href="http://forums.b2evolution.net">Forums</a>').insertAfter("#TitleArea h1");

Good luck

Feb 06, 2009 19:11

very very close to getting this. i really appreciate all the help! so the link is showing up (on every page, which is fine) but it's not showing up exactly where i wanted it to go... and it's displaying some of the code... which leads me to believe the jquery is not working? here are some screen grabs:

http://shitledger.com/screengrab2.jpg

http://shitledger.com/screengrab3.jpg

the second is just a grab of the page source... looks like the div is right...
same results when i put in the second version of the code you wrote... and when i put in the <script> tag from your first post, it goes away all together...

Apr 24, 2009 01:09

I recently upgraded from 1.10.2 to 2.4.6 and lost the link at the tops of every page in the back office. i have tried adding this code

jQuery('<a href="http://forums.b2evolution.net">Forums</a>').insertAfter("#TitleArea h1");

to _html_header.inc.php but it still doesn't show up... any ideas?

Apr 24, 2009 01:14

update, i can see that the link is there, but it is hidden by the dashboard! also, it looks like the jQuery tag is showing...

Apr 24, 2009 03:12

I've got some new hack for you. Open /skins/_toolbar.inc.php and add the new line on 201:

PHP

echo '</li>';
                }
            }
      ?>
    <li><a href="http://forums.b2evolution.net" target="_blank">Forum</a></li> <!-- Add this line -->
</ul>
 
</div>
 
</div>
<script type="text/javascript">
    function evo_menu_show( elt )

In this snippet I show you some of the surroundings.

The toolbar now has a link to your forum like this:

http://www.blog.hemminga.net/B2evoforum/ForumLink.png

Have fun

Apr 25, 2009 02:00

thanks for the new hack! it works great, and makes sense too!


Form is loading...

Advanced CMS – This forum is powered by b2evolution CMS, a complete engine for your website.