This is the archived version of my b2evolution code blog.
If you require any help regarding b2evolution then
visit it's support forums
You can find my current blogs here
Code : {@link : WafflesOn}
Personal : {@link : InnerVisions}
Posted on 27th Nov 2006 in : Plugins & Widgets
This plugin has now been released on AstonishMe, the download link has been amended to point to the relevant post
I decided to have a play with the comments hack I posted yesterday to see if I could make it a plugin .....
So, now you can download it here. Upload it, hit admin and install it, then mosey on over to the plugins settings page and see if they make sense to you.
This should work in all 1.8.x -> 1.9 series ..... and possibly 2.0 as well, but I haven't checked
Don't forget to undo all the hacks if you implemented them huh ![]()
Currently comments have 3 options :-
This plugin extends those options so you can specify exactly who comments are open/closed/disabled for. The choices range from anybody to nobody with several others in the middle
As soon as a certain unamed yank has done a fluffy write up this plugin will be released on AstonishMe
¥
*edit*
This should be in the 'examples'
Topanga
*edit*
The plugin now has the following available setting levels, they should be self explanatory. The zipfile has been updated
¥
Posted on 27th Nov 2006 in : Hacks
This is a fix to move a categories children when you move the category. It should work in all 1.8/1.9 versions and is already fixed in 2.0
inc/model/collectons/_category.funcs.php, find this bit of code :-
Code:
/** | |
* Update a category | |
* | |
* This funtion has to handle all needed DB dependencies! | |
*/ | |
function cat_update( | |
$cat_ID, | |
$cat_name, | |
$cat_parent_ID = 0, | |
$cat_blog_ID = '' ) | |
{ | |
global $DB; | |
| |
if( $cat_parent_ID == 0 ) $cat_parent_ID = 'NULL'; | |
| |
return $DB->query( "UPDATE T_categories | |
SET cat_name = ".$DB->quote($cat_name).", | |
cat_parent_ID = $cat_parent_ID ". | |
(!empty($cat_blog_ID) ? ", cat_blog_ID = $cat_blog_ID" : '')." | |
WHERE cat_ID = $cat_ID" ); | |
} |
and replace it with this :-
Code:
/** | |
* Update a category | |
* | |
* This funtion has to handle all needed DB dependencies! | |
*/ | |
function cat_update( | |
$cat_ID, | |
$cat_name, | |
$cat_parent_ID = 0, | |
$cat_blog_ID = '' ) | |
{ | |
global $DB; | |
| |
if ( !empty( $cat_blog_ID ) ) | |
{// lets move any/all children | |
cat_movechildren( $cat_ID, $cat_blog_ID ); | |
} | |
| |
if( $cat_parent_ID == 0 ) $cat_parent_ID = 'NULL'; | |
| |
return $DB->query( "UPDATE T_categories | |
SET cat_name = ".$DB->quote($cat_name).", | |
cat_parent_ID = $cat_parent_ID ". | |
(!empty($cat_blog_ID) ? ", cat_blog_ID = $cat_blog_ID" : '')." | |
WHERE cat_ID = $cat_ID" ); | |
} | |
| |
| |
/** | |
* Recursively move a categories children | |
*/ | |
function cat_movechildren( $cat_ID, $cat_blog_ID ) | |
{ | |
global $DB; | |
$sql = 'select cat_ID from T_categories where cat_parent_ID = '.$cat_ID; | |
$results = $DB->get_results( $sql, ARRAY_A ); | |
if( $results ) | |
{ | |
foreach( $results as $record ) | |
{ | |
// first lets move the category | |
$sql = 'update T_categories | |
set cat_blog_ID = '.$cat_blog_ID.' | |
where cat_ID = '.$record[ 'cat_ID' ]; | |
$DB->query( $sql ); | |
// now lets move any children of this child | |
cat_movechildren( $record[ 'cat_ID' ], $cat_blog_ID ); | |
} | |
} | |
} |
¥
Posted on 26th Nov 2006 in : Hacks
This hack has now been replaced with a plugin
Backup any files that you play with first huh?
Find this bit of code :-
Code:
// Comment form: | |
if( $disp_comment_form && $Item->can_comment() ) | |
{ // We want to display the comments form and the item can be commented on: |
and replace it with this bit of code :-
Code:
if( is_logged_in() ) | |
{ | |
$Item->comment_status = 'open'; | |
} | |
else | |
{ | |
$Item->comment_status = 'closed'; | |
echo '<h4>Sorry, you need to be a registered member to leave a comment</h4>'; | |
} | |
| |
| |
| |
// Comment form: | |
if( $disp_comment_form && $Item->can_comment( NULL) ) | |
{ // We want to display the comments form and the item can be commented on: |
Find this bit of code :-
Code:
// Getting GET or POST parameters: | |
param( 'comment_post_ID', 'integer', true ); // required | |
| |
$commented_Item = & $ItemCache->get_by_ID( $comment_post_ID ); | |
| |
if( ! $commented_Item->can_comment( NULL ) ) | |
{ | |
$Messages->add( T_('You cannot leave comments on this post!'), 'error' ); | |
} |
and replace it with this :-
Code:
// Getting GET or POST parameters: | |
param( 'comment_post_ID', 'integer', true ); // required | |
| |
$commented_Item = & $ItemCache->get_by_ID( $comment_post_ID ); | |
| |
if( is_logged_in() ) | |
{ | |
$commented_Item->comment_status = 'open'; | |
} | |
else | |
{ | |
$commented_Item->comment_status = 'closed'; | |
} | |
| |
if( ! $commented_Item->can_comment( NULL ) ) | |
{ | |
$Messages->add( T_('Sorry, you need to be a registered member to leave a comment'), 'error' ); | |
} |
Find this line (approx 456 in 1.9beta and line 402 in 1.8.5 and probably somewhere in the 400's for other versions) and change the open to closed
Code:
if( $Request->param( 'post_comment_status', 'string', 'closed' ) !== NULL ) |
¥
Posted on 26th Nov 2006 in : Skins
Another version, another set of skin changes. These changes apply to 1.8.5 -> 1.9beta uprades
Code:
display_list( $credit_links, T_('Credits').': ', ' ', '|', ' ', ' ' ); |
Code:
<link rel="pingback" href="<?php $Blog->disp( 'pingback_url', 'raw' ) ?>" /> |
Code:
<?php | |
// ------------- START OF INCLUDE FOR COMMENTS, TRACKBACK, PINGBACK, ETC. ------------- | |
$disp_comments = 1; // Display the comments if requested | |
$disp_comment_form = 1; // Display the comments form if comments requested | |
$disp_trackbacks = 1; // Display the trackbacks if requested | |
| |
$disp_trackback_url = 1; // Display the trackbal URL if trackbacks requested | |
$disp_pingbacks = 1; // Display the pingbacks if requested | |
require( dirname(__FILE__).'/_feedback.php' ); | |
// -------------- END OF INCLUDE FOR COMMENTS, TRACKBACK, PINGBACK, ETC. -------------- | |
| |
locale_restore_previous(); // Restore previous locale (Blog locale) | |
?> |
Code:
*/ | |
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); | |
| |
// --- // | |
| |
if( empty($c) ) | |
{ // Comments not requested | |
$disp_comments = 0; // DO NOT Display the comments if not requested | |
$disp_comment_form = 0; // DO NOT Display the comments form if not requested | |
} | |
| |
if( empty($tb) || !$Blog->get( 'allowtrackbacks' ) ) | |
{ // Trackback not requested or not allowed | |
$disp_trackbacks = 0; // DO NOT Display the trackbacks if not requested | |
$disp_trackback_url = 0; // DO NOT Display the trackback URL if not requested | |
} | |
| |
if( empty($pb) ) | |
{ // Pingback not requested | |
$disp_pingbacks = 0; // DO NOT Display the pingbacks if not requested | |
} | |
| |
if( ! ($disp_comments || $disp_comment_form || $disp_trackbacks || $disp_trackback_url || $disp_pingbacks ) ) | |
{ // Nothing more to do.... | |
return false; | |
} |
¥
Posted on 25th Nov 2006 in : Techno Babble
It's a bloody test post, how much content do you expect?
Page archived : 4th Mar 2010