[2.0.17] Message Can

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
3
43%
Very Good
2
29%
Good
1
14%
Fair
0
No votes
Poor
1
14%
 
Total votes: 7

zeropoint
Registered User
Posts: 8
Joined: Fri Jul 02, 2004 4:40 am
Location: Holland
Contact:

Post by zeropoint »

buweichiu I have checked every file thoroughly but didn't find any mistake.

What I found in posting.php and privmsg.php

$template->assign_vars(array(
'MESSAGE_TITLE' => $lang['Information'],
'MESSAGE_TEXT' => $l_confirm,


and in your MOD the same variables:

$template->assign_block_vars('messagecan', array(
'MESSAGE_TITLE'=> $row['msg_title'],
'MESSAGE_TEXT'=> $row['msg_text'])


Please keep in mind that I have no knowledge of PHP, may be what I'm talking makes no sense.

Greetings.
User avatar
buweichiu
Registered User
Posts: 23
Joined: Mon Sep 20, 2004 1:39 pm

Post by buweichiu »

Message Can's variables is to output into a block called messagecan

<!-- BEGIN messagecan -->
{messagecan.MESSAGE_TITLE} and {messagecan.MESSAGE_TEXT} only work inside of this block.
<!-- END messagecan -->

So, I don't think this is the point of the problem.

Can you explain your test environment?
zeropoint
Registered User
Posts: 8
Joined: Fri Jul 02, 2004 4:40 am
Location: Holland
Contact:

Post by zeropoint »

Hi buweichiu

It works like charm. Fantastic mod.

Now mod is working 100% and nothing is wrong with your MOD, it was my mistake.

This line caused me all the problems:

&nbsp; {L_MESSAGECAN}:<select name="addbbcode22" onChange="emoticon(this.form.addbbcode22.options[this.form.addbbcode22.selectedIndex].value);this.selectedIndex=0;" onMouseOver="helpline('messagecan')">

I have installed a lot of BBCodes buttons and every button should be increased by 2 like name="addbbcode16" name="addbbcode18" name="addbbcode20" and so on. When I did count my BBcodes buttons then above-mentioned line should be read as:

&nbsp; {L_MESSAGECAN}:<select name="addbbcode34" onChange="emoticon(this.form.addbbcode34.options[this.form.addbbcode34.selectedIndex].value);this.selectedIndex=0;" onMouseOver="helpline('messagecan')">

Now, it works great, you can check it out.

Thanks for your help and attention.

Greetings.
User avatar
buweichiu
Registered User
Posts: 23
Joined: Mon Sep 20, 2004 1:39 pm

Post by buweichiu »

Oh, this is a common problem.
I should write it in Author's Note in next version.
whozyodaddy
Registered User
Posts: 186
Joined: Sat May 08, 2004 4:26 am

Post by whozyodaddy »

It didn't work for me. It worked when I changed 'addbbcode' to 'addbbcodefontsize'.
Valeur
Registered User
Posts: 4
Joined: Tue Aug 09, 2005 8:54 pm
Location: Richmond Hill, ON
Contact:

Post by Valeur »

Great MOD, installed like a charm, but I'd like to restrict it's usage to board mods and admins; any suggestions?
Valeur
Registered User
Posts: 4
Joined: Tue Aug 09, 2005 8:54 pm
Location: Richmond Hill, ON
Contact:

Post by Valeur »

Valeur wrote: Great MOD, installed like a charm, but I'd like to restrict it's usage to board mods and admins; any suggestions?


Nevermind, I've found a suitable hack; as described...

http://www.phpbb.com/phpBB/viewtopic.php?t=316565
internetbrother
Registered User
Posts: 230
Joined: Mon Mar 28, 2005 6:30 pm

Post by internetbrother »

Any Demo?
k10magic
Registered User
Posts: 314
Joined: Thu Mar 20, 2003 11:38 pm
Location: Canada

Post by k10magic »

Yes, a demo please?
rawtoxic
Registered User
Posts: 54
Joined: Sat Mar 19, 2005 2:36 am
Location: US
Contact:

Post by rawtoxic »

This mod works great. However, as valeur stated earlier if you only want mods/admins to be able to view it, there are a few suggestions. Valeur found a hack that makes it where you can put <!-- --> tags in your tpl to make it only show the options to admins only or admins and mods only. Here is the code for the switches.

This is tested and working with both this hack and phpBB 2.0.18!

This idea was inspired by Valeur and code was borrowed from:

Hack Title: Admin Only View
Hack Version: 1.0.0
Author: Majorflam <majorflam@blueyonder.co.uk>
Description: This hack allows you to place switches between code in any tpl file. When the page is generated, only administrators may see the code that is between the switches.
Compatibility: 2.0.6 - 2.0.10

Code: Select all

# 
#-----[ OPEN ]------------------------------------------ 
# 

includes/page_header.php 

# 
#-----[ FIND ]------------------------------------------ 
# 

$template->assign_block_vars('switch_user_logged_in', array()); 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# For Admin View Only

// Admin Only View Mod    
   if ( $userdata['user_level'] == ADMIN ) 
   { 
      $template->assign_block_vars('switch_admin_view_only', array()); 
   } 
// Admin Only View Mod 

// 
// Admin or Mod View Only 
// 
   if ( $userdata['user_level'] == MOD || $userdata['user_level'] == ADMIN ) 
   { 
      $template->assign_block_vars('switch_admin_mod_view_only', array()); 
    } 
// Admin or Mod View Only

# 
#-----[ OPEN ]------------------------------------------ 
# 
# templates/subSilver/posting_body.tpl 

#
#-----[ NOTE ]------------------------------------------ 
# The <!-- BEGIN messagecan --> and <!-- END messagecan -->
# switches cannot be nested within the permission switches!! 
# Therefore we will have to place a set of both the begin and 
# end permission tags before and after the messagecan switches.

# 
#-----[ FIND ]------------------------------------------ 
# 
 
&nbsp; {L_MESSAGECAN}:<select name="addbbcode22" onChange="emoticon(this.form.addbbcode22.options[this.form.addbbcode22.selectedIndex].value);this.selectedIndex=0;" onMouseOver="helpline('messagecan')">
<option value="" class="genmed">{L_MESSAGECAN_DEFAULT}</option> 

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# Depending on the type of permissions you want to set
# choose ONLY one of the following two lines!

<!-- BEGIN switch_admin_view_only --> 

<!-- BEGIN switch_admin_mod_view_only -->

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# Depending on the type of permissions you want to set
# choose ONLY one of the following two lines!

<!-- END switch_admin_view_only --> 

<!-- END switch_admin_mod_view_only -->

# 
#-----[ FIND ]------------------------------------------ 
# Just find the part and skip to the next step.

<!-- BEGIN messagecan -->
<option value="{messagecan.MESSAGE_TEXT}" class="genmed">{messagecan.MESSAGE_TITLE}</option>
<!-- END messagecan -->

#
#-----[ FIND ]------------------------------------------ 
#

</select>

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# Depending on the type of permissions you want to set
# choose ONLY one of the following two lines!

<!-- BEGIN switch_admin_view_only --> 

<!-- BEGIN switch_admin_mod_view_only -->

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# Depending on the type of permissions you want to set
# choose ONLY one of the following two lines!

<!-- END switch_admin_view_only --> 

<!-- END switch_admin_mod_view_only -->

# 
#-----[ SAVE & CLOSE ALL FILES ]-------------------------- 
# 
Now your MessageCan will only show up for Admins Only or Mods/Admins Only depending on which permission switches you chose.

When I applied this mod (MessageCan) to my posting_body.tpl, it made the Close Tags button move into a weird spot because the Message: Default field wrapped on a new line. To fix it, I created a new table row below the Close Tags item and moved the Message: Default to it. Then I moved the Permission Switches a little to make them work properly again.

Good Mod and Thank You!
rawtoxic
Registered User
Posts: 54
Joined: Sat Mar 19, 2005 2:36 am
Location: US
Contact:

Post by rawtoxic »

Demo of ACP View:

Image

Demo of Posting Body for Post and Private Messages

Image
k10magic
Registered User
Posts: 314
Joined: Thu Mar 20, 2003 11:38 pm
Location: Canada

Post by k10magic »

Is it compatible with PCP?
rawtoxic
Registered User
Posts: 54
Joined: Sat Mar 19, 2005 2:36 am
Location: US
Contact:

Post by rawtoxic »

Have no idea. I don't use it.
whozyodaddy
Registered User
Posts: 186
Joined: Sat May 08, 2004 4:26 am

Post by whozyodaddy »

Since using your admin only mod, only the admin can actually see the field with the other BB codes, although I can't select anything. Next to message the only thing that shows is 'Default', even when in the admin panel there are alot of messages! Please help.
rawtoxic
Registered User
Posts: 54
Joined: Sat Mar 19, 2005 2:36 am
Location: US
Contact:

Post by rawtoxic »

It seems that you might have either placed the TPL switches in the wrong part of the postingbody.tpl file or other mods that are installed messed my instructions up. Please post your postingbody.tpl so I can take a look and i'll help you out. :)
Post Reply

Return to “[2.0.x] MOD Database Releases”