11
iHackCode
Re: hack needed?

im lost.. on what people are thinking or know so far.... so recap..

File: comment_view.php
the variable $commentsnav is defined as $navbar .. $navbar being defined at line 153 or so.. (the whole table for the two dropdown list and the refresh button and post button)

variable like $editcomment_link defined as 'comment_edit.php?com_itemid='.$com_itemid.'&com_order='.$com_order.'&com_mode='.$com_mode.''.$link_extra
and so on..

template: system_comment.html
uses $editcomment_link and other links for the button links on the comments.

oh.. this post is 3 years old?!
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

12
svaha
Re: hack needed?
  • 2006/3/11 0:35

  • svaha

  • Just can't stay away

  • Posts: 896

  • Since: 2003/8/2 2


Quote:

Bandit-X wrote:
im lost.. on what people are thinking or know so far.... so recap..

File: comment_view.php
the variable $commentsnav is defined as $navbar .. $navbar being defined at line 153 or so.. (the whole table for the two dropdown list and the refresh button and post button)

variable like $editcomment_link defined as 'comment_edit.php?com_itemid='.$com_itemid.'&com_order='.$com_order.'&com_mode='.$com_mode.''.$link_extra
and so on..

template: system_comment.html
uses $editcomment_link and other links for the button links on the comments.

oh.. this post is 3 years old?!


Yep 3 years old and I got a notice, so that system works
What doesn't kill me,
makes me stronger.

http://exm.amevita.eu
http://www.amevita.eu
http://www.alohaspirit.nl

13
ladon
Re: hack needed?
  • 2006/3/11 20:29

  • ladon

  • Quite a regular

  • Posts: 284

  • Since: 2003/10/31


Kellymac send me a PM about this thread, so i'll post it here:
Quote:

Did you evern figure out the problem in tread:
https://xoops.org/modules/newbb/viewtopic.php?topic_id=14732&forum=14&post_id=60506

Thanks!

Kellymac, i sure did figure it out. What exactly do you want to do? If you want to remove everything but the 'post reply' button as i wanted, it's a matter of hack&slash. I simply removed everything i didn't have any use for:

(this is XOOPS 2.0.10 don't know if anything changed here, i assume not)

original:
// assign comment nav bar
        
$navbar '
<form method="get" action="'
.$comment_config['pageName'].'">
<table width="95%" class="outer" cellspacing="1">
  <tr>
    <td class="even" align="center"><select name="com_mode"><option value="flat"'
;
        if (
$com_mode == 'flat') {
            
$navbar .= ' selected="selected"';
        }
        
$navbar .= '>'._FLAT.'</option><option value="thread"';
        if (
$com_mode == 'thread' || $com_mode == '') {
            
$navbar .= ' selected="selected"';
        }
        
$navbar .= '>'_THREADED .'</option><option value="nest"';
        if (
$com_mode == 'nest') {
            
$navbar .= ' selected="selected"';
        }
        
$navbar .= '>'_NESTED .'</option></select> <select name="com_order"><option value="'.XOOPS_COMMENT_OLD1ST.'"';
        if (
$com_order == XOOPS_COMMENT_OLD1ST) {
            
$navbar .= ' selected="selected"';
        }
        
$navbar .= '>'_OLDESTFIRST .'</option><option value="'.XOOPS_COMMENT_NEW1ST.'"';
        if (
$com_order == XOOPS_COMMENT_NEW1ST) {
            
$navbar .= ' selected="selected"';
        }
        unset(
$postcomment_link);
        
$navbar .= '>'_NEWESTFIRST .'</option></select><input type="hidden" name="'.$comment_config['itemName'].'" value="'.$com_itemid.'" /> <input type="submit" value="'_CM_REFRESH .'" class="formButton" />';
        if (!empty(
$xoopsModuleConfig['com_anonpost']) || is_object($xoopsUser)) {
            
$postcomment_link 'comment_new.php?com_itemid='.$com_itemid.'&com_order='.$com_order.'&com_mode='.$com_mode;

            
$xoopsTpl->assign('anon_canpost'true);
        }
        
$link_extra '';
        if (isset(
$comment_config['extraParams']) && is_array($comment_config['extraParams'])) {
            foreach (
$comment_config['extraParams'] as $extra_param) {
                if (isset(${
$extra_param})) {
                    
$link_extra .= '&'.$extra_param.'='.${$extra_param};
                    
$hidden_value htmlspecialchars(${$extra_param}, ENT_QUOTES);
                    
$extra_param_val = ${$extra_param};
                } elseif (isset(
$_POST[$extra_param])) {
                    
$extra_param_val $_POST[$extra_param];
                } elseif (isset(
$_GET[$extra_param])) {
                    
$extra_param_val $_GET[$extra_param];
                }
                if (isset(
$extra_param_val)) {
                    
$link_extra .= '&'.$extra_param.'='.$extra_param_val;
                    
$hidden_value htmlspecialchars($extra_param_valENT_QUOTES);
                    
$navbar .= '<input type="hidden" name="'.$extra_param.'" value="'.$hidden_value.'" />';
                }
            }
        }
        if (isset(
$postcomment_link)) {
            
$navbar .= '&nbsp;<input type="button" onclick="self.location.href=''.$postcomment_link.''.$link_extra.''" class="formButton" value="'._CM_POSTCOMMENT.'" />';
        }
        
$navbar .= '
    </td>
  </tr>
</table>
</form>'
;
        
$xoopsTpl->assign(array('commentsnav' => $navbar'editcomment_link' => 'comment_edit.php?com_itemid='.$com_itemid.'&com_order='.$com_order.'&com_mode='.$com_mode.''.$link_extra'deletecomment_link' => 'comment_delete.php?com_itemid='.$com_itemid.'&com_order='.$com_order.'&com_mode='.$com_mode.''.$link_extra'replycomment_link' => 'comment_reply.php?com_itemid='.$com_itemid.'&com_order='.$com_order.'&com_mode='.$com_mode.''.$link_extra));

        
// assign some lang variables
        
$xoopsTpl->assign(array('lang_from' => _CM_FROM'lang_joined' => _CM_JOINED'lang_posts' => _CM_POSTS'lang_poster' => _CM_POSTER'lang_thread' => _CM_THREAD'lang_edit' => _EDIT'lang_delete' => _DELETE'lang_reply' => _REPLY'lang_subject' => _CM_REPLIES'lang_posted' => _CM_POSTED'lang_updated' => _CM_UPDATED'lang_notice' => _CM_NOTICE));
    }
}

My version:
// assign comment navbar
$navbar '
<form method="get" action="'
.$comment_config['pageName'].'">
    <td class="even" align="right">'
;
        if (!empty(
$xoopsModuleConfig['com_anonpost']) || is_object($xoopsUser)) {
            
$postcomment_link 'comment_new.php?com_itemid='.$com_itemid.'&com_order='.$com_order.'&com_mode='.$com_mode;

            
$xoopsTpl->assign('anon_canpost'true);
        }
        
$link_extra '';
        if (isset(
$comment_config['extraParams']) && is_array($comment_config['extraParams'])) {
            foreach (
$comment_config['extraParams'] as $extra_param) {
                if (isset(${
$extra_param})) {
                    
$link_extra .= '&'.$extra_param.'='.${$extra_param};
                    
$hidden_value htmlspecialchars(${$extra_param}, ENT_QUOTES);
                    
$extra_param_val = ${$extra_param};
                } elseif (isset(
$_POST[$extra_param])) {
                    
$extra_param_val $_POST[$extra_param];
                } elseif (isset(
$_GET[$extra_param])) {
                    
$extra_param_val $_GET[$extra_param];
                }
                if (isset(
$extra_param_val)) {
                    
$link_extra .= '&'.$extra_param.'='.$extra_param_val;
                    
$hidden_value htmlspecialchars($extra_param_valENT_QUOTES);
                    
$navbar .= '<input type="hidden" name="'.$extra_param.'" value="'.$hidden_value.'" />';
                }
            }
        }
        if (isset(
$postcomment_link)) {
            
$navbar .= '&nbsp;<input type="button" onclick="self.location.href=''.$postcomment_link.''.$link_extra.''" class="formButton" value="'._CM_POSTCOMMENT.'" />';
        }
        
$navbar .= 
    </td>
</form>'
;
        
$xoopsTpl->assign(array('commentsnav' => $navbar'editcomment_link' => 'comment_edit.php?com_itemid='.$com_itemid.'&com_order='.$com_order.'&com_mode='.$com_mode.''.$link_extra'deletecomment_link' => 'comment_delete.php?com_itemid='.$com_itemid.'&com_order='.$com_order.'&com_mode='.$com_mode.''.$link_extra'replycomment_link' => 'comment_reply.php?com_itemid='.$com_itemid.'&com_order='.$com_order.'&com_mode='.$com_mode.''.$link_extra));

        
// assign some lang variables
        
$xoopsTpl->assign(array('lang_from' => _CM_FROM'lang_joined' => _CM_JOINED'lang_posts' => _CM_POSTS'lang_poster' => _CM_POSTER'lang_thread' => _CM_THREAD'lang_edit' => _EDIT'lang_delete' => _DELETE'lang_reply' => _REPLY'lang_subject' => _CM_REPLIES'lang_posted' => _CM_POSTED'lang_updated' => _CM_UPDATED'lang_notice' => _CM_NOTICE));
    }
}


But be careful in using it. for example, i removed the <table> tags containing the form, This will screw up your templates. So according to your needs, change it accordingly (like adding tables).
I am the BEST.......... at overstating things! - Resized Image

14
Kellymac
Re: hack needed?
  • 2006/10/18 16:54

  • Kellymac

  • Just popping in

  • Posts: 41

  • Since: 2006/2/1 1


Actually. What I am trying to accomplish is that registered users could post a comment but not replies.

15
Djiman
Re: hack needed?
  • 2006/10/18 18:23

  • Djiman

  • Just popping in

  • Posts: 91

  • Since: 2006/7/26


then, just remove the 'REPLY' button from your template.

16
ladon
Re: hack needed?
  • 2006/10/18 20:13

  • ladon

  • Quite a regular

  • Posts: 284

  • Since: 2003/10/31


Lol Kellymac, this is the most streched topic i've ever seen

What you want to do has nothing to do with this thread whatsoever. The reply button is integrated in the commenttemplate. As stated above just remove the button.

go to your templates admin -> system -> 'system_comment.html' find this line:
<a href="<{$replycomment_link}>&amp;com_id=<{$comment.id}>"><img src="<{$xoops_url}>/images/icons/reply.gif" alt="<{$lang_reply}>" /></a>

and remove it. It's in there more then once, so remove where you want it (if user or if admin etc.)
I am the BEST.......... at overstating things! - Resized Image

17
Kellymac
Re: hack needed?
  • 2006/10/19 16:51

  • Kellymac

  • Just popping in

  • Posts: 41

  • Since: 2006/2/1 1


That's great! It worked!
Now I wonder if theres a way to only allow 10 comments, newest first and the older ones droping off as new ones are added?

18
ladon
Re: hack needed?
  • 2006/10/19 20:30

  • ladon

  • Quite a regular

  • Posts: 284

  • Since: 2003/10/31


impossible is nothing

I was hoping i could do this by using smarty, but that doesn't seem quite that easy. A quick and dirty way to do this is by doing the following:

Make sure that in admin->settings comment order is set to newest first. (this won't apply to registered users, but an SQL update statement should cure that).

Then, the ugly part: go to file /kernel/comnment.php and look for 'function &getByItemId'. In the parameters change '$limit = null' to '$limit = 10'.
I am the BEST.......... at overstating things! - Resized Image

19
Kellymac
Re: hack needed?
  • 2006/10/20 15:04

  • Kellymac

  • Just popping in

  • Posts: 41

  • Since: 2006/2/1 1


Close. It does only allow 10 comments. But, after that no new ones can be added. The goal is to only allow 10 at a time with new comments to be added and the oldest to purge.

20
Kellymac
Re: hack needed?
  • 2006/10/20 15:11

  • Kellymac

  • Just popping in

  • Posts: 41

  • Since: 2006/2/1 1


NEVERMIND. It works just fine for users and annonymous. Just not for admin and that's fine. Thanks!!!

Login

Who's Online

185 user(s) are online (146 user(s) are browsing Support Forums)


Members: 0


Guests: 185


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits