Recent Topics

1 Aug 16, 2009 16:34    

My b2evolution Version: 3.3.1

Hi, I am new to the b2evolution world and have a newbie question.

Is there a way to moderate user comments, either member or visitor, on a per post basis?

I know I can set a global blog setting to automatically set new comment status to either 'published', 'draft' or 'deprecated'.
Is there something I am missing in the settings?

I have looked over the code and have devised a way to do it (fairly simple hack). But wanted to see if there was a way to already do this before I go and change the code.

Thanks,

hb_admin

P.S. props to the creators of b2evo, awesome software, and probably the easiest install/setup out there.

2 Aug 16, 2009 17:20

No, you can only open, close, disable them on a per post basis

¥

*edit*
You could easily change that behaviour with a plugin though ;)

3 Aug 16, 2009 17:40

Ok, I will look at writing a plugin. In the meantime I modified several files to add moderation control on per post basis. Took me all of 15 minutes :-).

Thanks ¥ for the reply.

- hb_admin

4 Aug 16, 2009 18:03

If you'd rather make it a plugin then abuse the rendering hooks ;)

¥

_evo_admin_ ;)

5 Aug 16, 2009 22:41

A few questions about plugins.

One, is there a tutorial on how to write one?
Two, I know plugin's are allowed to add tables to the db, but would it be ok if the plugin added a column to an existing table (e.g. evo__items_item)? Is this allowed?

Thanks,

hb_admin

7 Sep 02, 2009 02:15

Ok, I have been working on adding a plugin for comment moderation on a per post basis and I have have a few more questions.

1) Can I overload the db field 'post_comment_status' with extra values? Will these get cleared when the blog software is updated? I plan on add extra enumerated values to the field, 'open_unmoderated' and 'open_alwaysmoderated'.

2) I am looking to add the two options above to the "Comment" fieldset when a post is edited/created/..., but I can't find a hook/function to use in my plugin. I plan on using javascript to manipulate the fieldset and add the two extra ratio buttons that the user can select.

Once I have the above solved/answers and some testing, the plugin should be ready for review and beta use :-).

Thanks,

hb_admin

8 Sep 02, 2009 02:53

1 - You can, but they will :( Actually I dunno about "cleared" but for sure the updater will choke on not having tables it knows about to be exactly what it expects. Best bet will be to have your plugin make it's own table even if it duplicates some info already stored elsewhere. * oddly enough, even though technically it makes the tables your plugin tells it to make, it doesn't actually know about them when it comes time for someone to upgrade.

2 - This isn't really a question ;) But hey so what! Here is a path I am taking now. A long time ago I added extra hooks to my admin page to move toolbars from the only place they are to either top or bottom or right. That meant I could write a plugin that worked for me (meaning with the toolbar where I wanted it), but would have to make sure it worked in everyone else's situation if I wanted to give it away. I finally came up with a solution :)

if( method_exists('Plugin', 'AdminDisplayToolbarBottom' ) ) {
	$default_settings['toolbar_location']['disabled'] = false;
	}
return $default_settings;
}

You can use the "note" portion of your setting that depends on a custom hook to tell someone either how to get the custom hook or what to do given that they don't have it. By default it is disabled and the note says "must suck to be you". Assuming they're hip and have your custom hook the setting is enabled and the note can be changed to something valuable. Neato eh?

Unfortunately I'm also deep in a couple of webs and don't feel hip to releasing a plugin until at least one of them is at least partially functional, else I'd point you to an actual working example.

9 Sep 02, 2009 04:19

EdB,
If I understand you correctly from part 2, I can create a custom plugin event at the location I want in the admin skins.

Also in the plugins GetDefaultSettings function I can add your code to disable the plugin unless the method on the plugin object is available.

For part 1 I will take a look at other plugins for reference to create a custom table. Shouldn't be too bad.

Do I have the above correct?

Thanks for the reply EdB.

- hb_admin

10 Sep 02, 2009 04:26

Yes on both counts.

Quite a few plugins make tables. At the risk of blowing my own horn, you might want to check out my Zythepsary plugin. It makes a table so you'll sorta see how that goes down, and more importantly it's only point in life is to write a readme for a plugin. Via the readme you could tell people "look in this file for these lines and add the following bit" so they could use your cool new trick.

Then BOPIT. Don't forget BOPIT.

Aw crap my domain is giving me a 500 error. Soon as I fix that I'll point you to zythepsary but if you search these forums you'll find it. I've no doubt that word doesn't show up in here very often ;)

11 Sep 02, 2009 05:59

Hey EdB,
I think there is a bug in the Zythepsary install table create SQL:

Line:
 ...
 260         rmw_logterm_a,
 261         rmw_logdefine_a
 262         rmw_logterm_b,
 263         rmw_logdefine_b
 264         rmw_logterm_c,
 265         rmw_logdefine_c
 266         ) VALUES (
 267         'Zythepsary 163',
 ...

Seems to be missing the ',' after a couple of columns in the list. I downloaded version 2.4.3.

Once I added the ',' all was alright.

Thanks,

hb_admin

12 Sep 02, 2009 06:46

Cool - thanks for reporting. I'll fix it and zip it and upload it pretty soon.

BTW that is not the most user-friendly plugin ever made. I figure someone who writes plugins can deal with it ya know? Beats the heck out of doing good old html after phping your fingers to the bone is the thing.

13 Sep 02, 2009 07:03

Hey EdB, one more for Zythepsary. I accidently typed the directory for my plugin as 'commentmoderation_plubin', notice the type on plugin :-). Zythepsary barfed and the tab Z163 is empty.

I figure I need to learn how to type but until then maybe a RFE validate the directory exists?

I like Zythepsary, seems like it will make my life easier when I go and complete the documentation for my plugins.
But first I got to get the plugin working :-P.

Also I eyeballed the function and db table creation piece of Zythepsary, seems easy enough, now to get data into it.

Thanks again for the help EdB.

- hb_admin

14 Sep 02, 2009 07:09

the tab goes empty from time to time. that's one of the "deal with it" things. First time it did it to me after I didn't need it for a while I was all like WTF but just click it again and whatever is in there will come back.

It says stupid stuff too sometimes. Me talking to myself then not cleaning it up before zipping. Again I figure oh well.

Did it store your info to your database? 163 fields in one table is horribly horrible, but if it stored then you can probably edit the readme OR clean it up directly in the database. I'm guessing you'll be able to click the tab name again and edit the readme.

Oh and when you write a readme it'll over-write whichever one you last did and store it in a folder not available through the built in file manager. /media/ itself. So click the link it provides that will launch a new tab, then view source or save as or something.

It does the bulk of the work though, and editing a readme a year from now will be a snap.

18 Sep 05, 2009 23:40

I do agree with you that I technically don't need a new hook, but I want the radio buttons displayed under the current "Comment" radio buttons. If there is a better way to do so I am all ears, I don't like the idea of having to modify core files.

Maybe the b2evo team can add the extra hook that I need? :D

- hb_admin

20 Sep 09, 2009 05:17

Once I submitted the plugin through the "Submit a plugin or hack" form, what else do I have to do?

I don't fully understand what BOPIT is?

- hb_admin

21 Sep 09, 2009 10:03

BOPIT is a plugin that we developed to allow users to check if they're plugins are up to date or not, it also shows plugins available for download. Registered developers are able to update their plugins details at any time, they can also add new plugins.

You can read more about it on it's release post @link [url=http://b2evo.astonishme.co.uk/bopit]BOPIT[/url].

If you'd like a developer membership then let me know, although I've only just moved it to it's own sub-domain so it still needs a tad of tarting up ... and some bug/error checking.

You can also create a plugin support thread on the forums, if you create it in the plugin development forum then I'll move it into the plugin support forum for you.

I haven't had a chance to look at your latest version yet but, if you're comfortable playing with output buffers and regex then you can *still* have your radio buttons where you want without any extra admin hooks ;)

¥

*edit
your wikki requires membership to view pages, makes it a smidge awkward to download the plugin ;)

22 Sep 09, 2009 16:40

¥åßßå wrote:

*edit
your wikki requires membership to view pages, makes it a smidge awkward to download the plugin ;)

The period at the end of the link is what is making it say you have to log in.

BOPIT is awesome. As a user you want it just to know when your plugins are updated. As a plugin author you want your plugin(s) listed in it so you can tell users when there is an update.

23 Sep 09, 2009 17:52

Sharp eyes, I missed that one.

With a tad of luck the majority of the bugs on the new bopit home are now cured ... and it should look a smidge better ... still need to redo the intro && developer posts though ... and move the zip thing, although I thought I'd moved that already :-S

¥

24 Sep 09, 2009 21:54

Hey ¥,

I would like a developers account. Also I wouldn't mind mucking with data streams, I eat regex's for breakfast :D. What hook can be used to modify the data stream for the admin pages? RenderAsHTML (can't remember the exact hook)?

Sorry about the '.' at the end of the url :oops:.

Thanks,

hb_admin

25 Sep 10, 2009 11:24

See if this helps ;) ( note : free typed )

	var $_flag = false;
	/**
	 * Abuse the AdminDisplayItemFormFiedlset()
	 */
	function AdminDisplayItemFormFieldset( $params )
	{
		ob_start();
		$this->_printFieldSet($params); // capture our form
		$this->_flag = ob_get_clean();
		ob_start(); // capture rest of output
		
	}
	
	function AdminAfterPageFooter()
	{
		if( $this->_flag )
		{ // we're buffering
			$output = ob_get_clean();
			echo preg_replace( '~(<fieldset class="fieldset" id="itemform_comments">.+?</fieldset>)~s', '$1'.$this->_flag, $output );
		}
	}

I'll pm you a link to the registration page, once you've registered I'll move you into the developers group and you can add your plugins.

The instructions on the site are a smidge dated now so I'll run you through it when you add your first plugin.

¥


Form is loading...