Recent Topics

1 Jul 23, 2008 07:27    

My b2evolution Version: 1.10.x

I am setting up a multi-blog site, so each new user owns there own blog, but I do not allow them to create another blog. I want to force my own webmaster controled linkblog into all the blogs on my multi-blog site. Ideally, I would like it to be part of the default, however, something like having the ID number set and not editable would do if it is easier accross different skins... How would I go about doing this?

version 2.4.2

2 Jul 23, 2008 08:08

You can hard-code linkblog widget in skin

skin_widget( array(
			// CODE for the widget:
			'widget' => 'linkblog',
			// Optional display params:
			'title'	=>	T_( 'Linkblog' ),	// This is title to display in your skin
			'linkblog_ID' => 3,				// This is ID number of the blog to use as a linkblog
			'linkblog_limit' => 100,		// This is the maximum number of links to display
	) );

3 Jul 23, 2008 09:52

sam2kb wrote:

You can hard-code linkblog widget in skin

skin_widget( array(
			// CODE for the widget:
			'widget' => 'linkblog',
			// Optional display params:
			'title'	=>	T_( 'Linkblog' ),	// This is title to display in your skin
			'linkblog_ID' => 3,				// This is ID number of the blog to use as a linkblog
			'linkblog_limit' => 100,		// This is the maximum number of links to display
	) );

I am a novice and it would help if you could be specific on the file I am suppose to access? Am I adding this code to a line number or changing code already there?

4 Jul 23, 2008 10:02

It depends on skin you are using. Usually it goes in index.main.php
Search for this string

skin_container( NT_('Sidebar'), array(

and put the linkblog code below

skin_container( NT_('Sidebar'), array(
		// This will enclose each widget in a block:
		'block_start' => '<div class="bSideItem $wi_class$">',
		'block_end'   => '</div>',
		// This will enclose the title of each widget:
		'block_title_start' => '<h3>',
		'block_title_end'   => '</h3>',
		// If a widget displays a list, this will enclose that list:
		'list_start'  => '<ul>',
		'list_end'    => '</ul>',
		// This will enclose each item in a list:
		'item_start'  => '<li>',
		'item_end'    => '</li>',
		// This will enclose sub-lists in a list:
		'group_start' => '<ul>',
		'group_end'   => '</ul>',
		// This will enclose (foot)notes:
		'notes_start' => '<div class="notes">',
		'notes_end'   => '</div>',
	) );


skin_widget( array(
            // CODE for the widget:
            'widget' => 'linkblog',
            // Optional display params:
            'title'    =>    T_( 'Linkblog' ),    // This is title to display in your skin
            'linkblog_ID' => 3,                // This is ID number of the blog to use as a linkblog
            'linkblog_limit' => 100,        // This is the maximum number of links to display
    ) );

5 Jul 24, 2008 09:37

Ok, that works Great! Thanks for the hack… the only problem I see that I now have, is that my blog owners can still install widget linkblog from the add widgets link in blog settings, even though they do not have a second blog to link too. Can I disable installing linkblog widget without effecting my hack you just provided for me so my blog owners cannot add the widget linkblog but still have access to add the other widgets? ... and how would I do that?

6 Jul 24, 2008 10:04

Open inc/widgets/widgets/_linkblog.widget.php and edit the following function

/**
 * Display the widget!
 *
 * @param array MUST contain at least the basic display params
 */
function display( $params )
{
	$this->init_display( $params );
	
	if( empty($params['qwerty']) )
		return false;
		
	// List of pages:
	$this->disp_cat_item_list();

	return true;
}

Then edit the hard-coded widget

skin_widget( array(
	// CODE for the widget:
	'widget' => 'linkblog',
	// Optional display params:
	'qwerty' => 1,
	'title'    =>    T_( 'Linkblog' ),    // This is title to display in your skin
	'linkblog_ID' => 3,                // This is ID number of the blog to use as a linkblog
	'linkblog_limit' => 100,        // This is the maximum number of links to display
) ); 

Good luck

7 Jul 24, 2008 11:12

Fantastic, simple, easy and effective solution; you’re awesome!


Form is loading...