21
martyras
News-block module
  • 2004/12/6 21:39

  • martyras

  • Just popping in

  • Posts: 37

  • Since: 2004/11/1


Hi all.

I have used the News-block module (xoops2_block_news-block_1.zip available here at xoops.org). Everything goes as expected with one exception. It seems that this module doesn't look if a news post is expired or has set to be shown at a specific date and it shows them too. Anyone has a fix for that?

Tha code of the module it this:

<?php
// ######################################################################
// # News-block:                                                        #
// # v1  10/02/2004  FOR XOOPS v2                                       #
// # Ported by: Sylvain B. (sylvain@123rando.com)                       #
// # http://123rando.com                                                #
// #                                                                    #
// ######################################################################
// # PHP-Nuke                                                           #
// #====================================================================#
// # Copyright (c) 2003 - Francisco Burzi                               #
// # http://phpnuke.org/                                                #
// #====================================================================#
// # Paladin's block-Articles_Info for PHP-Nuke 6.5                     #
// #====================================================================#
// # Copyright (c) 2003 - Darren Poulton (paladin@intaleather.com.au)   #
// # http://paladin.intaleather.com.au/                                 #
// #====================================================================#
// # Use of this program is goverened by the terms of the GNU General   #
// # Public License (GPL - version 1 or 2) as published by the          #
// # Free Software Foundation (http://www.gnu.org/)                     #
// ######################################################################

function block_articles_info ($options) {

global 
$xoopsDB$xoopsUser;

        
$block = array();
        
$block['title'] = _MB_ARTICLE_INF;

        
$block['content'] = "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=1 WIDTH=100%><TR><TD WIDTH=100% ALIGN=right VALIGN=TOP CLASS="odd">";
        
$block['content'] .= "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>";
        
$block['content'] .= "<TR><TD WIDTH=100% ALIGN=left CLASS="itemHead"><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>";
        
$block['content'] .= "<tr><th ALIGN=left WIDTH=10%><B>"._MB_LDCAT."</B></th>";
        
$block['content'] .= "<th ALIGN=left WIDTH=80%><B>"._MB_LDTITLE."</B></th><th align=left WIDTH=5%><B>"._MB_LDCOUNTER."</B></th>";
        
//$block['content'] .= "<th align=left WIDTH=5%><B>"._MB_LDCOMTOTAL."</B></th>";
        
        
        
$limit $options[0];
        
$color $bgcolor3;
        
$sql "SELECT t.topic_title, s.storyid, s.topicid, s.title, s.comments, s.counter
                        FROM "
.$xoopsDB->prefix("stories")." s, ".$xoopsDB->prefix("topics")." t
                        WHERE s.topicid=t.topic_id  
                        ORDER BY s.storyid DESC LIMIT 
$limit";
        
$result $xoopsDB->query($sql);
        while (list(
$cat$sid$topicid$title$comtotal$counter) = $xoopsDB->fetchRow($result)) {
        
$block['content'] .= "<tr><td ALIGN=left WIDTH="80" CLASS="odd"><A HREF="".XOOPS_URL."/modules/news/index.php?storytopic=$topicid"><I>$cat</I></A>";
        
$block['content'] .= "</TD><TD CLASS="odd"><a href="".XOOPS_URL."/modules/news/article.php?storyid=$sid">$title</a></td>";
        
$block['content'] .= "<td align=right width ="5" CLASS="odd">$counter</td>";
        
//$block['content'] .= "<td align=right width ="5" CLASS="odd">$comtotal</td></tr>";
        
}
        
        
$block['content'] .= "</TABLE></TD></TR></TABLE>";
        
//$block['content'] .= "<CENTER>|[ <A HREF="".XOOPS_URL."/modules/news/index.php">"._MB_MORELINK."</A> ]";
        //if ($options[1] == 1) {
        //$block['content'] .= "|[ <A HREF="".XOOPS_URL."/modules/news/index.php">"._MB_TOPICLINK."</A> ]"; 
        //}
        //if ($options[2] == 1) { 
        //$block['content'] .= "|[ <A HREF="".XOOPS_URL."/modules/news/archive.php">"._MB_ARCHIVELINK."</A> ]";
        //}
        //if ($options[3] == 1) {
        //        if (empty($xoopsUser))
        //        {
        //            $block['content'] .= "";
        //        } else {
        //                $block['content'] .= "|[ <A HREF="".XOOPS_URL."/modules/news/submit.php">"._MB_SUBMITLINK."</A> ]";
        //        }
        //}
        //$block['content'] .= "|</CENTER></TD></TR></TABLE>";
        
$block['content'] .= "</TD></TR></TABLE>";
        return 
$block;
}



function 
b_articles_info_edit($options) {
        
$tabletag1='<tr><td>';
        
$tabletag2='</td><td>';

        
$form "<table border='0'>";
        
$form .= $tabletag1._MB_ARTICLE_DISPLAY.$tabletag2;
        
$form .= "<input type='text' name='options[]' value='".$options[0]."' size='4'>&nbsp;"._MB_ARTICLES."</td></tr>";
        
$form .= $tabletag1._MB_TOPICLINK.$tabletag2;
        
$form .= mk_chkbox($options,1);
        
$form .= $tabletag1._MB_ARCHIVELINK.$tabletag2;
        
$form .= mk_chkbox($options,2);
        
$form .= $tabletag1._MB_SUBMITLINK.$tabletag2;
        
$form .= mk_chkbox($options,3);
        
$form .= "</table>";
        return 
$form;
}

function 
mk_chkbox($options$number) {
    
$chk   "";
    if (
$options[$number] == 0) {
        
$chk " checked='checked'";
    }
    
$chkbox"<input type='radio' name='options[$number]' value='0'".$chk." />&nbsp;"._NO."&nbsp;&nbsp;";
    
$chk   "";
    if (
$options[$number] == 1) {
        
$chk " checked='checked'";
    }
    
$chkbox .= "<input type='radio' name='options[$number]' value='1'".$chk." />&nbsp;"._YES."</td></tr>";
    RETURN 
$chkbox;
}
?>



22
martyras
Re: Temporarily disable a user account
  • 2004/12/2 22:09

  • martyras

  • Just popping in

  • Posts: 37

  • Since: 2004/11/1


Yeah, maybe, I'll stick to that method, I prefer it too (and there is not other method anyway i think).



23
martyras
Temporarily disable a user account
  • 2004/12/2 20:44

  • martyras

  • Just popping in

  • Posts: 37

  • Since: 2004/11/1


Hi,

I would like to ask if there is a way to make a user account temporararily disabled (so when he tries to login, a message displays him that he has been disabled for a while). Or the only way is to make a new group with absolute no rights except the ovious and put everytime that user account there?

Tnx.



24
martyras
Re: See user account before enabling it?
  • 2004/12/2 12:47

  • martyras

  • Just popping in

  • Posts: 37

  • Since: 2004/11/1


Ok I have modified the code so the activation email tha goes to admin, includes more info about the user.

In register.php I added:

$xoopsMailer->assign('USERREALNAME'$myts->oopsStripSlashesGPC($name));
$xoopsMailer->assign('USERADDRESS'$myts->oopsStripSlashesGPC($user_from));


And updated the adminactivate.tpl to include the info i wanted using {USERREALNAME} & {USERADDRESS}.

But if for some reason, the mail server has a problem (so i can't receive any e-mail), I can't find a way to see the user's entered details from the Administration without activating him first.

I would also like to ask an other thing. Is there a way to temporarly de-activate a user account so it can't login? (restrict access for a while).

Thank you again.



25
martyras
See user account before enabling it?
  • 2004/12/2 11:02

  • martyras

  • Just popping in

  • Posts: 37

  • Since: 2004/11/1


Hi my friends.

I have set my website so that webmaster only can enable new user accounts. But I would like to preview the account before enabling it (see the details such as real name). Is there a way to do it? Or if you can help me modyfing the "account activation" email that comes to webmaster so that it shows more details, not only the person's username.

Thank you.



26
martyras
Re: Make a latest news block match the one from news2
  • 2004/11/28 9:30

  • martyras

  • Just popping in

  • Posts: 37

  • Since: 2004/11/1


Posted a solution i've found on that topic. Whoever wants to help or see the hack visit that topic.

Happy xooping.



27
martyras
Re:How to put news on index page
  • 2004/11/28 9:26

  • martyras

  • Just popping in

  • Posts: 37

  • Since: 2004/11/1


Found a way through displaying correctly html code images and others. Although the best way is to read the database to see what preferences you've set for html, bbcodes or smilies, this is a start.

In news_top.php.

Change this:
Quote:
$news['text'] = $myts->displayTarea( $myrow['hometext'] );


With this:
Quote:
$html = 1;
$smiley = 1;
$xcodes = 1;
$news['text'] = $myts->makeTareaData4Show($myrow['hometext'],$html,$smiley,$xcodes);


Whoever finds how to display also topic name on the block or how to make it more slick, post it as I think this interests a lot of people.

Happy xooping!



28
martyras
Re: Make a latest news block match the one from news2
  • 2004/11/27 18:05

  • martyras

  • Just popping in

  • Posts: 37

  • Since: 2004/11/1


After a 2 hours search i found this hack:

https://xoops.org/modules/newbb/viewtopic.php?topic_id=23240&viewmode=flat&order=ASC&start=10

But the problem is that html code works only for links. It seems not to recognise html <img>, for example:

Quote:
<img border="0" src="/temp/xoops/images/news/01.jpg" width="210" height="171" align="left" hspace="4">


Does any of the guys made this hack can help me one this?

Thanks again.



29
martyras
Re: Make a latest news block match the one from news2
  • 2004/11/27 14:48

  • martyras

  • Just popping in

  • Posts: 37

  • Since: 2004/11/1


I made a mistake. Where i say news2 it's actually news 1.2.1. Sorry.

Thanks for viewing.



30
martyras
Make a latest news block match the one from news2
  • 2004/11/27 13:36

  • martyras

  • Just popping in

  • Posts: 37

  • Since: 2004/11/1


Hi my helpful friends,

I was using on my site as a start page the news modules when i lately discovered that whatever i would add to be displayed in the start page, would be displayed at the news pages also (probably cause i have set news as the start page).

I used then spotlight but the "other news" option that it has, doesn't fills me cause it's different from the news layout.

So i came to the conclusion to make a module on my own so I can display the latest news on frontpage without specifying news as start page.

For my module, i made the /template/blocks/all_news.htm look like this:

<table cellpadding="0" cellspacing="0" class="item">
    <
tr>
        <
td>
        <
table cellpadding="0" cellspacing="0" width="98%">
            <
tbody>
                <
tr>
                    <
td class="itemHead">
                        <
span class="itemTitle"><{$story.title}></span>
                    </
td>
                </
tr>
                <
tr>
                    <
td class="itemInfo">
                        <{if 
$story.poster != ''}><span class="itemPoster"><{$lang_postedby}> <{$story.poster}></span><{/if}>
                        <
span class="itemPostDate"><{$lang_on}> <{$story.posttime}></span> (<span class="itemStats"><{$story.hits}> <{$lang_reads}></span>)
                    </
td>
                </
tr>
                <
tr>
                    <
td><div class="itemBody">
                            <{
$story.imglink}>
                            <
class="itemText"><{$story.text}></p>
                        </
div>
                    </
td>
                </
tr>
                <
tr>
                    <
td class="itemFoot">
                        <
span class="itemAdminLink"><{$story.adminlink}></span>
                        <
span class="itemPermaLink"><{$story.morelink}></span>
                    </
td>
                </
tr>
             </
tbody>
         </
table>
      </
td>
  </
tr>
</
table>


Now I need the blocks/all_news.php code so it could read the values for the above template to be shown correctly. I have searched the news2 module but I cannot find a way through the code. I only need the part which news2 module reads the latest news to be displayed on index (start page).

This will help a lot people I think.

Thank you.




TopTop
« 1 2 (3) 4 »



Login

Who's Online

210 user(s) are online (137 user(s) are browsing Support Forums)


Members: 0


Guests: 210


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