Recent Topics

1 Apr 18, 2006 23:33    

Does such a method exist? I would put this into the comments-field on the mainpage. And what about a "quick spam"-Button to declare this URL as SPAM without entering the backend. Any idea?

2 Apr 19, 2006 02:28

$Comment->delete_link()

I don't thing there's anything like that to add a ban button. It would be nice, though.

3 Apr 19, 2006 11:02

What about the delete link?

4 Apr 19, 2006 11:45

<?php
	$baseDomain = preg_replace("/http:\/\//i", "", $Comment->author_url);
	$baseDomain = preg_replace("/^www\./i", "", $baseDomain);
	$baseDomain = preg_replace("/\/.*/i", "", $baseDomain);
?>
<a href="<?php echo $baseurl.'/'.$admin_subdir.'/'; ?>b2antispam.php?action=ban&amp;keyword=<?php echo urlencode($baseDomain) ?>"><img src="img/noicon.gif" class="middle" alt="<?php echo /* TRANS: Abbrev. */ T_('Ban') ?>" title="<?php echo T_('Ban this domain!') ?>" /></a>&nbsp;

¥

5 Apr 19, 2006 15:13

Sweet. Don't forget to wrap that in some kind of statement that checks the user level or something so you don't show the ban button to everyone. Not that they would be able to delete comments without the proper backoffice credentials, but you don't want to confuse them with an icon that they can't use.

6 Apr 19, 2006 16:13

Here's what I ended up using:

<?php
                         if (is_logged_in()) {
                                 if (!empty($Comment->author_url) && ($Comment->author_url != 'http://') && ($current_User->check_perm( 'spamblacklist', 'edit' ) ) ) {
         $baseDomain = preg_replace("/http:\/\//i", "", $Comment->author_url);
        $baseDomain = preg_replace("/^www\./i", "", $baseDomain);
        $baseDomain = preg_replace("/\/.*/i", "", $baseDomain);
?>
<a href="<?php echo $baseurl.'/'.$admin_subdir.'/'; ?>b2antispam.php?action=ban&amp;keyword=<?php echo urlencode($baseDomain) ?>"><img src="img/noicon.gif" class="middle" alt="<?php echo /* TRANS: Abbrev. */ T_('Ban') ?>" title="<?php echo T_('Ban this domain!') ?>" /></a>&nbsp;
<?php } }  ?>

7 Apr 19, 2006 16:23

If you were going to "emulate" the code in admin (which is where I got the above from) add "&& $current_User->check_perm( 'spamblacklist', 'edit' )" to the if statement.

Which of course is what I should have done in the first place :p

¥

8 Apr 19, 2006 16:31

You do have to have the is_logged_in() check first or it will give a big fat error when you try some check on Current_user and there isn't one.

9 Apr 19, 2006 16:32

add

but yeah, it'd need to go after "is_logged_in()" ;)

¥

10 Apr 19, 2006 17:36

Where should I paste the code?

I put it under this:

<?php $Item->edit_link( ' &bull; ' ) // Link to backoffice for editing ?>

But nothing happend. =/

11 Apr 19, 2006 17:48

That's the right spot. It will only add the icon if you're logged in, you have permission to edit the blacklist, and the comment author is not a logged in member and they leave a url (not just "http://").

12 Apr 20, 2006 19:41

Well I put it here but still not icons. Nearly every comment fits into this criteria. I am also logged in as admin and so on.

	<?php $Item->edit_link( ' &bull; ' ) // Link to backoffice for editing ?>
<?php
if (is_logged_in()) {
if (!empty($Comment->author_url) && ($Comment->author_url != 'http://') && ($current_User->check_perm( 'spamblacklist', 'edit' ) ) ) {
         $baseDomain = preg_replace("/http:\/\//i", "", $Comment->author_url);
        $baseDomain = preg_replace("/^www\./i", "", $baseDomain);
        $baseDomain = preg_replace("/\/.*/i", "", $baseDomain);
?>
<a href="<?php echo $baseurl.'/'.$admin_subdir.'/'; ?>b2antispam.php?action=ban&amp;keyword=<?php echo urlencode($baseDomain) ?>"><img src="img/noicon.gif" class="middle" alt="<?php echo /* TRANS: Abbrev. */ T_('Ban') ?>" title="<?php echo T_('Ban this domain!') ?>" /></a>&nbsp;
<?php } }  ?>

			<?php $Item->trackback_rdf() // trackback autodiscovery information ?>
		</div>

13 Apr 20, 2006 19:48

Ups! Sorry! This code had to go into the _feedback.php. My fault! Sorry for disturbing you. THanx! =)

14 Apr 20, 2006 20:20

*acts disturbed*

*stops acting*

Damn, no difference huh? :p

Glad you've solved it ;)

¥


Form is loading...